ObjXMPP  Diff

Differences From Artifact [93e7490cdd]:

To Artifact [677aa509d2]:


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
	    @selector(connection:didSendElement:)])
		[delegate connection: self
		      didSendElement: element];

	[sock writeString: [element XMLString]];
}

-     (void)sendIQ: (XMPPIQ*)iq
withCallbackObject: (id)object
	  selector: (SEL)selector
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	@try {
		if (![iq ID])
			[iq setID: [self generateStanzaID]];

		[callbacks setObject: [XMPPCallback
					 callbackWithCallbackObject: object
							   selector: selector]
			      forKey: [iq ID]];
	} @finally {
		[pool release];
	}

	[self sendStanza: iq];
}

#ifdef OF_HAVE_BLOCKS
-    (void)sendIQ: (XMPPIQ*)iq
withCallbackBlock: (xmpp_callback_block)callback;
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	@try {
		if (![iq ID])
			[iq setID: [self generateStanzaID]];

		[callbacks setObject: [XMPPCallback







|
|
|


















|
|







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
	    @selector(connection:didSendElement:)])
		[delegate connection: self
		      didSendElement: element];

	[sock writeString: [element XMLString]];
}

-	(void)sendIQ: (XMPPIQ*)iq
  withCallbackObject: (id)object
	    selector: (SEL)selector
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	@try {
		if (![iq ID])
			[iq setID: [self generateStanzaID]];

		[callbacks setObject: [XMPPCallback
					 callbackWithCallbackObject: object
							   selector: selector]
			      forKey: [iq ID]];
	} @finally {
		[pool release];
	}

	[self sendStanza: iq];
}

#ifdef OF_HAVE_BLOCKS
-      (void)sendIQ: (XMPPIQ*)iq
  withCallbackBlock: (xmpp_callback_block_t)callback;
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	@try {
		if (![iq ID])
			[iq setID: [self generateStanzaID]];

		[callbacks setObject: [XMPPCallback
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
	if (resource != nil)
		[bind addChild: [OFXMLElement elementWithName: @"resource"
						    namespace: XMPP_NS_BIND
						  stringValue: resource]];

	[iq addChild: bind];

	[self sendIQ: iq
  withCallbackObject: self
	    selector: @selector(XMPP_handleResourceBind:)];
}

- (void)XMPP_sendStreamError: (OFString*)condition
			text: (OFString*)text
{
	OFXMLElement *error = [OFXMLElement
	    elementWithName: @"error"







|
|
|







929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
	if (resource != nil)
		[bind addChild: [OFXMLElement elementWithName: @"resource"
						    namespace: XMPP_NS_BIND
						  stringValue: resource]];

	[iq addChild: bind];

	[self		sendIQ: iq
	    withCallbackObject: self
		      selector: @selector(XMPP_handleResourceBind:)];
}

- (void)XMPP_sendStreamError: (OFString*)condition
			text: (OFString*)text
{
	OFXMLElement *error = [OFXMLElement
	    elementWithName: @"error"
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
{
	XMPPIQ *iq;

	iq = [XMPPIQ IQWithType: @"set"
			     ID: [self generateStanzaID]];
	[iq addChild: [OFXMLElement elementWithName: @"session"
					  namespace: XMPP_NS_SESSION]];
	[self sendIQ: iq
  withCallbackObject: self
	    selector: @selector(XMPP_handleSession:)];
}

- (void)XMPP_handleSession: (XMPPIQ*)iq
{
	if (![[iq type] isEqual: @"result"])
		assert(0);








|
|
|







988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
{
	XMPPIQ *iq;

	iq = [XMPPIQ IQWithType: @"set"
			     ID: [self generateStanzaID]];
	[iq addChild: [OFXMLElement elementWithName: @"session"
					  namespace: XMPP_NS_SESSION]];
	[self		sendIQ: iq
	    withCallbackObject: self
		      selector: @selector(XMPP_handleSession:)];
}

- (void)XMPP_handleSession: (XMPPIQ*)iq
{
	if (![[iq type] isEqual: @"result"])
		assert(0);