6E64864A-36AF-4B83-8 ef5-6E58C4A6117A当我试图连续两次创建同一房间的时,我将两次从包含"201“状态代码的服务处出现。
这是预期的行为吗?从XEP-0045,似乎201只应发送时,房间是第一次创建。
请帮我理解一下。为什么状态代码201同时发送?
我如何区分b/w创建新房间与加入现有房间?
请参见下面的顺序:
-
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>//在这里配置持久的房间//
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>-。
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> 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>发布于 2014-11-17 11:31:45
进入房间并获得201状态代码后,您应该要么接受默认配置,要么显式配置房间(请参阅XEP-0045第10.1节)。如果在进行这些操作之前发送不可用的存在,服务器将破坏房间。因此,在您的示例中,这个房间实际上都是“新创建的”。
另外,对于某些服务器,房间的默认设置是“临时的”,即当最后一个参与者离开时房间就被破坏了。您可能希望将其配置为“持久空间”,这样它就能在周围停留。
https://stackoverflow.com/questions/26969346
复制相似问题