jabber:iq:register
As the name suggests, the jabber:iq:register namespace
is used to conduct registration exchanges between the client and server. The
most obvious example of this is to create (register) a new user on the
Jabber server. We cover user registration, including changes to
user details such as passwords, in
Chapter 7,
so here we’ll look at how to use the namespace to add or
change an entry in the JUD.
First we request the fields for registration with an IQ-get:
SEND: <iq type='get' to='jud.yak' id='jud-2'>
<query xmlns='jabber:iq:register'/>
</iq>
RECV: <iq type='result' to='dj@yak/Work' from='jud.yak' id='jud-2'>
<query xmlns='jabber:iq:register'>
<instructions>
Complete the form to submit your searchable attributes
in the Jabber User Directory
</instructions>
<name/>
<first/>
<last/>
<nick/>
<email/>
</query>
</iq>
and then send an IQ-set to set our information:
SEND: <iq type='set' to='jud.yak' id='jud-3'>
<query xmlns='jabber:iq:register'>
<name>DJ Adams</name>
<first>DJ</first>
<last>Adams</last>
<nick>qmacro</nick>
<email>dj.adams@pobox.com</email>
</query>
</iq>
RECV: <iq type='result' to='dj@yak/Work' from='jud.yak'/>
Note
This idiom—making a request to a service to return the fields appropriate for completion—is common in Jabber and is worth bearing in mind if you’re intending to build a Jabber client. The nature of the form field requests means that the client application has to be flexible and accommodating, to bend itself around the dynamic server. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access