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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
-
+
+
-
+
-
+
-
+
-
+
|
}
- (void)requestRoster
{
XMPPIQ *iq;
OFXMLElement *query;
_rosterRequested = YES;
_rosterRequested = true;
iq = [XMPPIQ IQWithType: @"get"
ID: [_connection generateStanzaID]];
query = [OFXMLElement elementWithName: @"query"
namespace: XMPP_NS_ROSTER];
if ([_connection supportsRosterVersioning]) {
OFString *ver =
OFString *ver = [_dataStorage stringValueForPath: @"roster.ver"];
[_dataStorage stringValueForPath: @"roster.ver"];
if (ver == nil)
ver = @"";
[query addAttributeWithName: @"ver"
stringValue: ver];
}
[iq addChild: query];
[_connection sendIQ: iq
callbackTarget: self
selector: @selector(XMPP_handleInitialRosterForConnection:
IQ:)];
}
- (BOOL)connection: (XMPPConnection*)connection
- (bool)connection: (XMPPConnection*)connection
didReceiveIQ: (XMPPIQ*)iq
{
OFXMLElement *rosterElement;
OFXMLElement *element;
XMPPRosterItem *rosterItem;
rosterElement = [iq elementForName: @"query"
namespace: XMPP_NS_ROSTER];
if (rosterElement == nil)
return NO;
return false;
if (![[iq type] isEqual: @"set"])
return NO;
return false;
element = [rosterElement elementForName: @"item"
namespace: XMPP_NS_ROSTER];
if (element != nil) {
rosterItem = [self XMPP_rosterItemWithXMLElement: element];
|
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
-
+
|
[_dataStorage setStringValue: ver
forPath: @"roster.ver"];
[_dataStorage save];
}
[connection sendStanza: [iq resultIQ]];
return YES;
return true;
}
- (void)addRosterItem: (XMPPRosterItem*)rosterItem
{
[self updateRosterItem: rosterItem];
}
|