ObjXMPP  Diff

Differences From Artifact [1b284eeb7a]:

To Artifact [3969663589]:


226
227
228
229
230
231
232
233

234
235
236
237
238
239
240
226
227
228
229
230
231
232

233
234
235
236
237
238
239
240







-
+







	return [[password copy] autorelease];
}

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	XMPPSRVEntry *candidate = nil;
	XMPPSRVLookup *SRVLookup;
	XMPPSRVLookup *SRVLookup = nil;
	OFEnumerator *enumerator;
	OFString *domainToASCII;
	char *cDomainToASCII;
	Idna_rc rc;

	if (server)
		[sock connectToHost: server
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
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
290
291







+
-
-
+
+
+
+
+
+


-
-
+
+
-
-
-
-












-
+
+
+
+







		@try {
			domainToASCII = [OFString
			    stringWithCString: cDomainToASCII];
		} @finally {
			free(cDomainToASCII);
		}

		@try {
		SRVLookup = [XMPPSRVLookup
		    lookupWithDomain: domainToASCII];
			SRVLookup = [XMPPSRVLookup
			    lookupWithDomain: domainToASCII];
		} @catch (id e) {
			[e release];
		}

		enumerator = [SRVLookup objectEnumerator];

		// If there are no SRV records connect via A/AAAA record
		if ((candidate = [enumerator nextObject]) == nil)
		/* Iterate over SRV records, if any */
		if ((candidate = [enumerator nextObject]) != nil) {
			[sock connectToHost: domainToASCII
				       port: port];
		// Iterate over SRV records
		else {
			do {
				@try {
					[sock connectToHost: [candidate target]
						       port: [candidate port]];
					break;
				} @catch (OFAddressTranslationFailedException
				    *e) {
					[e release];
				} @catch (OFConnectionFailedException *e) {
					[e release];
				}
			} while ((candidate = [enumerator nextObject]) != nil);
		}
		} else
			/* No SRV records -> fall back to A / AAAA record */
			[sock connectToHost: domainToASCII
				       port: port];
	}

	[self XMPP_startStream];

	[pool release];
}