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/stanza/iq.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sleekxmpp/stanza') diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py index 4a12a87e..71419bc4 100644 --- a/sleekxmpp/stanza/iq.py +++ b/sleekxmpp/stanza/iq.py @@ -11,6 +11,7 @@ from sleekxmpp.stanza.rootstanza import RootStanza from sleekxmpp.xmlstream import StanzaBase, ET from sleekxmpp.xmlstream.handler import Waiter, Callback from sleekxmpp.xmlstream.matcher import MatcherId +from sleekxmpp.exceptions import IqTimeout, IqError class Iq(RootStanza): @@ -197,7 +198,12 @@ class Iq(RootStanza): waitfor = Waiter('IqWait_%s' % self['id'], MatcherId(self['id'])) self.stream.register_handler(waitfor) StanzaBase.send(self, now=now) - return waitfor.wait(timeout) + result = waitfor.wait(timeout) + if not result: + raise IqTimeout() + if result['type'] == 'error': + raise IqError(result) + return result else: return StanzaBase.send(self, now=now) -- cgit v1.2.3 From 20d053807da1f59a2f7507fb7bb3845d31e27445 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 1 Jun 2011 15:28:33 -0700 Subject: IqTimeout now references the original sent stanza. A little extra bit of docs for IqError. --- sleekxmpp/stanza/iq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sleekxmpp/stanza') diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py index 71419bc4..f05dad17 100644 --- a/sleekxmpp/stanza/iq.py +++ b/sleekxmpp/stanza/iq.py @@ -200,7 +200,7 @@ class Iq(RootStanza): StanzaBase.send(self, now=now) result = waitfor.wait(timeout) if not result: - raise IqTimeout() + raise IqTimeout(self) if result['type'] == 'error': raise IqError(result) return result -- cgit v1.2.3 From 75f23d11301f09a29db4d0cc185dd5ffdc4a18fe Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 6 Aug 2011 00:45:18 -0700 Subject: Fix XEP-0078 using the new stream feature workflow. Honestly, this is mainly just a demo/proof of concept that we can handle dependencies and ordering issues with stream features. DON'T use XEP-0078 if you are able to use the normal SASL method, which should be the case unless you are dealing with a very old XMPP server implementation. --- sleekxmpp/stanza/stream_features.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sleekxmpp/stanza') diff --git a/sleekxmpp/stanza/stream_features.py b/sleekxmpp/stanza/stream_features.py index 5be2e55f..b800011f 100644 --- a/sleekxmpp/stanza/stream_features.py +++ b/sleekxmpp/stanza/stream_features.py @@ -19,6 +19,8 @@ class StreamFeatures(StanzaBase): namespace = 'http://etherx.jabber.org/streams' interfaces = set(('features', 'required', 'optional')) sub_interfaces = interfaces + plugin_tag_map = {} + plugin_attrib_map = {} def setup(self, xml): StanzaBase.setup(self, xml) -- cgit v1.2.3