简体   繁体   中英

XMPP muc room left once user offline iOS

I am creating room with Xmmp open fire ,first time its working fine and if group admin go to offline then all member left room ,when come to online not join the room . how to rejoin the room ? !

This is how XMPP Multi-User Chat works. Multi-User Chat specification is presence-based. When you are offline, you are not an occupant of the room.

After creating room set your XMPP Room persistent using below code...

-(void)xmppRoomDidJoin:(XMPPRoom *)sender {
    NSLog("I did join.");
    [sender fetchConfigurationForm];
}

-(void)xmppRoom:(XMPPRoom *)sender didFetchConfigurationForm:(NSXMLElement *)configForm {

    NSXMLElement *newConfig = [configForm copy];

    NSArray *fields = [newConfig elementsForName:@"field"];

    for (NSXMLElement *field in fields) {

         NSString *var = [field attributeStringValueForName:@"var"];
         // Make Room Persistent

        if ([var isEqualToString:@"muc#roomconfig_persistentroom"]) {

        [field removeChildAtIndex:0];
        [field addChild:[NSXMLElement elementWithName:@"value" stringValue:@"1"]];

        }
   }

   [sender configureRoomUsingOptions:newConfig];

}

that time if room owner is offline that time XMPP Room is exist with all member

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM