From 8aa4396e4490a964e3e1b1a5e6f555e97c16fd3d Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 31 May 2011 12:48:43 -0700 Subject: Begin experimental use of exceptions. Provides IqTimeout and IqError which are raised when an Iq response does not arrive in time, or it arrives with type='error'. --- sleekxmpp/clientxmpp.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sleekxmpp/clientxmpp.py') diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py index fb5b2087..77710541 100644 --- a/sleekxmpp/clientxmpp.py +++ b/sleekxmpp/clientxmpp.py @@ -231,8 +231,8 @@ class ClientXMPP(BaseXMPP): 'subscription': subscription, 'groups': groups}} response = iq.send(block, timeout, callback) - if response in [False, None] or not isinstance(response, Iq): - return response + if response is None: + return None return response['type'] == 'result' def del_roster_item(self, jid): @@ -265,12 +265,7 @@ class ClientXMPP(BaseXMPP): iq.enable('roster') response = iq.send(block, timeout, callback) - if response == False: - self.event('roster_timeout') - - if response in [False, None] or not isinstance(response, Iq): - return response - else: + if callback is None: return self._handle_roster(response, request=True) def _handle_stream_features(self, features): -- cgit v1.2.3