ObjXMPP  Diff

Differences From Artifact [299be9c4c8]:

To Artifact [eaf6a2879a]:


42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59

60
61
62
63
64
65
66
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68







+











+







{
	self = [super init];

	@try {
		rosterItems = [[OFMutableDictionary alloc] init];
		connection = connection_;
		[connection addDelegate: self];
		delegates = [[XMPPMulticastDelegate alloc] init];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[connection removeDelegate: self];
	[delegates release];
	[rosterItems release];

	[super dealloc];
}

- (OFDictionary*)rosterItems
{
103
104
105
106
107
108
109
110
111
112
113




114
115
116
117
118
119
120
105
106
107
108
109
110
111




112
113
114
115
116
117
118
119
120
121
122







-
-
-
-
+
+
+
+







		rosterItem = [self XMPP_rosterItemWithXMLElement: element];

		if ([[rosterItem subscription] isEqual: @"remove"])
			[self XMPP_deleteRosterItem: rosterItem];
		else
			[self XMPP_addRosterItem: rosterItem];

		if ([delegate respondsToSelector:
		    @selector(roster:didReceiveRosterItem:)])
			[delegate         roster: self
			    didReceiveRosterItem: rosterItem];
		[delegates broadcastSelector: @selector(
						  roster:didReceiveRosterItem:)
				  withObject: self
				  withObject: rosterItem];
	}

	[connection_ sendStanza: [iq resultIQ]];

	return YES;
}

168
169
170
171
172
173
174
175

176
177

178
179
180

181
182

183
184
185
186
187
188
189
170
171
172
173
174
175
176

177
178

179
180
181

182
183

184
185
186
187
188
189
190
191







-
+

-
+


-
+

-
+








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

	[connection sendStanza: iq];
}

- (void)setDelegate: (id <XMPPRosterDelegate>)delegate_
- (void)addDelegate: (id <XMPPRosterDelegate>)delegate
{
	delegate = (id <XMPPRosterDelegate, OFObject>)delegate_;
	[delegates addDelegate: delegate];
}

- (id <XMPPRosterDelegate>)delegate
- (void)removeDelegate: (id <XMPPRosterDelegate>)delegate
{
	return delegate;
	[delegates removeDelegate: delegate];
}

- (void)XMPP_addRosterItem: (XMPPRosterItem*)rosterItem
{
	return [self XMPP_updateRosterItem: rosterItem];
}

254
255
256
257
258
259
260
261
262


263
264
265
266
267
268
269
270
271
272
273
274
275
256
257
258
259
260
261
262


263
264
265
266
267
268
269
270
271
272
273
274
275
276
277







-
-
+
+














		if ([[rosterItem subscription] isEqual: @"remove"])
			[self XMPP_deleteRosterItem: rosterItem];
		else
			[self XMPP_addRosterItem: rosterItem];
	}

	if ([delegate respondsToSelector: @selector(rosterWasReceived:)])
		[delegate rosterWasReceived: self];
	[delegates broadcastSelector: @selector(rosterWasReceived:)
			  withObject: self];
}
@end

@implementation OFObject (XMPPRosterDelegate)
- (void)rosterWasReceived: (XMPPRoster*)roster
{
}

-         (void)roster: (XMPPRoster*)roster
  didReceiveRosterItem: (XMPPRosterItem*)rosterItem
{
}
@end