Index: XMPPConnection.h ================================================================== --- XMPPConnection.h +++ XMPPConnection.h @@ -38,6 +38,7 @@ @property (assign) BOOL useTLS; @property (retain) id delegate; - (void)connect; - (void)handleConnection; +- (void)sendStanza: (OFXMLElement*)elem; @end Index: XMPPConnection.m ================================================================== --- XMPPConnection.m +++ XMPPConnection.m @@ -76,10 +76,15 @@ fromBuffer: buf]; [parser parseBuffer: buf withSize: len]; } } + +- (void)sendStanza: (OFXMLElement*)elem +{ + [sock writeString: [elem stringValue]]; +} - (void)parser: (OFXMLParser*)p didStartElement: (OFString*)name withPrefix: (OFString*)prefix namespace: (OFString*)ns @@ -128,20 +133,20 @@ [authTag addAttributeWithName: @"mechanism" stringValue: @"PLAIN"]; [authTag addChild: [OFXMLElement elementWithCharacters: [message stringByBase64Encoding]]]; - [sock writeString: [authTag stringValue]]; + [self sendStanza: authTag]; } - (void)_sendResourceBind { XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"bind0"]; [iq addChild: [OFXMLElement elementWithName: @"bind" namespace: NS_BIND]]; - [sock writeString: [iq stringValue]]; + [self sendStanza: iq]; } - (void)_handleFeatures: (OFXMLElement*)elem { for (OFXMLElement *child in elem.children) {