ios - xmpp Framework - detection of changing roster list -
how can detect roster list changed, body added or removed?
i use code roster list on startup
- (bool)xmppstream:(xmppstream *)sender didreceiveiq:(xmppiq *)iq { ddlogverbose(@"%@: %@ - %@", this_file, this_method, [iq elementid]); nsxmlelement *queryelement = [iq elementforname: @"query" xmlns: @"jabber:iq:roster"]; if (queryelement) { nsarray *itemelements = [queryelement elementsforname: @"item"]; //[self.cts removeallobjects]; (int i=0; i<[itemelements count]; i++) { nsstring *jid = [[[itemelements objectatindex:i] attributeforname:@"jid"] stringvalue]; [self.cts addobject:jid]; } nslog(@"\nroster id's %@",self.cts); }
1) subsequent roster changes "pushed" iq packets contains "jabber:iq:roster" payload, need track "subscription" attribute of received items , make changes model. 2) xmppframework contains xmpproster extension, job you, activate extension, see xmppframework examples.
Comments
Post a Comment