【问题标题】:Join an existing XMPP MUC Room with Owner Privileges using iOS Openfire and Robbie Hanson library使用 iOS Openfire 和 Robbie Hanson 库加入具有所有者权限的现有 XMPP MUC 房间
【发布时间】:2015-06-24 10:23:25
【问题描述】:

我正在使用以下代码加入现有的 MUC 房间:

XMPPRoomMemoryStorage *roomStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPJID *roomJID = [XMPPJID jidWithString:@"newRoom5@conference.administrator"];

xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomStorage
                                                       jid:roomJID
                                             dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:[self appDelegate].xmppStream];
[xmppRoom addDelegate:self
        delegateQueue:dispatch_get_main_queue()];
[xmppRoom joinRoomUsingNickname:[self appDelegate].xmppStream.myJID.user
                        history:nil
                       password:nil];
XMPPMUC * xmppMUC = [[XMPPMUC alloc] initWithDispatchQueue:dispatch_get_main_queue()];
[xmppMUC   activate:[self appDelegate].xmppStream];
[xmppMUC addDelegate:self delegateQueue:dispatch_get_main_queue()];

在用户加入房间后,我试图在不使用创建房间的用户(实际所有者帐户)的情况下将他的权限更改为所有者:

- (void)xmppRoomDidJoin:(XMPPRoom *)sender {
//    ADD USERS TO OWNERS LIST
    [xmppRoom editRoomPrivileges:@[[XMPPRoom itemWithAffiliation:@"owner" jid:[XMPPJID jidWithString:[self appDelegate].xmppStream.myJID.user]]]];
}

我得到了错误,我不确定它是否相关:

RECV: <iq xmlns="jabber:client" type="error"
          id="64BBA616-56D7-4CB1-AC07-CBEA4C37E98C" 
          from="newroom5@conference.administrator" 
          to="newuser236@administrator/26ee7a3d">
        <query xmlns="http://jabber.org/protocol/muc#admin">
          <item affiliation="member" jid="newuser236"/>
        </query>
        <error code="403" type="auth">
          <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
        </error>
      </iq>

并且该用户未添加到 Openfire 的所有者列表中。

我还想补充一下我设置的:

publicRoom : 1 
moderated : 0
membersOnly : 0 
canInvite : 1 
roomPassword : nil 
canRegister : 1 
canDiscoverJID : 1 
logEnabled : 1

关于如何将刚加入房间的用户添加到所有者列表中有任何建议吗?以及为什么我收到错误的任何想法?

【问题讨论】:

    标签: ios xmpp openfire xmppframework muc


    【解决方案1】:

    由于我无法使用 xmpp 库,因此我使用 PHP 创建了功能,因此问题没有解决,但使用 PHP 编码和 DB,您可以绕过它。

    【讨论】:

      猜你喜欢
      • 2015-06-23
      • 2012-10-18
      • 2020-11-23
      • 2015-05-17
      • 1970-01-01
      • 2017-04-21
      • 2018-10-05
      • 2016-10-25
      • 2017-01-20
      相关资源
      最近更新 更多