0

6E64864A-36AF-4B83-8EF5-6E58C4A6117A当我尝试连续两次创建同一个房间时,我两次都从包含“201”状态代码的服务中接收到存在节。

这是预期的行为吗?从 XEP-0045 开始,似乎 201 应该仅在第一次创建房间时发送。

请帮助我理解这一点。为什么两次发送状态码 201?

我如何区分 b/wa 创建新房间和加入现有房间?

请看下面的顺序:

---------第一个请求从这里开始

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>

---------第二个请求从这里开始

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>
4

1 回答 1

1

进入房间并获得 201 状态代码后,您应该接受默认配置或明确配置房间(参见XEP-0045 的第 10.1 节)。如果您在执行上述任一操作之前发送不可用状态,服务器将破坏房间。因此,在您的示例中,房间实际上都是“新创建的”

此外,对于某些服务器,房间的默认设置是“临时”,即房间在最后一个参与者离开时被销毁。您可能希望将其配置为“永久房间”,以便它留在周围。

于 2014-11-17T11:31:45.300 回答