tigase muc 协议

2,421 阅读1分钟

1. create room
(1) attain unique name for room that will be created 
<iq
    id='unique1'
    to='muc.test-d'
    type='get'>
  <unique xmlns='http://jabber.org/protocol/muc#unique'/>
</iq>
 
(2)  use the unique name from step 1 to get the form of room and set some values in the form  and send the form by iq
<iq id='create1'
    to='testroom@muc.test-d'
    type='get'>
  <query xmlns='http://jabber.org/protocol/muc#owner'/>
</iq>


 
<iq type="set" id="create1" to="test006@muc.mml">
<query xmlns="http://jabber.org/protocol/muc#owner">
<x xmlns="jabber:x:data" type="submit">
<field var="muc#roomconfig_persistentroom">
<value>1</value>
</field>
<field var='muc#roomconfig_roomname'>
    <value>test006</value>
</field>
<field var="muc#roomconfig_membersonly">
<value>1</value>
</field>
<field var="muc#roomconfig_changesubject">
<value>1</value>
</field>
</x>
</query>
</iq>
 
 (3) add members into room that is created just now
<iq id='member1'
    to='testroom1@muc.test-d'
    type='set'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
    <item affiliation='admin'
          jid='132@test-d' nick='kevin'/>
  </query>
</iq>