What Demo::JBook Will Do

The JUD can be queried using a normal Jabber client. In Figure 10-1, we can see the search form of Jabber Instant Messenger (JIM).

Searching the JUD: the search form
Figure 10-1. Searching the JUD: the search form

The search fields are not fixed; instead, they’re dynamically generated, according to the result of an initial IQ-get in the jabber:iq:search namespace. Just as an IQ-get in the jabber:iq:register namespace (as illustrated in Section 8.3) is used for registering users, the jabber:iq:search namespace is is used for search requests. This is illustrated in Example 10-1, where an IQ-get is sent to the JUD at jud.gnu.mine.nu.

Example 10-1. An IQ-get to a JUD in the jabber:iq:search namespace
SEND: <iq type="get" id="9138" to="jud.gnu.mine.nu">
        <query xmlns="jabber:iq:search"/>
      </iq>

RECV: <iq from='jud.gnu.mine.nu' id='9138'
          to='qmacro@jabber.org/study' type='result'>
        <query xmlns='jabber:iq:search'>
          <first/>
          <last/>
          <instructions>
            Fill in a field to search for any matching Jabber users.
          </instructions>
        </query>
      </iq>

In response to the IQ-get request, the JUD sends back a list of fields with which the directory can be searched, along with some simple instructions.

The actual search follows the same registration pattern (using the jabber:iq:register namespace) that we saw in Section 8.3. After receiving a list of possible search fields, a search request is made with an IQ-set, as shown ...

Get Programming Jabber now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.