Join an existing XMPP MUC Room with Owner Privileges using iOS Openfire and Robbie Hanson library

穿精又带淫゛_ 提交于 2019-12-06 07:18:26

问题


I am joining an existing MUC room using the next code:

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()];

and in after the user joins the room I am trying to change his permissions to owner without using the user that created the room(the actual owners account):

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

And I get the error, that I don't know for sure if it is related:

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>

and the user is not added to the Owners list in Openfire.

Also I want to add that I set:

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

Any suggestions on how to add the user that just joined the room to the owners list? and also any ideas why I am getting the error?


回答1:


As I was unable to use the xmpp library I created functionality using PHP, so the issue is not solved but using PHP coding and DB you can go around it.



来源:https://stackoverflow.com/questions/29701372/join-an-existing-xmpp-muc-room-with-owner-privileges-using-ios-openfire-and-robb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!