1

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

Mithun Raman
  • 309
  • 4
  • 13
  • There is no such feature defined by any of XMPP extensions. Moreover, it's not possible in MongooseIM without modifying the server source code and I'm almost sure it's not possible with ejabberd either. Disclaimer: I am a MongooseIM developer. – erszcz Dec 27 '15 at 18:21
  • 1
    Hi @erszcz, According to http://docs.ejabberd.im/admin/guide/configuration/#modmuc there is a para which states that "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." – Mithun Raman Dec 28 '15 at 02:51
  • Also here https://www.ejabberd.im/node/3121, you can see that someone has commented that we register a nick in the MUC service. But failed to give an example.. – Mithun Raman Dec 28 '15 at 02:52
  • If not reserving a nick across all rooms, is it possible to reserve a nick in an particular room ?? If i can do this, i can at least prevent masquerading in that room.. Thanks – Mithun Raman Dec 28 '15 at 02:55

1 Answers1

2

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.

  1. 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>
  1. 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:

  1. 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>
  1. 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>
  1. 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>
  1. 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>
Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44