ObjXMPP  Diff

Differences From Artifact [3fea282f95]:

To Artifact [edad7fe838]:


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
292
293
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
292
293
294







-
-
-
-
-
-
+
+
+
+
+







-
+

+
+







{
	char buffer[512];

	for (;;) {
		size_t length = [sock readNBytes: 512
				      intoBuffer: buffer];

		if (length < 1 && [delegate respondsToSelector:
		    @selector(connectionWasClosed:)])
			[delegate connectionWasClosed: self];

		[parser parseBuffer: buffer
			 withLength: length];
		[self parseBuffer: buffer
		       withLength: length];

		if (length < 1)
			return;
	}
}

- (void)parseBuffer: (const char*)buffer
	 withLength: (size_t)length
{
	if (length < 1 && [delegate respondsToSelector:
	    @selector(connectionWasClosed:)])
	    @selector(connectionWasClosed:)]) {
		[delegate connectionWasClosed: self];
		return;
	}

	[parser parseBuffer: buffer
		 withLength: length];

	[oldParser release];
	[oldElementBuilder release];

449
450
451
452
453
454
455













456
457
458
459
460
461
462
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476







+
+
+
+
+
+
+
+
+
+
+
+
+








	if ([[element namespace] isEqual: XMPP_NS_STARTTLS])
		[self XMPP_handleTLS: element];

	if ([[element namespace] isEqual: XMPP_NS_SASL])
		[self XMPP_handleSASL: element];
}

- (void)elementBuilder: (OFXMLElementBuilder *)builder
  didNotExpectCloseTag: (OFString *)name
	    withPrefix: (OFString *)prefix
	     namespace: (OFString *)ns
{
	if (![name isEqual: @"stream"] || ![prefix isEqual: @"stream"] ||
	    ![ns isEqual: XMPP_NS_STREAM]) {
		@throw [OFMalformedXMLException
		    exceptionWithClass: [builder class]
				parser: nil];
	}
}

- (void)XMPP_startStream
{
	/* Make sure we don't get any old events */
	[parser setDelegate: nil];
	[elementBuilder setDelegate: nil];