2014-01-08 27 views
-1

我想添加现有组中的参与者。为此,我将参与者的隶属关系作为所有者和角色作为主持人。如何将参与者添加到C#中的XMPP聊天室?

我正在测试“conference.jabber.org”。我创建房间成功,但是当我去的那间添加一些参与者提示错误

"error code=\"405\" type=\"cancel\"> not-allowed xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\" /></error>" 

请帮助。

任何帮助将不胜感激。

回答

0

您无法直接将用户添加到聊天室;你可以邀请他们,但他们必须自己明确加入。 (尽管你应该可以修改他们的隶属关系,不管他们是否在房间里,如果他们在房间里,你应该可以改变他们的角色为主持人。)

有两种方法邀请参与者。 One involves sending the invite through the chat room

<message 
    from='[email protected]/desktop' 
    id='nzd143v8' 
    to='[email protected]'> 
    <x xmlns='http://jabber.org/protocol/muc#user'> 
    <invite to='[email protected]'> 
     <reason> 
     Hey Hecate, this is the place for all good witches! 
     </reason> 
    </invite> 
    </x> 
</message> 

the other involves sending a message directly to the user you're inviting

<message 
    from='[email protected]/desktop' 
    to='[email protected]'> 
    <x xmlns='jabber:x:conference' 
    jid='[email protected]' 
    password='cauldronburn' 
    reason='Hey Hecate, this is the place for all good witches!'/> 
</message> 
+0

谢谢@Legoscia的答复。但我只想知道Wats App是如何工作的?假设,如果我创建一个组并添加一些朋友,那么它不会请求邀请。它直接将它们添加到创建的组中。 就像这样,我不想邀请我的朋友,但想直接添加它们。 请给我建议任何解决方案。 谢谢。 – Nishant

+0

我猜想客户端会自动接受邀请,或者他们的系统使用XEP-0045定义的标准MUC以外的东西。 – legoscia

+0

请告诉我一件事,**我怎样才能设置任何用户作为管理员或房间的所有者?** 你可以分享iq或xml吗? – Nishant