︙ | | | ︙ | |
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
{
[sock release];
[parser release];
[elementBuilder release];
[username release];
[password release];
[server release];
[resource release];
[JID release];
[delegate release];
[authModule release];
[bindID release];
[sessionID release];
[roster release];
|
>
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{
[sock release];
[parser release];
[elementBuilder release];
[username release];
[password release];
[server release];
[domain release];
[resource release];
[JID release];
[delegate release];
[authModule release];
[bindID release];
[sessionID release];
[roster release];
|
︙ | | | ︙ | |
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
[old release];
}
- (OFString*)server
{
return [[server copy] autorelease];
}
- (void)setPassword: (OFString*)password_
{
OFString *old = password;
char *pass;
Stringprep_rc rc;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
[old release];
}
- (OFString*)server
{
return [[server copy] autorelease];
}
- (void)setDomain: (OFString*)domain_
{
OFString *old = domain;
char *srv;
Stringprep_rc rc;
if ((rc = stringprep_profile([domain_ cString], &srv,
"Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
profile: @"Nameprep"
string: domain_];
@try {
domain = [[OFString alloc] initWithCString: srv];
} @finally {
free(srv);
}
[old release];
}
- (OFString*)domain
{
return [[domain copy] autorelease];
}
- (void)setPassword: (OFString*)password_
{
OFString *old = password;
char *pass;
Stringprep_rc rc;
|
︙ | | | ︙ | |
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
{
return [[password copy] autorelease];
}
- (void)connect
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
XMPPSRVLookup *SRVLookup = [XMPPSRVLookup lookupWithDomain: server];
OFEnumerator *enumerator = [SRVLookup objectEnumerator];
XMPPSRVEntry *candidate;
while ((candidate = [enumerator nextObject]) != nil) {
@try {
[sock connectToHost: [candidate target]
onPort: [candidate port]];
break;
} @catch (OFAddressTranslationFailedException *e) {
[e release];
} @catch (OFConnectionFailedException *e) {
[e release];
}
}
if (!candidate)
[sock connectToHost: server
onPort: port];
[self XMPP_startStream];
[pool release];
}
- (void)handleConnection
|
>
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
>
|
|
|
|
|
>
>
|
>
|
|
|
>
|
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
{
return [[password copy] autorelease];
}
- (void)connect
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
XMPPSRVEntry *candidate = nil;
XMPPSRVLookup *SRVLookup;
OFEnumerator *enumerator;
OFString *domainToASCII;
char *cDomainToASCII;
Idna_rc rc;
if (server)
[sock connectToHost: server
onPort: port];
else {
if ((rc = idna_to_ascii_8z([domain cString], &cDomainToASCII,
IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException
newWithClass: isa
connection: self
operation: @"ToASCII"
string: domain];
@try {
domainToASCII = [OFString
stringWithCString: cDomainToASCII];
} @finally {
free(cDomainToASCII);
}
@try {
SRVLookup = [XMPPSRVLookup
lookupWithDomain: domainToASCII];
enumerator = [SRVLookup objectEnumerator];
while ((candidate = [enumerator nextObject]) != nil) {
@try {
[sock connectToHost: [candidate target]
onPort: [candidate port]];
break;
} @catch (OFAddressTranslationFailedException
*e) {
[e release];
} @catch (OFConnectionFailedException *e) {
[e release];
}
}
} @catch (OFAddressTranslationFailedException *e) {
[e release];
}
if (!candidate)
[sock connectToHost: domainToASCII
onPort: port];
}
[self XMPP_startStream];
[pool release];
}
- (void)handleConnection
|
︙ | | | ︙ | |
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
of_log(@"Did not get expected stream start!");
assert(0);
}
enumerator = [attributes objectEnumerator];
while ((attribute = [enumerator nextObject]) != nil) {
if ([[attribute name] isEqual: @"from"] &&
![[attribute stringValue] isEqual: server]) {
of_log(@"Got invalid from in stream start!");
assert(0);
}
}
[parser setDelegate: elementBuilder];
}
|
|
|
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
of_log(@"Did not get expected stream start!");
assert(0);
}
enumerator = [attributes objectEnumerator];
while ((attribute = [enumerator nextObject]) != nil) {
if ([[attribute name] isEqual: @"from"] &&
![[attribute stringValue] isEqual: domain]) {
of_log(@"Got invalid from in stream start!");
assert(0);
}
}
[parser setDelegate: elementBuilder];
}
|
︙ | | | ︙ | |
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
roster = [[XMPPRoster alloc] initWithConnection: self];
[sock writeFormat: @"<?xml version='1.0'?>\n"
@"<stream:stream to='%@' "
@"xmlns='" XMPP_NS_CLIENT @"' "
@"xmlns:stream='" XMPP_NS_STREAM @"' "
@"version='1.0'>", server];
}
- (void)XMPP_handleStanza: (OFXMLElement*)element
{
if ([[element name] isEqual: @"iq"]) {
[self XMPP_handleIQ: [XMPPIQ stanzaWithElement: element]];
return;
|
|
|
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
roster = [[XMPPRoster alloc] initWithConnection: self];
[sock writeFormat: @"<?xml version='1.0'?>\n"
@"<stream:stream to='%@' "
@"xmlns='" XMPP_NS_CLIENT @"' "
@"xmlns:stream='" XMPP_NS_STREAM @"' "
@"version='1.0'>", domain];
}
- (void)XMPP_handleStanza: (OFXMLElement*)element
{
if ([[element name] isEqual: @"iq"]) {
[self XMPP_handleIQ: [XMPPIQ stanzaWithElement: element]];
return;
|
︙ | | | ︙ | |