JUD 0.4 CVS + Custom-field Patch
DJ Adams, June 2001
This is a modified (patched) version of the latest CVS version
of the JUD (Jabber User Directory) component. The modifications
allow you as the JUD administrator to specify your own fields
that get stored in the JUD for each user, and also the search
fields that are presented to users in JUD search forms.
Normally, the fields stored in the the JUD are hard-coded to be
<name/>
<first/>
<last/>
<nick/>
<email/>
and these are the same fields that are presented in JUD search
forms.
Now instead of having to live with these hard-coded fields, you
can specify your own fields that suit your system circumstances.
There is also a distinction made between the fields that users
can fill in when they register their entry in the JUD, and the
fields that users can specify values for when searching the JUD.
The specification of the registration and search fields (and the
corresponding instructions) can now be made in the config part
of the JUD xml configuration.
Here's an example:
<service id="jud.yourserver">
<host>jud.yourserver</host>
<load><jud>./jud-0.4/jud.so</jud></load>
<jud xmlns="jabber:config:jud">
<vCard>
<FN>JUD-0.4</FN>
</vCard>
<userbrowse/>
<register>
<instructions>Fill in the fields to register</instructions>
<name/>
<age/>
<colour/>
</register>
<search>
<instructions>Enter values to search</instructions>
<age/>
<colour/>
</search>
</jud>
</service>
This example shows separate field lists for the registration
(<register/>) and search (</search>) processes. The fields in
<search/> are a subset of the fields in <register/>. It doesn't
make sense to specify fields in <search/> that aren't in
<register/>, of course. Note the instructions are also different.
You can also omit the <search/> stanza:
<service id="jud.yourserver">
<host>jud.yourserver</host>
<load><jud>./jud-0.4/jud.so</jud></load>
<jud xmlns="jabber:config:jud">
<vCard>
<FN>JUD-0.4</FN>
</vCard>
<userbrowse/>
<register>
<instructions>Fill in the fields to register</instructions>
<name/>
<age/>
<colour/>
</register>
</jud>
</service>
in which case the fields defined in the <register/> stanza will
be used for both the registration and search processes. The
<instructions> sent in the <search/> process are set to
"Fill in a field to search", rather like the hardcoded search
instructions, in this case.
If you don't specify either a <register/> or <search/>
stanza, JUD will work as before, and supply the hard-coded fields
(and appropriate instructions) as normal. That is, the fall-back
default action is to work as it used to.
Notes
-----
If you're wondering what the <userbrowse/> is for, it's to
switch on the 'browsing allowed' feature of CVS JUD, where you
can send an iq-get jabber:iq:browse request to the JUD JID with
a '/users' resource (e.g. jud.yourserver/users) to get a browse
based list of all JUD entries - this is of course only suitable
for small JUD installations.
You can try out this version in parallel with your existing one
if you want, by unpacking and compiling this version
in a separate directory - say, ./jud-0.4a/ - and giving it a
separate JID (e.g. jud-0.4a.yourserver) in the JSM <browse/>
section and the instance configuration. The XDB (xdb_file)
mechanism will store JUD data by JUD JID in the spool directory.
The changes between the JUD 0.4 CVS version and this Custom-field
patched version exist in two files:
jud_reg.c
jud_search.c