﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-MemoryGarden's Blog-随笔分类-XMPP</title><link>http://www.cppblog.com/MemoryGarden/category/12633.html</link><description>努力

                                  -----------大能猫</description><language>zh-cn</language><lastBuildDate>Sun, 28 Nov 2010 21:30:47 GMT</lastBuildDate><pubDate>Sun, 28 Nov 2010 21:30:47 GMT</pubDate><ttl>60</ttl><item><title>xmpp muc 群聊协议 4</title><link>http://www.cppblog.com/MemoryGarden/archive/2010/11/29/134942.html</link><dc:creator>memorygarden</dc:creator><author>memorygarden</author><pubDate>Sun, 28 Nov 2010 17:11:00 GMT</pubDate><guid>http://www.cppblog.com/MemoryGarden/archive/2010/11/29/134942.html</guid><wfw:comment>http://www.cppblog.com/MemoryGarden/comments/134942.html</wfw:comment><comments>http://www.cppblog.com/MemoryGarden/archive/2010/11/29/134942.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MemoryGarden/comments/commentRss/134942.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MemoryGarden/services/trackbacks/134942.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 7.Occupant Use CasesThe main actor in a multi-user chat environment is the occupant,who can be said to be located "in" a multi-user chat room and toparticipate in the discussions held in that ...&nbsp;&nbsp;<a href='http://www.cppblog.com/MemoryGarden/archive/2010/11/29/134942.html'>阅读全文</a><img src ="http://www.cppblog.com/MemoryGarden/aggbug/134942.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MemoryGarden/" target="_blank">memorygarden</a> 2010-11-29 01:11 <a href="http://www.cppblog.com/MemoryGarden/archive/2010/11/29/134942.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>xmpp muc 群聊协议 3</title><link>http://www.cppblog.com/MemoryGarden/archive/2010/11/28/134865.html</link><dc:creator>memorygarden</dc:creator><author>memorygarden</author><pubDate>Sat, 27 Nov 2010 16:56:00 GMT</pubDate><guid>http://www.cppblog.com/MemoryGarden/archive/2010/11/28/134865.html</guid><wfw:comment>http://www.cppblog.com/MemoryGarden/comments/134865.html</wfw:comment><comments>http://www.cppblog.com/MemoryGarden/archive/2010/11/28/134865.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MemoryGarden/comments/commentRss/134865.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MemoryGarden/services/trackbacks/134865.html</trackback:ping><description><![CDATA[<h2>6.
