I am currently implementing an MUC(Members only) application for the mobile platform. I am able to get the MUC working and the mobile clients are able to communicate with one another.
The problem i am trying to solve is that i would like an user to reserve a nickname in the MUC service which is valid across all rooms, so that nobody can disguise him in the chat. I have done a lot of reading but haven't found any appropriate example on an user can reserve a nickname across all rooms.
Any help in pointing me to the right documentation would be appreciated.
Thanks, Mithun
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.
SEND:
<iq type="get" to="conference.localhost" id="aac1a">
<query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>
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:
SEND:
<iq type="get" to="conference.localhost" id="aac5a">
<query xmlns="jabber:iq:register"/>
</iq>
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>
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>
RECV:
<iq from="conference.localhost" type="result" to="test@localhost/MacBook-Pro-de-Mickael" id="aac6a">
<query xmlns="jabber:iq:register"/>
</iq>