ObjXMPP  Diff

Differences From Artifact [2a7d3a0187]:

To Artifact [fc587e181a]:


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

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







-
+










-
+






-
+




-
+





-
-
+
+

-
+




-
+

-
+






-
-
+
+

-
-
+
+

-
+





-
+

-
-
+
+


-
+




-
+



@implementation XMPPContact
- init
{
	self = [super init];

	@try {
		presences = [[OFMutableDictionary alloc] init];
		_presences = [[OFMutableDictionary alloc] init];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[presences release];
	[_presences release];

	[super dealloc];
}

- (XMPPRosterItem*)rosterItem
{
	OF_GETTER(rosterItem, YES);
	OF_GETTER(_rosterItem, YES);
}

- (OFDictionary*)presences
{
	OF_GETTER(presences, YES);
	OF_GETTER(_presences, YES);
}

- (void)sendMessage: (XMPPMessage*)message
	 connection: (XMPPConnection*)connection
{
	if (lockedOnJID == nil)
		[message setTo: [rosterItem JID]];
	if (_lockedOnJID == nil)
		[message setTo: [_rosterItem JID]];
	else
		[message setTo: lockedOnJID];
		[message setTo: _lockedOnJID];

	[connection sendStanza: message];
}

- (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem_
- (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem
{
	OF_SETTER(rosterItem, rosterItem_, YES, 0);
	OF_SETTER(_rosterItem, rosterItem, YES, 0);
}

- (void)XMPP_setPresence: (XMPPPresence*)presence
		resource: (OFString*)resource
{
	if (resource != nil)
		[presences setObject: presence
			      forKey: resource];
		[_presences setObject: presence
			       forKey: resource];
	else
		[presences setObject: presence
			      forKey: @""];
		[_presences setObject: presence
			       forKey: @""];

	OF_SETTER(lockedOnJID, nil, YES, 0);
	OF_SETTER(_lockedOnJID, nil, YES, 0);
}

- (void)XMPP_removePresenceForResource: (OFString*)resource
{
	if (resource != nil) {
		[presences removeObjectForKey: resource];
		[_presences removeObjectForKey: resource];
	} else {
		[presences release];
		presences = [[OFMutableDictionary alloc] init];
		[_presences release];
		_presences = [[OFMutableDictionary alloc] init];
	}

	OF_SETTER(lockedOnJID, nil, YES, 0);
	OF_SETTER(_lockedOnJID, nil, YES, 0);
}

- (void)XMPP_setLockedOnJID: (XMPPJID*)JID;
{
	OF_SETTER(lockedOnJID, JID, YES, 0);
	OF_SETTER(_lockedOnJID, JID, YES, 0);
}
@end