︙ | | | ︙ | |
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
[delegates broadcastSelector: @selector(connection:didSendElement:)
withObject: self
withObject: element];
[sock writeString: [element XMLString]];
}
- (void)sendIQ: (XMPPIQ*)iq
withCallbackObject: (id)object
selector: (SEL)selector
{
OFAutoreleasePool *pool;
XMPPCallback *callback;
if (![iq ID])
[iq setID: [self generateStanzaID]];
pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithCallbackObject: object
selector: selector];
[callbacks setObject: callback
forKey: [iq ID]];
[pool release];
[self sendStanza: iq];
}
#ifdef OF_HAVE_BLOCKS
- (void)sendIQ: (XMPPIQ*)iq
withCallbackBlock: (xmpp_callback_block_t)block;
{
OFAutoreleasePool *pool;
XMPPCallback *callback;
if (![iq ID])
[iq setID: [self generateStanzaID]];
pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithCallbackBlock: block];
[callbacks setObject: callback
forKey: [iq ID]];
[pool release];
[self sendStanza: iq];
}
#endif
|
|
|
|
|
|
|
|
|
|
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
[delegates broadcastSelector: @selector(connection:didSendElement:)
withObject: self
withObject: element];
[sock 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
|
︙ | | | ︙ | |
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
|
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_handleResourceBindForConnection:
withIQ:)];
}
- (void)XMPP_sendStreamError: (OFString*)condition
text: (OFString*)text
{
OFXMLElement *error = [OFXMLElement
elementWithName: @"error"
|
|
|
|
|
|
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
|
if (resource != nil)
[bind addChild: [OFXMLElement elementWithName: @"resource"
namespace: XMPP_NS_BIND
stringValue: resource]];
[iq addChild: bind];
[self sendIQ: iq
callbackTarget: self
selector: @selector(XMPP_handleResourceBindForConnection:
IQ:)];
}
- (void)XMPP_sendStreamError: (OFString*)condition
text: (OFString*)text
{
OFXMLElement *error = [OFXMLElement
elementWithName: @"error"
|
︙ | | | ︙ | |
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
|
stringValue: text]];
[parser setDelegate: nil];
[self sendStanza: error];
[self close];
}
- (void)XMPP_handleResourceBindForConnection: (XMPPConnection*)connection
withIQ: (XMPPIQ*)iq
{
OFXMLElement *bindElement;
OFXMLElement *jidElement;
assert([[iq type] isEqual: @"result"]);
bindElement = [iq elementForName: @"bind"
|
|
|
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
|
stringValue: text]];
[parser setDelegate: nil];
[self sendStanza: error];
[self close];
}
- (void)XMPP_handleResourceBindForConnection: (XMPPConnection*)connection
IQ: (XMPPIQ*)iq
{
OFXMLElement *bindElement;
OFXMLElement *jidElement;
assert([[iq type] isEqual: @"result"]);
bindElement = [iq elementForName: @"bind"
|
︙ | | | ︙ | |
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
|
{
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_handleSessionForConnection:withIQ:)];
}
- (void)XMPP_handleSessionForConnection: (XMPPConnection*)connection
withIQ: (XMPPIQ*)iq
{
if (![[iq type] isEqual: @"result"])
assert(0);
[delegates broadcastSelector: @selector(connection:wasBoundToJID:)
withObject: self
withObject: JID];
|
|
|
|
<
|
|
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
|
{
XMPPIQ *iq;
iq = [XMPPIQ IQWithType: @"set"
ID: [self generateStanzaID]];
[iq addChild: [OFXMLElement elementWithName: @"session"
namespace: XMPP_NS_SESSION]];
[self sendIQ: iq
callbackTarget: self
selector: @selector(XMPP_handleSessionForConnection:IQ:)];
}
- (void)XMPP_handleSessionForConnection: (XMPPConnection*)connection
IQ: (XMPPIQ*)iq
{
if (![[iq type] isEqual: @"result"])
assert(0);
[delegates broadcastSelector: @selector(connection:wasBoundToJID:)
withObject: self
withObject: JID];
|
︙ | | | ︙ | |