ObjXMPP  Diff

Differences From Artifact [9764686bc1]:

To Artifact [ca133d05bd]:


24
25
26
27
28
29
30
31
32


33
34
35
36
37

38
39

40
41
42
43
44
45
46
24
25
26
27
28
29
30


31
32
33
34
35
36

37
38

39
40
41
42
43
44
45
46







-
-
+
+




-
+

-
+







#import "XMPPContactManager.h"
#import "XMPPJID.h"
#import "XMPPMulticastDelegate.h"
#import "XMPPPresence.h"
#import "XMPPRosterItem.h"

@implementation XMPPContactManager
- initWithConnection: (XMPPConnection*)connection_
	      roster: (XMPPRoster*)roster_
- initWithConnection: (XMPPConnection*)connection
	      roster: (XMPPRoster*)roster
{
	self = [super init];

	@try {
		_connection = connection_;
		_connection = connection;
		[_connection addDelegate: self];
		_roster = roster_;
		_roster = roster;
		[_roster addDelegate: self];
		_contacts = [[OFMutableDictionary alloc] init];
		_delegates = [[XMPPMulticastDelegate alloc] init];
	} @catch (id e) {
		[self release];
		@throw e;
	}
85
86
87
88
89
90
91
92

93
94
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
85
86
87
88
89
90
91

92
93
94
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







-
+

















-
+


-
+







}

- (OFDictionary*)contacts
{
	OF_GETTER(_contacts, true)
}

- (void)rosterWasReceived: (XMPPRoster*)roster_
- (void)rosterWasReceived: (XMPPRoster*)roster
{
	OFEnumerator *contactEnumerator;
	XMPPContact *contact;
	OFDictionary *rosterItems;
	OFEnumerator *rosterItemEnumerator;
	OFString *bareJID;

	contactEnumerator = [_contacts objectEnumerator];
	while ((contact = [contactEnumerator nextObject]) != nil) {
		[_delegates broadcastSelector: @selector(contactManager:
						   didRemoveContact:)
				   withObject: self
				   withObject: contact];
	}
	[_contacts release];

	_contacts = [[OFMutableDictionary alloc] init];
	rosterItems = [roster_ rosterItems];
	rosterItems = [roster rosterItems];
	rosterItemEnumerator = [rosterItems keyEnumerator];
	while ((bareJID = [rosterItemEnumerator nextObject]) != nil) {
		contact = [[XMPPContact new] autorelease];
		contact = [[[XMPPContact alloc] init] autorelease];
		[contact XMPP_setRosterItem:
		    [rosterItems objectForKey: bareJID]];
		[_contacts setObject: contact
			      forKey: bareJID];
		[_delegates broadcastSelector: @selector(contactManager:
						   didAddContact:)
				   withObject: self
137
138
139
140
141
142
143
144

145
146
147
148
149
150
151
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151







-
+







					   withObject: self
					   withObject: contact];
		[_contacts removeObjectForKey: bareJID];
		return;
	}

	if (contact == nil) {
		contact = [[XMPPContact new] autorelease];
		contact = [[[XMPPContact alloc] init] autorelease];
		[contact XMPP_setRosterItem: rosterItem];
		[_contacts setObject: contact
			     forKey: bareJID];
		[_delegates broadcastSelector: @selector(contactManager:
						   didAddContact:)
				   withObject: self
				   withObject: contact];