Destroy an xmppRoom #323

Open
grisleyb opened this Issue Mar 6, 2014 · 2 comments

Comments

Projects
None yet
3 participants

grisleyb commented Mar 6, 2014

Whenever I or someone enter the chat room I get their presence like this:

/*
presence xmlns="jabber:client" to="abc@xyz.com/ceed2a2d" from="test1@sample.xyz.com/abc">

x xmlns="http://jabber.org/protocol/muc#user">
item jid="abc@xyz.com/ceed2a2d" affiliation="owner" role="moderator"/>
/x>
</presence
*/

On the basis of this I can check whether the user is an owner or not. In case of owner, I can provide a destory/delete room button.

Is there an y other way to get list of owners for a chat room?

Hi grisleyb,
Please read more here ahttp://xmpp.org/extensions/xep-0045.html, I think that you just implement extension 0045 to do this. XMPP Framework's xep 0045 provide all methods and delegates for controll MUC's member, configuration, permission, role, presence....etc.
Let's use it for leave / destroy room.
Regards,

jonasman commented Mar 7, 2014

there is a way but not fully in the XMPPFramework, you need to ask for the affiliations list.in xmppframework ou can fetch only members: - (void)fetchMembersList
if you need also owners :

  • (void)fetchOwnersList
    {
    dispatch_block_t block = ^{ @autoreleasepool {

    // <iq type='get'
    //       id='mod3'
    //       to='coven@chat.shakespeare.lit'>
    //   <query xmlns='http://jabber.org/protocol/muc#admin'>
    //     <item affiliation='owner'/>
    //   </query>
    // </iq>
    
    NSString *fetchID = [xmppStream generateUUID];
    
    NSXMLElement *item = [NSXMLElement elementWithName:@"item"];
    [item addAttributeWithName:@"affiliation" stringValue:@"owner"];
    
    NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:XMPPMUCAdminNamespace];
    [query addChild:item];
    
    XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:roomJID elementID:fetchID child:query];
    
    [xmppStream sendElement:iq];
    
    [responseTracker addID:fetchID
                    target:self
                  selector:@selector(handleFetchOwnersListResponse:withInfo:)
                   timeout:60.0];
    

    }};

    if (dispatch_get_specific(moduleQueueTag))
    block();
    else
    dispatch_async(moduleQueue, block);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment