From 188528419f39bf54c9958e29705d5c15df1ff9b6 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Sat, 12 Feb 2011 01:25:33 +0100 Subject: [PATCH] Do more checking on handling the resource bind --- src/XMPPConnection.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index 901adec..03db019 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -212,6 +212,17 @@ [self sendStanza: iq]; } +- (void)_handleResourceBind: (XMPPIQ*)iq +{ + OFXMLElement *bindElem = iq.children.firstObject; + if ([bindElem.name isEqual: @"bind"] && + [bindElem.namespace isEqual: NS_BIND]) { + OFXMLElement *jidElem = bindElem.children.firstObject; + of_log(@"Bound to JID: %@", [jidElem.children.firstObject + stringValue]); + } +} + - (void)_handleFeatures: (OFXMLElement*)elem { for (OFXMLElement *child in elem.children) { @@ -262,10 +273,7 @@ [elem.namespace isEqual: NS_CLIENT]) { XMPPIQ *iq = [XMPPIQ stanzaWithElement: elem]; if ([iq.ID isEqual: @"bind0"] && [iq.type isEqual: @"result"]) { - OFXMLElement *bindElem = iq.children.firstObject; - OFXMLElement *jidElem = bindElem.children.firstObject; - of_log(@"Bound to JID: %@", - [jidElem.children.firstObject stringValue]); + [self _handleResourceBind: iq]; } } }