ObjXMPP  Diff

Differences From Artifact [330b6dadbb]:

To Artifact [60d0b36b6c]:


281
282
283
284
285
286
287













288
289
290
291
292
293
294
		}
	}

	[parser setDelegate: elementBuilder];

	[pool release];
}














- (void)elementBuilder: (OFXMLElementBuilder*)b
       didBuildElement: (OFXMLElement*)elem
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];

	[elem setDefaultNamespace: XMPP_NS_CLIENT];







>
>
>
>
>
>
>
>
>
>
>
>
>







281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
		}
	}

	[parser setDelegate: elementBuilder];

	[pool release];
}

-    (void)parser: (OFXMLParser*)p
    didEndElement: (OFString*)name
       withPrefix: (OFString*)prefix
	namespace: (OFString*)ns
       attributes: (OFArray*)attrs
{
	if (![name isEqual: @"stream"] || ![prefix isEqual: @"stream"] ||
	    ![ns isEqual: XMPP_NS_STREAM]) {
		of_log(@"Did not get expected stream end!");
		assert(0);
	}
}

- (void)elementBuilder: (OFXMLElementBuilder*)b
       didBuildElement: (OFXMLElement*)elem
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];

	[elem setDefaultNamespace: XMPP_NS_CLIENT];
346
347
348
349
350
351
352































































































353
354
355
356
357
358
359

- (void)XMPP_handleStream: (OFXMLElement*)elem
{
	if ([[elem name] isEqual: @"features"]) {
		[self XMPP_handleFeatures: elem];
		return;
	}
































































































	assert(0);
}

- (void)XMPP_handleTLS: (OFXMLElement*)elem
{
	if ([[elem name] isEqual: @"proceed"]) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467

- (void)XMPP_handleStream: (OFXMLElement*)elem
{
	if ([[elem name] isEqual: @"features"]) {
		[self XMPP_handleFeatures: elem];
		return;
	}

	if ([[elem name] isEqual: @"error"]) {
		OFString *condition, *reason;
		[parser setDelegate: self];
		[sock writeString: @"</stream:stream>"];
		[sock close];

		if ([elem elementForName: @"bad-format"
			       namespace: XMPP_NS_XMPP_STREAM])
			condition = @"bad-format";
		else if ([elem elementForName: @"bad-namespace-prefix"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"bad-namespace-prefix";
		else if ([elem elementForName: @"conflict"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"conflict";
		else if ([elem elementForName: @"connection-timeout"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"connection-timeout";
		else if ([elem elementForName: @"host-gone"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"host-gone";
		else if ([elem elementForName: @"host-unknown"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"host-unknown";
		else if ([elem elementForName: @"improper-addressing"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"improper-addressing";
		else if ([elem elementForName: @"internal-server-error"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"internal-server-error";
		else if ([elem elementForName: @"invalid-from"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"invalid-from";
		else if ([elem elementForName: @"invalid-namespace"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"invalid-namespace";
		else if ([elem elementForName: @"invalid-xml"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"invalid-xml";
		else if ([elem elementForName: @"not-authorized"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"not-authorized";
		else if ([elem elementForName: @"not-well-formed"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"not-well-formed";
		else if ([elem elementForName: @"policy-violation"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"policy-violation";
		else if ([elem elementForName: @"remote-connection-failed"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"remote-connection-failed";
		else if ([elem elementForName: @"reset"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"reset";
		else if ([elem elementForName: @"resource-constraint"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"resource-constraint";
		else if ([elem elementForName: @"restricted-xml"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"restricted-xml";
		else if ([elem elementForName: @"see-other-host"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"see-other-host";
		else if ([elem elementForName: @"system-shutdown"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"system-shutdown";
		else if ([elem elementForName: @"undefined-condition"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"undefined-condition";
		else if ([elem elementForName: @"unsupported-encoding"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"unsupported-encoding";
		else if ([elem elementForName: @"unsupported-feature"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"unsupported-feature";
		else if ([elem elementForName: @"unsupported-stanza-type"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"unsupported-stanza-type";
		else if ([elem elementForName: @"unsupported-version"
				    namespace: XMPP_NS_XMPP_STREAM])
			condition = @"unsupported-version";
		else
			condition = @"undefined";

		reason = [[elem elementForName: @"text"
				     namespace: XMPP_NS_XMPP_STREAM]
				stringValue];

		@throw [XMPPStreamErrorException newWithClass: isa
						   connection: self
						    condition: condition
						       reason: reason];
		return;
	}

	assert(0);
}

- (void)XMPP_handleTLS: (OFXMLElement*)elem
{
	if ([[elem name] isEqual: @"proceed"]) {