560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
|
[_delegates broadcastSelector: @selector(connection:didSendElement:)
withObject: self
withObject: element];
[_socket writeString: [element XMLString]];
}
- (void)sendIQ: (XMPPIQ*)iq
callbackTarget: (id)target
selector: (SEL)selector
{
OFAutoreleasePool *pool;
XMPPCallback *callback;
if (![iq ID])
[iq setID: [self generateStanzaID]];
pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithTarget: target
selector: selector];
[_callbacks setObject: callback
forKey: [iq ID]];
[pool release];
[self sendStanza: iq];
}
#ifdef OF_HAVE_BLOCKS
- (void)sendIQ: (XMPPIQ*)iq
callbackBlock: (xmpp_callback_block_t)block
{
OFAutoreleasePool *pool;
XMPPCallback *callback;
if (![iq ID])
[iq setID: [self generateStanzaID]];
pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithBlock: block];
[_callbacks setObject: callback
forKey: [iq ID]];
[pool release];
[self sendStanza: iq];
}
#endif
- (OFString*)generateStanzaID
{
return [OFString stringWithFormat: @"objxmpp_%u", _lastID++];
}
|
|
|
|
|
|
|
|
|
|
|
|
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
|
[_delegates broadcastSelector: @selector(connection:didSendElement:)
withObject: self
withObject: element];
[_socket writeString: [element XMLString]];
}
- (void)sendIQ: (XMPPIQ*)IQ
callbackTarget: (id)target
selector: (SEL)selector
{
OFAutoreleasePool *pool;
XMPPCallback *callback;
if (![IQ ID])
[IQ setID: [self generateStanzaID]];
pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithTarget: target
selector: selector];
[_callbacks setObject: callback
forKey: [IQ ID]];
[pool release];
[self sendStanza: IQ];
}
#ifdef OF_HAVE_BLOCKS
- (void)sendIQ: (XMPPIQ*)IQ
callbackBlock: (xmpp_callback_block_t)block
{
OFAutoreleasePool *pool;
XMPPCallback *callback;
if (![IQ ID])
[IQ setID: [self generateStanzaID]];
pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithBlock: block];
[_callbacks setObject: callback
forKey: [IQ ID]];
[pool release];
[self sendStanza: IQ];
}
#endif
- (OFString*)generateStanzaID
{
return [OFString stringWithFormat: @"objxmpp_%u", _lastID++];
}
|