As stated in ejabberd mod_muc
documentation, ejabberd MUC service allows registering a nickname for a user at the MUC service level:
The MUC service allows any Jabber ID to register a nickname, so nobody
else can use that nickname in any room in the MUC service. To register
a nickname, open the Service Discovery in your XMPP client and
register in the MUC service.
You can do that easily from a client supporting service discovery (Like Psi).
At XMPP level, it translate into the following XMPP packet exchange. Discovery step is optional.
- You can send discovery packet on MUC service to check features:
SEND:
<iq type="get" to="conference.localhost" id="aac1a">
<query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>
- You will receive MUC service feature list, including
register
:
RECV:
<iq from="conference.localhost" type="result" to="test@localhost/MacBook-Pro-de-Mickael" id="aac1a">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="conference" type="text" name="Chatrooms"/>
...
<feature var="jabber:iq:register"/>
...
</query>
</iq>
It means you can you can initiate the nick registration process:
- You can retrieve the nick registration form from MUC service:
SEND:
<iq type="get" to="conference.localhost" id="aac5a">
<query xmlns="jabber:iq:register"/>
</iq>
- MUC service replies with form, containing a single field (the nickname you want to register):
RECV:
<iq from="conference.localhost" type="result" to="test@localhost/MacBook-Pro-de-Mickael" id="aac5a">
<query xmlns="jabber:iq:register">
<instructions>You need a client that supports x:data to register the nickname</instructions>
<x xmlns="jabber:x:data" type="form">
<title>Nickname Registration at conference.localhost</title>
<instructions>Enter nickname you want to register</instructions>
<field type="text-single" label="Nickname" var="nick">
<value/>
</field>
</x>
</query>
</iq>
- You can submit the form, with your desired nickname:
SEND:
<iq type="set" to="conference.localhost" id="aac6a">
<query xmlns="jabber:iq:register">
<x xmlns="jabber:x:data" type="submit">
<field type="text-single" var="nick">
<value>mickael</value>
</field>
</x>
</query>
</iq>
- MUC service replies with success or error. Example in success case:
RECV:
<iq from="conference.localhost" type="result" to="test@localhost/MacBook-Pro-de-Mickael" id="aac6a">
<query xmlns="jabber:iq:register"/>
</iq>