0

6E64864A-36AF-4B83-8EF5-6E58C4A6117AWhen I try to create same room twice in a row, I RECV presence stanza from service containing "201" status code both times.

Is that expected behavior? From XEP-0045, it seems 201 should be send ONLY when the room was created first time.

Please help me understand this. Why is status code 201 sent both times?

How can I differentiate b/w a creating new room vs joining existing room?

Please see below the sequence:

---------First Request starts here

SEND: <presence to="erik_yo@conference.localhost/GJ">
<x xmlns="http://jabber.org/protocol/muc"/>
<x xmlns="vcard-temp:x:update"><photo/></x></presence>


RECV: <presence xmlns="jabber:client" from="erik_yo@conference.localhost/GJ" to="erik@localhost/imac">
<x xmlns="vcard-temp:x:update"><photo/></x>
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="erik@localhost/imac" affiliation="owner" role="moderator"/>
<status code="110"/><status code="201"/></x></presence>
// configure the room persistent here
//<field type="boolean" var="muc#roomconfig_persistentroom" value="1"/>
SEND: <iq type="set" to="erik_yo@conference.localhost" id="6E64864A-36AF-4B83-8EF5-6E58C4A6117A">
<query xmlns="http://jabber.org/protocol/muc#owner"><x .........

RECV: <iq xmlns="jabber:client" from="yo@conference.localhost" 
to="erik@localhost/imac" id="6E64864A-36AF-4B83-8EF5-6E58C4A6117A" type="result">
<query xmlns="http://jabber.org/protocol/muc#owner"/></iq>

---------Second request starts here

SEND: <presence to="erik_yo@conference.localhost/GJ" type="unavailable">
<x xmlns="vcard-temp:x:update"><photo/></x></presence>

SEND: <presence to="erik_yo@conference.localhost/GJ">
<x xmlns="http://jabber.org/protocol/muc"/>
<x xmlns="vcard-temp:x:update"><photo/></x></presence>

RECV: <presence xmlns="jabber:client" from="erik_yo@conference.localhost/GJ" to="erik@localhost/imac" type="unavailable">
<x xmlns="vcard-temp:x:update"><photo/></x><x xmlns="http://jabber.org/protocol/muc#user"><item affiliation="owner" role="none"/>
<status code="110"/></x></presence>

RECV: <presence xmlns="jabber:client" from="erik_yo@conference.localhost/GJ" to="erik@localhost/imac">
<x xmlns="vcard-temp:x:update"><photo/></x>
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="erik@localhost/imac" affiliation="owner" role="moderator"/><status code="110"/><status code="201"/></x></presence>

----------------------Config stanza sent after first request

 SEND: <iq type="set" to="erik_yo@conference.localhost" id="C72C4629-B318-4733-884B-B6A8BEAFB50F">
<query xmlns="http://jabber.org/protocol/muc#owner"> 
<x xmlns="jabber:x:data" type="submit"><field type="hidden" var="FORM_TYPE"><value>http://jabber.org/protocol/muc#roomconfig</value> <field type="boolean" var="muc#roomconfig_enable_logging" value="1"/> 
<field type="text-single" var="muc#roomconfig_roomname" value="IdeaFactory"/> <field type="boolean" var="muc#roomconfig_membersonly" value="1"/> 
<field type="boolean" var="muc#roomconfig_moderatedroom" value="0"/> 
<field type="boolean" var="muc#roomconfig_persistentroom" value="1"/> <field type="boolean" var="muc#roomconfig_publicroom" value="0"/> <field type="text-single" var="muc#roomconfig_maxusers" value="10"/> <field type="jid-multi" var="muc#roomconfig_roomowners" value="erik@localhost"/> <field type="boolean" var="muc#roomconfig_changesubject" value="1"/></field></x> </query></iq>
Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
GJain
  • 5,025
  • 6
  • 48
  • 82

1 Answers1

1

After entering a room and getting a 201 status code, you're supposed to either accept the default configuration or explicitly configure the room (see section 10.1 of XEP-0045). If you send unavailable presence before doing either of these, the server will destroy the room. Thus, the room is actually "newly created" both times in your example.

Also, for some servers the default setting for a room is "temporary", i.e. the room is destroyed when the last participant leaves. You probably want to configure it as a "persistent room" so that it stays around.

legoscia
  • 39,593
  • 22
  • 116
  • 167
  • looks like I have to default_room_options : persistent:true to ejabberd config....then I dont get the 201 for second request. I will look into why config from client does not work...accepting answer for clarifications – GJain Nov 17 '14 at 17:11
  • didReceivePresence -i am getting status code 303 in return after i configure room. Can you please help me on that @legoscia – Gagan Joshi Jun 11 '15 at 15:15
  • @GaganJoshi You can find a list of numeric status codes here: https://xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init – legoscia Jun 11 '15 at 16:04
  • @legoscia thanks for your help. Can you tell me. if i invite a user. than the invited user also have to configure the room or not. what is the concept of unlock room after configure. Thanks in advance – Gagan Joshi Jun 12 '15 at 07:47
  • You can find a description of that in section 10.1 of XEP-0045: https://xmpp.org/extensions/xep-0045.html#createroom – legoscia Jun 12 '15 at 11:05
  • @legoscia , 6. Once the service receives the completed configuration form from the initial room owner (or receives a request for an instant room), the service MUST "unlock" the room (i.e., allow other users to enter the room) and send an IQ of type "result" to the room owner. If the service receives a cancellation, it MUST destroy the room. Service must unlock the room. but how to unlock the room. – Gagan Joshi Jun 16 '15 at 15:52
  • @legoscia I am also having the same issue but the difference is that I am creating muc room from a ejabberd module. From there how can i accept default room settings? If you get some time please have a look at https://stackoverflow.com/questions/51280426/smackexceptionnoresponseexception-no-response-received-within-reply-timeout-wh – abhishek ranjan Jul 11 '18 at 10:11