Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

examples/attach: more robust check for a successful bind

<bind> is not necessarily the first child element of <success> (it isn't
in the XML returned from Prosody 0.8).  Therefore, to robustly check if
a bind succeeded, we must check *all* the children of <success> for a
<bind> element.
commit 57c226d656e8467390bea8db9f3539f3c8998a3d 1 parent db26a80
@AGWA AGWA authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 examples/attach/boshclient.py
View
8 examples/attach/boshclient.py
@@ -110,7 +110,13 @@ def startSessionAndAuth(self, hold='1', wait='70'):
if elems[0].name == 'success':
retb, elems = self.sendBody(self.buildBody())
- if elems[0].firstChildElement().name == 'bind':
+ has_bind = False
+ for child in elems[0].children:
+ if child.name == 'bind':
+ has_bind = True
+ break
+
+ if has_bind:
iq = domish.Element(('jabber:client', 'iq'))
iq['type'] = 'set'
iq.addUniqueId()
Please sign in to comment.
Something went wrong with that request. Please try again.