ObjXMPP  Diff

Differences From Artifact [401105b7c9]:

To Artifact [4eed8628a8]:


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
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

84
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
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






56
57





58





59
60
61
62




63

64




65




66



67


68
69




70
71
72
73
74
75
76
77







-
+

















-
-
-
-
+
-
-
-
-
-
+
-
-
-
-
-
-
+
+
-
-
-
-
-
+
-
-
-
-
-
+
+
+

-
-
-
-
+
-

-
-
-
-
+
-
-
-
-
+
-
-
-
+
-
-
+

-
-
-
-
+







@implementation XMPPRoster
- initWithConnection: (XMPPConnection*)conn
{
	self = [super init];

	@try {
		connection = [conn retain];
		groups = [[OFMutableDictionary alloc] init];
		rosterItems = [[OFMutableDictionary alloc] init];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[connection release];

	[super dealloc];
}

- (void)XMPP_addRosterItem: (XMPPRosterItem*)rosterItem
{
	if ([[rosterItem groups] count] > 0) {
		OFEnumerator *enumerator;
		OFString *group;

	return [self XMPP_updateRosterItem: rosterItem];
		enumerator = [[rosterItem groups] objectEnumerator];
		while ((group = [enumerator nextObject]) != nil) {
			OFMutableArray *rosterGroup =
			    [groups objectForKey: group];

}
			if (rosterGroup == nil) {
				rosterGroup = [OFMutableArray array];
				[groups setObject: rosterGroup
					   forKey: group];
			}


- (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem
			[rosterGroup addObject: rosterItem];
		}
	} else {
		OFMutableArray *rosterGroup = [groups objectForKey: @""];

{
		if (rosterGroup == nil) {
			rosterGroup = [OFMutableArray array];
			[groups setObject: rosterGroup
				   forKey: @""];
		}
	[rosterItems setObject: rosterItem
			forKey: [[rosterItem JID] bareJID]];
}

		[rosterGroup addObject: rosterItem];
	}
}

- (void)XMPP_deleteRosterItem: (XMPPRosterItem*)rosterItem
- (OFArray*)groups
{
	OFMutableArray *ret = [OFMutableArray array];
	OFEnumerator *enumerator;
	OFString *group;

	[rosterItems removeObjectForKey: [[rosterItem JID] bareJID]];
	enumerator = [groups keyEnumerator];
	while ((group = [enumerator nextObject]) != nil)
		[ret addObject: group];

}
	ret->isa = [OFArray class];
	return ret;
}


- (OFArray*)rosterItemsInGroup: (OFString*)group
- (OFDictionary*)rosterItems
{
	if (group == nil)
		group = @"";

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

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