Add -[XMPPRoster deleteRosterItem:] and -[XMPPRosterItem copy].

This commit is contained in:
Jonathan Schleifer 2011-03-28 18:15:48 +02:00
parent 823ea0eb5e
commit 993d0a7596
3 changed files with 44 additions and 0 deletions

View file

@ -98,6 +98,11 @@
}
- (void)addRosterItem: (XMPPRosterItem*)rosterItem
{
[self updateRosterItem: rosterItem];
}
- (void)updateRosterItem: (XMPPRosterItem*)rosterItem
{
XMPPIQ *iq = [XMPPIQ IQWithType: @"set"
ID: [connection generateStanzaID]];
@ -122,4 +127,24 @@
[connection sendStanza: iq];
}
- (void)deleteRosterItem: (XMPPRosterItem*)rosterItem
{
XMPPIQ *iq = [XMPPIQ IQWithType: @"set"
ID: [connection generateStanzaID]];
OFXMLElement *query = [OFXMLElement elementWithName: @"query"
namespace: XMPP_NS_ROSTER];
OFXMLElement *item = [OFXMLElement elementWithName: @"item"
namespace: XMPP_NS_ROSTER];
[item addAttributeWithName: @"jid"
stringValue: rosterItem.JID.bareJID];
[item addAttributeWithName: @"subscription"
stringValue: @"remove"];
[query addChild: item];
[iq addChild: query];
[connection sendStanza: iq];
}
@end