<a name="entity" id="entity">Entity Use Cases</a></h2>
<p>A MUC implementation MUST support <a href="http://xmpp.org/extensions/xep-0030.html">Service Discovery</a>  [<a href="http://xmpp.org/extensions/xep-0045.html#nt-id340114">7</a>].</p>
<p>服务端必须实现 service discover<br></p>
<div class="indent">
<h3>6.1 <a name="disco-component" id="disco-component">Discovering Component Support for MUC</a></h3>
<p>发现服务器是否支持muc<br></p>
<p>A Jabber entity may wish to discover if a service implements the
Multi-User Chat protocol; in order to do so, it sends a service
discovery information ("disco#info") query to the component's JID:</p>
<p>一个jabber实体会去询问服务器，是否服务器端支持muc的协议。<br></p>
<p><a name="example-1" id="example-1"></a>
</p>
<p style="color: red;">例子1 ： 用户向服务器询问是否支持muc的协议</p>
<p><span style="color: red;">iq get 协议 xmlns = "http://jabber.org/protocol/disco#info"</span><br></p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq</span> from='<span style="color: red;">hag66@shakespeare.lit/pda</span>' <span style="color: red;">fuul jid</span><br>&nbsp; &nbsp; id='disco1'<br>&nbsp; &nbsp; to='chat.shakespeare.lit' <span style="color: red;">服务器</span><br>&nbsp; &nbsp; type='<span style="color: red;">get</span>'&gt;<br>&nbsp; &lt;query <span style="color: red;">xmlns='http://jabber.org/protocol/disco#info'</span>/&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>The service MUST return its identity and the features it supports:</p>
<p><span style="color: red;">服务器必须返回是否支持muc群聊</span><br></p>
<p><a name="example-2" id="example-2"></a>Example 2. Service Returns Disco Info Results</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from=<span style="color: red;">'chat.shakespeare.lit' 服务器</span><br>&nbsp; &nbsp; id='disco1'<br>&nbsp; &nbsp; to='<span style="color: red;">hag66@shakespeare.lit/pda'</span> <span style="color: red;">jid</span><br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query xmlns='<span style="color: red;">http://jabber.org/protocol/disco#info</span>'&gt;<br>&nbsp; &nbsp; &lt;identity<br>&nbsp; &nbsp; &nbsp; &nbsp; category='conference'<br>&nbsp; &nbsp; &nbsp; &nbsp; name='Macbeth Chat Service'<br>&nbsp; &nbsp; &nbsp; &nbsp; type='text'/&gt;<br>&nbsp; &nbsp; &lt;feature var='<span style="color: red;">http://jabber.org/protocol/muc</span>'/&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>Note: Because MUC is a superset of the old "groupchat 1.0"
protocol, a MUC service SHOULD NOT return a &lt;feature
var='gc-1.0'/&gt; entry in a disco#info result.</p>
</div>
<div class="indent">
<h3>6.2 <a name="disco-rooms" id="disco-rooms">Discovering Rooms</a></h3>
<p>发现房间<br></p>
<p>The service discovery items ("disco#items") protocol enables a
user to query a service for a list of associated items, which in the
case of a chat service would consist of the specific chat rooms hosted
by the service.</p>
<p><a name="example-3" id="example-3"></a><br></p>
<p><br></p>
<p>Example 3. User Queries Chat Service for Rooms</p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq </span>from='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; id='disco2'<br>&nbsp; &nbsp; to='<span style="color: red;">chat.shakespeare.lit' server</span><br>&nbsp; &nbsp; type='<span style="color: red;">get</span>'&gt;<br>&nbsp; &lt;query <span style="color: red;">xmlns='http://jabber.org/protocol/disco#items</span>'/&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>The service SHOULD return a full list of the rooms it hosts.</p>
<p><a name="example-4" id="example-4"></a>Example 4. Service Returns Disco Item Results</p>
<p><span style="color: red;">服务器返回disco item 的结果</span><br></p>
<div class="indent">
<pre class="prettyprint">&lt;iq from='<span style="color: red;">chat.shakespeare.lit' server</span><br>&nbsp; &nbsp; id='disco2'<br>&nbsp; &nbsp; to='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; type='<span style="color: red;">result</span>'&gt;<br>&nbsp; &lt;query xmlns='http://jabber.org/protocol/disco#items'&gt; <br>&nbsp; &nbsp; &lt;item jid='heath@chat.shakespeare.lit'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name='A Lonely Heath'/&gt;<br>&nbsp; &nbsp; &lt;item jid='darkcave@chat.shakespeare.lit'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name='A Dark Cave'/&gt;<br>&nbsp; &nbsp; &lt;item jid='forres@chat.shakespeare.lit'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name='The Palace'/&gt;<br>&nbsp; &nbsp; &lt;item jid='inverness@chat.shakespeare.lit'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name='Macbeth&amp;apos;s Castle'/&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>If the full list of rooms is large (see XEP-0030
for details), the service MAY return only a partial list of rooms. If
it does so, it SHOULD include a &lt;set/&gt; element (as defined in <a href="http://xmpp.org/extensions/xep-0059.html">Result Set Management</a>  [<a href="http://xmpp.org/extensions/xep-0045.html#nt-id340213">8</a>]) to indicate that the list not the full result set.</p>
<p><span style="color: red;">如果全部房间列表太长，服务器可以返回一部分房间列表。如果这样做了，服务器返回的内容应该包含一个set节点，代表返回的列表不是全部列表</span><br></p>
<p><a name="example-5" id="example-5"></a>Example 5. Service Returns Limited List of Disco Item Results</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from='<span style="color: red;">rooms.shakespeare.lit' server</span><br>&nbsp; &nbsp; id='disco-rsm-1'<br>&nbsp; &nbsp; to='<span style="color: red;">hag66@shakespeare.lit/pda'jid</span><br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query xmlns='http://jabber.org/protocol/disco#items'&gt;<br>&nbsp; &nbsp; &lt;item jid='alls-well-that-ends-well@rooms.shakespeare.lit'/&gt; <span style="color: red;">itmes</span><br>&nbsp; &nbsp; &lt;item jid='as-you-like-it@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='cleopatra@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='comedy-of-errors@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='coriolanus@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='cymbeline@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='hamlet@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='henry-the-fourth-one@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='henry-the-fourth-two@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;item jid='henry-the-fifth@rooms.shakespeare.lit'/&gt;<br>&nbsp; &nbsp; &lt;set xmlns='http://jabber.org/protocol/rsm'&gt;<br>&nbsp; &nbsp; &nbsp; &lt;first index='0'&gt;alls-well-that-ends-well@rooms.shakespeare.lit&lt;/first&gt;<br>&nbsp; &nbsp; &nbsp; &lt;last&gt;henry-the-fifth@rooms.shakespeare.lit&lt;/last&gt;<br>&nbsp; &nbsp; &nbsp; &lt;count&gt;37&lt;/count&gt;<br>&nbsp; &nbsp; &lt;/set&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
</div>
<div class="indent">
<h3>6.3 <a name="disco-roominfo" id="disco-roominfo">Querying for Room Information</a></h3>
<p>查询房间消息<br></p>
<p>Using the disco#info protocol, a user may also query a specific
chat room for more detailed information about the room. A user SHOULD do
so before entering a room in order to determine the privacy and
security profile of the room configuration (see the <a href="http://xmpp.org/extensions/xep-0045.html#security">Security Considerations</a> for details).</p>
<p><br></p>
<p>用 disco#info 协议，用户也可以查询一个指定的房间的信息，一个用户应该在进入一个房间之前来确定这个房间的隐私和安全配置
<br></p>
<p><br></p>
<p><a name="example-6" id="example-6"></a>Example 6. User Queries for Information about a Specific Chat Room</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; id='disco3'<br>&nbsp; &nbsp; to='<span style="color: red;">darkcave@chat.shakespeare.lit' roomid</span><br>&nbsp; &nbsp; type='<span style="color: red;">get</span>'&gt;<br>&nbsp; &lt;query xmlns='<span style="color: red;">http://jabber.org/protocol/disco#info</span>'/&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>The room MUST return its identity and SHOULD return the features it supports:</p>
<p><span style="color: red;">房间必须返回他的属性</span><br></p>
<p><a name="example-7" id="example-7"></a>Example 7. Room Returns Disco Info Results</p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq </span>from='<span style="color: red;">darkcave@chat.shakespeare.lit' roomid</span><br>&nbsp; &nbsp; id='disco3'<br>&nbsp; &nbsp; to='hag66@shakespeare.lit/pda' jid<br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query xmlns='<span style="color: red;">http://jabber.org/protocol/disco#info'&gt;</span><br>&nbsp; &nbsp; &lt;identity<br>&nbsp; &nbsp; &nbsp; &nbsp; category='conference'<br>&nbsp; &nbsp; &nbsp; &nbsp; name='A Dark Cave'<br>&nbsp; &nbsp; &nbsp; &nbsp; type='text'/&gt;<br>&nbsp; &nbsp; &lt;feature var='http://jabber.org/protocol/muc'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_passwordprotected'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_hidden'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_temporary'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_open'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_unmoderated'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_nonanonymous'/&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>Note: Because MUC is a superset of the old "groupchat 1.0"
protocol, a MUC room SHOULD NOT return a &lt;feature var='gc-1.0'/&gt;
entry in a disco#info result. The room SHOULD return the
materially-relevant features it supports, such as password protection
and room moderation (these are listed fully in the feature registry
maintained by the XMPP Registrar; see also the <a href="http://xmpp.org/extensions/xep-0045.html#registrar">XMPP Registrar</a> section of this document).</p>
<p>应该返回一些有用的支持特征。 比如是否是密码房间，是否是moderation房间等。<br></p>
<p><br></p>
<p>A chatroom MAY return more detailed information in its disco#info response using <a href="http://xmpp.org/extensions/xep-0128.html">Service Discovery Extensions</a>  [<a href="http://xmpp.org/extensions/xep-0045.html#nt-id340307">9</a>],
identified by inclusion of a hidden FORM_TYPE field whose value is
"http://jabber.org/protocol/muc#roominfo". Such information might
include a more verbose description of the room, the current room
subject, and the current number of occupants in the room:</p>
<p>一个聊天室或许会返回一些扩展信息，用muc#roominfo这个扩展的xmlns,包含更多的房间的信息，例如房间的用户的信息。</p>
<p><br></p>
<p><a name="example-8" id="example-8"></a>Example 8. Room Returns Extended Disco Info Results</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from='darkcave@chat.shakespeare.lit'<br>&nbsp; &nbsp; id='disco3a'<br>&nbsp; &nbsp; to='hag66@shakespeare.lit/pda'<br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query xmlns='http://jabber.org/protocol/disco#info'&gt;<br>&nbsp; &nbsp; &lt;identity<br>&nbsp; &nbsp; &nbsp; &nbsp; category='conference'<br>&nbsp; &nbsp; &nbsp; &nbsp; name='A Dark Cave'<br>&nbsp; &nbsp; &nbsp; &nbsp; type='text'/&gt;<br>&nbsp; &nbsp; &lt;feature var='http://jabber.org/protocol/muc'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_passwordprotected'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_hidden'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_temporary'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_open'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_unmoderated'/&gt;<br>&nbsp; &nbsp; &lt;feature var='muc_nonanonymous'/&gt;<br>&nbsp; &nbsp; &lt;x xmlns='jabber:x:data' type='result'&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='FORM_TYPE' type='hidden'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;http://jabber.org/protocol/muc#roominfo&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_description' label='Description'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;The place for all good witches!&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_changesubject' label='Whether Occupants May Change the Subject'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;true&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_contactjid' label='Contact Addresses'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;crone1@shakespeare.lit&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_subject' label='Subject'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;Spells&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roomconfig_changesubject' label='Subject can be modified'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;true&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_occupants' label='Number of occupants'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;3&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_ldapgroup' label='Associated LDAP Group'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;dc=lit,dc=shakespeare,cn=witches&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_lang' label='Language of discussion'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;en&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_logs' label='URL for discussion logs'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;http://www.shakespeare.lit/chatlogs/darkcave/&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &lt;field var='muc#roominfo_pubsub' label='Associated pubsub node'&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;xmpp:pubsub.shakespeare.lit?;node=the-darkcave-node&lt;/value&gt;<br>&nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &lt;/x&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>Some extended room information may be dynamically generated
(e.g., the URL for discussion logs, which may be based on service-wide
configuration). Other information may be based on the room
configuration, which is why any field defined for the <a href="http://xmpp.org/extensions/xep-0045.html#registrar-formtype-owner">muc#roomconfig FORM_TYPE</a> can be included in the extended service discovery fields (as shown above for the muc#roomconfig_changesubject field).</p>
<p>Note: The foregoing extended service discovery fields for the
'http://jabber.org/protocol/muc#roominfo' FORM_TYPE may be supplemented
in the future via the mechanisms described in the <a href="http://xmpp.org/extensions/xep-0045.html#registrar-formtype">Field Standardization</a> section of this document.</p>
<p><br></p>
<p><br></p>
</div>
<div class="indent">
<h3>6.4 <a name="disco-roomitems" id="disco-roomitems">Querying for Room Items</a></h3>
<p>查询房间条目<br></p>
<p>A user MAY also query a specific chat room for its associated items:</p>
<p><span style="color: red;">一个用户可以询问一个特定的聊天室的一些item</span><br></p>
<p><a name="example-9" id="example-9"></a>Example 9. User Queries for Items Associated with a Specific Chat Room</p>
<p><br></p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq </span>from='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; id='disco4'<br>&nbsp; &nbsp; to='<span style="color: red;">darkcave@chat.shakespeare.lit' roomid</span><br>&nbsp; &nbsp; type='<span style="color: red;">get</span>'&gt;<br>&nbsp; &lt;query <span style="color: red;">xmlns='http://jabber.org/protocol/disco#items'/&gt;</span><br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>An implementation MAY return a list of existing occupants if that
information is publicly available, or return no list at all if this
information is kept private.</p>
<p>服务端可以返回一个房间内的occupants的信息列表。如果这个房间时public的。<br></p>
<p><a name="example-10" id="example-10"></a>Example 10. Room Returns Disco Item Results (Items are Public)</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from=<span style="color: red;">'darkcave@chat.shakespeare.lit' roomid</span><br>&nbsp; &nbsp; id='disco4'<br>&nbsp; &nbsp; to='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query <span style="color: red;">xmlns='http://jabber.org/protocol/disco#items'&gt;</span><br>&nbsp; &nbsp; &lt;item jid='<span style="color: red;">darkcave@chat.shakespeare.lit/firstwitch'/&gt; roomjid</span><br>&nbsp; &nbsp; &lt;item jid='darkcave@chat.shakespeare.lit/secondwitch'/&gt; roomjid<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>Note: These &lt;item/&gt; elements are qualified by the
disco#items namespace, not the muc namespace; this means that they
cannot possess 'affiliation' or 'role' attributes, for example.</p>
<p>item节包含在disco#items这个xmlns里面，不是muc，是因为不能有affiliation和role这些属性。比如可以返回空。<br></p>
<p><a name="example-11" id="example-11"></a>Example 11. Room Returns Empty Disco Item Results (Items are Private)</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from='<span style="color: red;">darkcave@chat.shakespeare.lit' roomid</span><br>&nbsp; &nbsp; id='disco4'<br>&nbsp; &nbsp; to='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query xmlns='http://jabber.org/protocol/disco#items'/&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
</div>
<div class="indent">
<h3>6.5 <a name="disco-occupant" id="disco-occupant">Querying a Room Occupant</a></h3>
<p><br>查询一个房间的occupant</p>
<p>If a non-occupant attempts to send a disco request to an address
of the form &lt;room@service/nick&gt;, a MUC service SHOULD return the
request to the entity and specify a &lt;bad-request/&gt; error
condition. If an occupant sends such a request, the service MAY pass it
through the intended recipient; see the <a href="http://xmpp.org/extensions/xep-0045.html#impl">Implementation Guidelines</a> section of this document for details.</p>
<span style="color: red;">non-occupant 试图发disco请求给一个room会被驳回。</span><br>
</div>
<div class="indent">
<h3>6.6 <a name="disco-client" id="disco-client">Discovering Client Support for MUC</a></h3>
<p><span style="color: red;">查询用户对muc的支持</span><br></p>
<p>A Jabber user may want to discover if one of the user's contacts
supports the Multi-User Chat protocol. This is done using Service
Discovery.</p>
<p><span style="color: red;">一个jabber用户或许想查询其他的用户是否支持muc的聊天协议</span><br></p>
<p><a name="example-12" id="example-12"></a>Example 12. User Queries Contact Regarding MUC Support</p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq </span>from=<span style="color: red;">'hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; id='disco5'<br>&nbsp; &nbsp; to='<span style="color: red;">wiccarocks@shakespeare.lit/laptop' jid</span><br>&nbsp; &nbsp; type='<span style="color: red;">get</span>'&gt;<br>&nbsp; &lt;query <span style="color: red;">xmlns='http://jabber.org/protocol/disco#info'/&gt;</span><br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>The client SHOULD return its identity and the features it supports:</p>
<p><span style="color: red;">客户端应该返回其是否支持群聊协议</span><br></p>
<p><a name="example-13" id="example-13"></a>Example 13. Contact Returns Disco Info Results</p>
<div class="indent">
<pre class="prettyprint">&lt;iq from='wiccarocks@shakespeare.lit/laptop'<br>&nbsp; &nbsp; id='disco5'<br>&nbsp; &nbsp; to='hag66@shakespeare.lit/pda'<br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query xmlns='http://jabber.org/protocol/disco#info'&gt;<br>&nbsp; &nbsp; &lt;identity<br>&nbsp; &nbsp; &nbsp; &nbsp; category='client'<br>&nbsp; &nbsp; &nbsp; &nbsp; type='pc'/&gt;<br>&nbsp; &nbsp; ...<br>&nbsp; &nbsp; &lt;feature var='http://jabber.org/protocol/muc'/&gt;<br>&nbsp; &nbsp; ...<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>A user may also query a contact regarding which rooms the contact
is in. This is done by querying the contact's full JID
(&lt;user@host/resource&gt;) while specifying the well-known Service
Discovery node 'http://jabber.org/protocol/muc#rooms':</p>
<p><span style="color: red;">一个用户也可能想知道另外一个用户都在那些房间。包含muc#rooms</span><br></p>
<p><a name="example-14" id="example-14"></a>Example 14. User Queries Contact for Current Rooms</p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq </span>from='<span style="color: red;">hag66@shakespeare.lit/pda' jid</span><br>&nbsp; &nbsp; id='rooms1'<br>&nbsp; &nbsp; to='<span style="color: red;">wiccarocks@shakespeare.lit/laptop' jid</span><br>&nbsp; &nbsp; type='<span style="color: red;">get</span>'&gt;<br>&nbsp; &lt;query<span style="color: red;"> xmlns='http://jabber.org/protocol/disco#items'</span><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: red;">node='http://jabber.org/protocol/muc#rooms'/&gt;</span><br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p><a name="example-15" id="example-15"></a>Example 15. Contact Returns Room Query Results</p>
<div class="indent">
<pre class="prettyprint">&lt;<span style="color: red;">iq </span>from='wiccarocks@shakespeare.lit/laptop' jid<br>&nbsp; &nbsp; id='rooms1'<br>&nbsp; &nbsp; to='hag66@shakespeare.lit/pda' jid<br>&nbsp; &nbsp; type='result'&gt;<br>&nbsp; &lt;query <span style="color: red;">xmlns='http://jabber.org/protocol/disco#items'</span><br>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: red;">&nbsp;node='http://jabber.org/protocol/muc#rooms'&gt;</span><br>&nbsp; &nbsp;<span style="color: red;"> &lt;item jid='darkcave@chat.shakespeare.lit'/&gt; item</span><br>&nbsp; &nbsp; &lt;item jid='characters@conference.shakespeare.lit'/&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/iq&gt;<br>&nbsp; &nbsp; </pre>
</div>
<p>Optionally, the contact MAY include its roomnick as the value of the 'name' attribute:</p>
<p><span style="color: red;">也可以携带用户昵称返回</span>。<br></p>
<div class="indent">
<pre class="prettyprint">&nbsp; &nbsp; ...<br>&nbsp; &nbsp; &lt;item jid='darkcave@chat.shakespeare.lit'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: red;">name='secondwitch'</span>/&gt;<br>&nbsp; &nbsp; ...<br>&nbsp; &nbsp; </pre>
</div>
</div>
<br> <img src ="http://www.cppblog.com/MemoryGarden/aggbug/134865.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MemoryGarden/" target="_blank">memorygarden</a> 2010-11-28 00:56 <a href="http://www.cppblog.com/MemoryGarden/archive/2010/11/28/134865.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>xmpp muc 群聊协议 2</title><link>http://www.cppblog.com/MemoryGarden/archive/2010/11/27/134855.html</link><dc:creator>memorygarden</dc:creator><author>memorygarden</author><pubDate>Sat, 27 Nov 2010 14:39:00 GMT</pubDate><guid>http://www.cppblog.com/MemoryGarden/archive/2010/11/27/134855.html</guid><wfw:comment>http://www.cppblog.com/MemoryGarden/comments/134855.html</wfw:comment><comments>http://www.cppblog.com/MemoryGarden/archive/2010/11/27/134855.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MemoryGarden/comments/commentRss/134855.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MemoryGarden/services/trackbacks/134855.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: xmpp muc 群聊协议 2&nbsp;&nbsp;<a href='http://www.cppblog.com/MemoryGarden/archive/2010/11/27/134855.html'>阅读全文</a><img src ="http://www.cppblog.com/MemoryGarden/aggbug/134855.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MemoryGarden/" target="_blank">memorygarden</a> 2010-11-27 22:39 <a href="http://www.cppblog.com/MemoryGarden/archive/2010/11/27/134855.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>xmpp muc 群聊协议 1</title><link>http://www.cppblog.com/MemoryGarden/archive/2010/11/25/134680.html</link><dc:creator>memorygarden</dc:creator><author>memorygarden</author><pubDate>Thu, 25 Nov 2010 14:54:00 GMT</pubDate><guid>http://www.cppblog.com/MemoryGarden/archive/2010/11/25/134680.html</guid><wfw:comment>http://www.cppblog.com/MemoryGarden/comments/134680.html</wfw:comment><comments>http://www.cppblog.com/MemoryGarden/archive/2010/11/25/134680.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MemoryGarden/comments/commentRss/134680.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MemoryGarden/services/trackbacks/134680.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: xmpp muc 群聊协议 1&nbsp;&nbsp;<a href='http://www.cppblog.com/MemoryGarden/archive/2010/11/25/134680.html'>阅读全文</a><img src ="http://www.cppblog.com/MemoryGarden/aggbug/134680.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MemoryGarden/" target="_blank">memorygarden</a> 2010-11-25 22:54 <a href="http://www.cppblog.com/MemoryGarden/archive/2010/11/25/134680.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>