ObjXMPP  Diff

Differences From Artifact [bc5cb3a56e]:

To Artifact [0337e14b25]:


54
55
56
57
58
59
60
















61
62
63
64
65
66
67
	[_roster removeDelegate: self];
	[_delegates release];
	[_contacts release];

	[super dealloc];
}

















- (void)addDelegate: (id <XMPPContactManagerDelegate>)delegate
{
	[_delegates addDelegate: delegate];
}

- (void)removeDelegate: (id <XMPPContactManagerDelegate>)delegate
{







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







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	[_roster removeDelegate: self];
	[_delegates release];
	[_contacts release];

	[super dealloc];
}


- (void)sendSubscribedToJID: (XMPPJID*)subscriber
{
	XMPPPresence *presence = [XMPPPresence presenceWithType: @"subscribed"];
	[presence setTo: subscriber];
	[_connection sendStanza: presence];
}

- (void)sendUnsubscribedToJID: (XMPPJID*)subscriber
{
	XMPPPresence *presence =
	    [XMPPPresence presenceWithType: @"unsubscribed"];
	[presence setTo: subscriber];
	[_connection sendStanza: presence];
}

- (void)addDelegate: (id <XMPPContactManagerDelegate>)delegate
{
	[_delegates addDelegate: delegate];
}

- (void)removeDelegate: (id <XMPPContactManagerDelegate>)delegate
{
141
142
143
144
145
146
147

148

149








150


151
152
153
154
155
156
157
158
159
160
161




162
163
164
165
166
167

168
169
170
171
172
173
174
		[contact XMPP_setRosterItem: rosterItem];
	}
}

-   (void)connection: (XMPPConnection*)connection
  didReceivePresence: (XMPPPresence*)presence
{

	XMPPJID *JID = [presence from];

	XMPPContact *contact = [_contacts objectForKey: [JID bareJID]];











	if (contact == nil)
		return;

	// We only care for available and unavailable here, not subscriptions
	if ([[presence type] isEqual: @"available"]) {
		[contact XMPP_setPresence: presence
				 resource: [JID resource]];
		[_delegates broadcastSelector: @selector(contact:
						   didSendPresence:)
				   withObject: contact
				   withObject: presence];




	} else if ([[presence type] isEqual: @"unavailable"]) {
		[contact XMPP_removePresenceForResource: [JID resource]];
		[_delegates broadcastSelector: @selector(contact:
						   didSendPresence:)
				   withObject: contact
				   withObject: presence];

	}
}

-  (void)connection: (XMPPConnection*)connection
  didReceiveMessage: (XMPPMessage*)message
{
	XMPPJID *JID = [message from];







>

>
|
>
>
>
>
>
>
>
>
|
>
>



|
|






>
>
>
>
|





>







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		[contact XMPP_setRosterItem: rosterItem];
	}
}

-   (void)connection: (XMPPConnection*)connection
  didReceivePresence: (XMPPPresence*)presence
{
	XMPPContact *contact;
	XMPPJID *JID = [presence from];
	OFString *type = [presence type];

	/* Subscription request */
	if ([type isEqual: @"subscribe"]) {
		of_log(@"ObjXMPP: received subscription request");
		[_delegates broadcastSelector: @selector(contactManager:
						 didReceiveSubscriptionRequest:)
				   withObject: self
				   withObject: presence];
		return;
	}

	contact = [_contacts objectForKey: [JID bareJID]];
	if (contact == nil)
		return;

	/* Available presence */
	if ([type isEqual: @"available"]) {
		[contact XMPP_setPresence: presence
				 resource: [JID resource]];
		[_delegates broadcastSelector: @selector(contact:
						   didSendPresence:)
				   withObject: contact
				   withObject: presence];
		return;
	}

	/* Unavailable presence */
	if ([type isEqual: @"unavailable"]) {
		[contact XMPP_removePresenceForResource: [JID resource]];
		[_delegates broadcastSelector: @selector(contact:
						   didSendPresence:)
				   withObject: contact
				   withObject: presence];
		return;
	}
}

-  (void)connection: (XMPPConnection*)connection
  didReceiveMessage: (XMPPMessage*)message
{
	XMPPJID *JID = [message from];