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="[email protected]/GJ">
<x xmlns="http://jabber.org/protocol/muc"/>
<x xmlns="vcard-temp:x:update"><photo/></x></presence>
RECV: <presence xmlns="jabber:client" from="[email protected]/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="[email protected]" id="6E64864A-36AF-4B83-8EF5-6E58C4A6117A">
<query xmlns="http://jabber.org/protocol/muc#owner"><x .........
RECV: <iq xmlns="jabber:client" from="[email protected]"
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="[email protected]/GJ" type="unavailable">
<x xmlns="vcard-temp:x:update"><photo/></x></presence>
SEND: <presence to="[email protected]/GJ">
<x xmlns="http://jabber.org/protocol/muc"/>
<x xmlns="vcard-temp:x:update"><photo/></x></presence>
RECV: <presence xmlns="jabber:client" from="[email protected]/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="[email protected]/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="[email protected]" 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>
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.