简体   繁体   中英

Exited group is still showing in group list xmpp

XMPPJID *servrJID = [XMPPJID jidWithString:@"conference.localhost"];
XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:servrJID];
[iq addAttributeWithName:@"from" stringValue:[[self xmppStream] myJID].full];
NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
[query addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/disco#items"];
[iq addChild:query];
[[self xmppStream] sendElement:iq];

the group remains as it was after killing the app, group rejoin automatically,

i am still getting the group name which i have left/deactivated with

 XMPPJID *roomJID = [XMPPJID jidWithString:Roomjdi];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRooms = [[XMPPRoom alloc]
                       initWithRoomStorage:roomMemoryStorage
                       jid:roomJID
                       dispatchQueue:dispatch_get_main_queue()];

[xmppRooms removeDelegate:self delegateQueue:dispatch_get_main_queue()];

[xmppRooms deactivate];
[xmppRooms leaveRoom];

have you any idea why i am getting the group name again in this?

If you deactivate the room first, it disconnect the room from stream. For that reason you can not leave room. So if you want to leave room, at first call leave room function then deactivate room.

Example:

XMPPJID *roomJID = [XMPPJID jidWithString:Roomjdi];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRooms = [[XMPPRoom alloc]
                       initWithRoomStorage:roomMemoryStorage
                       jid:roomJID
                       dispatchQueue:dispatch_get_main_queue()];

[xmppRooms removeDelegate:self delegateQueue:dispatch_get_main_queue()];

[xmppRooms leaveRoom];
[xmppRooms deactivate];

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