ObjXMPP  Check-in [5deb46d926]

Overview
Comment:Add -[XMPPRoster deleteRosterItem:] and -[XMPPRosterItem copy].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5deb46d926d1c3c00451be5978fd9aabbed317673601dc41296cd0ba493537f3
User & Date: js on 2011-03-28 16:15:48
Other Links: manifest | tags
Context
2011-03-28
20:43
Use ObjOpenSSL instead of ObjGnuTLS. check-in: 50331e7266 user: js tags: trunk
16:15
Add -[XMPPRoster deleteRosterItem:] and -[XMPPRosterItem copy]. check-in: 5deb46d926 user: js tags: trunk
15:30
Move namespace definitions and add -[XMPPRoster addRosterItem:]. check-in: fe2b73b43b user: js tags: trunk
Changes

Modified src/XMPPRoster.h from [30e1f25f90] to [00bb9602be].

31
32
33
34
35
36
37


38
	OFMutableDictionary *groups;
}

- initWithConnection: (XMPPConnection*)conn;
- (OFArray*)groups;
- (OFArray*)rosterItemsInGroup: (OFString*)group;
- (void)addRosterItem: (XMPPRosterItem*)rosterItem;


@end







>
>

31
32
33
34
35
36
37
38
39
40
	OFMutableDictionary *groups;
}

- initWithConnection: (XMPPConnection*)conn;
- (OFArray*)groups;
- (OFArray*)rosterItemsInGroup: (OFString*)group;
- (void)addRosterItem: (XMPPRosterItem*)rosterItem;
- (void)updateRosterItem: (XMPPRosterItem*)rosterItem;
- (void)deleteRosterItem: (XMPPRosterItem*)rosterItem;
@end

Modified src/XMPPRoster.m from [059b74f304] to [cafcc94476].

95
96
97
98
99
100
101





102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119




















120
121
122
123
124
125
		group = @"";

	return [[[groups objectForKey: group] copy] autorelease];
}

- (void)addRosterItem: (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];
	if (rosterItem.name != nil)
		[item addAttributeWithName: @"name"
			       stringValue: rosterItem.name];

	for (OFString *group in rosterItem.groups)
		[item addChild: [OFXMLElement elementWithName: @"group"
						    namespace: XMPP_NS_ROSTER
						  stringValue: group]];





















	[query addChild: item];
	[iq addChild: query];

	[connection sendStanza: iq];
}
@end







>
>
>
>
>


















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		group = @"";

	return [[[groups objectForKey: group] copy] autorelease];
}

- (void)addRosterItem: (XMPPRosterItem*)rosterItem
{
	[self updateRosterItem: rosterItem];
}

- (void)updateRosterItem: (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];
	if (rosterItem.name != nil)
		[item addAttributeWithName: @"name"
			       stringValue: rosterItem.name];

	for (OFString *group in rosterItem.groups)
		[item addChild: [OFXMLElement elementWithName: @"group"
						    namespace: XMPP_NS_ROSTER
						  stringValue: group]];

	[query addChild: item];
	[iq addChild: query];

	[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

Modified src/XMPPRosterItem.m from [ce2010eba9] to [f9f8c64e09].

25
26
27
28
29
30
31

















32
33
34
35
36
37
38
@implementation XMPPRosterItem
@synthesize JID, name, subscription, groups;

+ rosterItem
{
	return [[[self alloc] init] autorelease];
}


















- (OFString*)description
{
	return [OFString stringWithFormat: @"<XMPPRosterItem, JID=%@, name=%@, "
					   @"subscription=%@, groups=%@>",
					   JID, name, subscription, groups];
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@implementation XMPPRosterItem
@synthesize JID, name, subscription, groups;

+ rosterItem
{
	return [[[self alloc] init] autorelease];
}

- copy
{
	XMPPRosterItem *new = [[XMPPRosterItem alloc] init];

	@try {
		new->JID = [JID copy];
		new->name = [name copy];
		new->subscription = [subscription copy];
		new->groups = [groups copy];
	} @catch (id e) {
		[new release];
		@throw e;
	}

	return new;
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"<XMPPRosterItem, JID=%@, name=%@, "
					   @"subscription=%@, groups=%@>",
					   JID, name, subscription, groups];
}