summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0045.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2011-08-18 00:35:37 -0700
committerNathan Fritz <fritzy@netflint.net>2011-08-18 00:35:37 -0700
commit4ea22ff69bac4b619b1eeb918c67a209f6e953ee (patch)
treecc4a245ea03429d59b192cb3f79b3bee95343ba8 /sleekxmpp/plugins/xep_0045.py
parent3853898ab36fa1a74b5d9d5ea3070c3e8e1bc0f2 (diff)
parent7d8aa4157bc7a602243996a45268b172629a6ae3 (diff)
downloadslixmpp-4ea22ff69bac4b619b1eeb918c67a209f6e953ee.tar.gz
slixmpp-4ea22ff69bac4b619b1eeb918c67a209f6e953ee.tar.bz2
slixmpp-4ea22ff69bac4b619b1eeb918c67a209f6e953ee.tar.xz
slixmpp-4ea22ff69bac4b619b1eeb918c67a209f6e953ee.zip
Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0045.py')
-rw-r--r--sleekxmpp/plugins/xep_0045.py42
1 files changed, 31 insertions, 11 deletions
diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py
index 364fbbd9..338ed154 100644
--- a/sleekxmpp/plugins/xep_0045.py
+++ b/sleekxmpp/plugins/xep_0045.py
@@ -188,8 +188,12 @@ class xep_0045(base.base_plugin):
iq['from'] = ifrom
query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
iq.append(query)
- result = iq.send()
- if result['type'] == 'error':
+ # For now, swallow errors to preserve existing API
+ try:
+ result = iq.send()
+ except IqError:
+ return False
+ except IqTimeout:
return False
xform = result.xml.find('{http://jabber.org/protocol/muc#owner}query/{jabber:x:data}x')
if xform is None: return False
@@ -209,8 +213,12 @@ class xep_0045(base.base_plugin):
form = form.getXML('submit')
query.append(form)
iq.append(query)
- result = iq.send()
- if result['type'] == 'error':
+ # For now, swallow errors to preserve existing API
+ try:
+ result = iq.send()
+ except IqError:
+ return False
+ except IqTimeout:
return False
return True
@@ -254,8 +262,12 @@ class xep_0045(base.base_plugin):
destroy.append(xreason)
query.append(destroy)
iq.append(query)
- r = iq.send()
- if r is False or r['type'] == 'error':
+ # For now, swallow errors to preserve existing API
+ try:
+ r = iq.send()
+ except IqError:
+ return False
+ except IqTimeout:
return False
return True
@@ -271,9 +283,13 @@ class xep_0045(base.base_plugin):
query.append(item)
iq = self.xmpp.makeIqSet(query)
iq['to'] = room
- result = iq.send()
- if result is False or result['type'] != 'result':
- raise ValueError
+ # For now, swallow errors to preserve existing API
+ try:
+ result = iq.send()
+ except IqError:
+ return False
+ except IqTimeout:
+ return False
return True
def invite(self, room, jid, reason='', mfrom=''):
@@ -303,8 +319,12 @@ class xep_0045(base.base_plugin):
iq = self.xmpp.makeIqGet('http://jabber.org/protocol/muc#owner')
iq['to'] = room
iq['from'] = ifrom
- result = iq.send()
- if result is None or result['type'] != 'result':
+ # For now, swallow errors to preserve existing API
+ try:
+ result = iq.send()
+ except IqError:
+ raise ValueError
+ except IqTimeout:
raise ValueError
form = result.xml.find('{http://jabber.org/protocol/muc#owner}query/{jabber:x:data}x')
if form is None: