diff options
author | Nathan Fritz <fritzy@netflint.net> | 2009-12-11 01:29:46 +0000 |
---|---|---|
committer | Nathan Fritz <fritzy@netflint.net> | 2009-12-11 01:29:46 +0000 |
commit | 8854509ccdbc1f9ea74e1eb00f3af098f2a3b6b6 (patch) | |
tree | 0cd10d2532fe57cf49128779bbc2375875afb8b0 /sleekxmpp/stanza/iq.py | |
parent | a031dd24a6c82745b7272d98229ebc69dd5f4811 (diff) | |
download | slixmpp-8854509ccdbc1f9ea74e1eb00f3af098f2a3b6b6.tar.gz slixmpp-8854509ccdbc1f9ea74e1eb00f3af098f2a3b6b6.tar.bz2 slixmpp-8854509ccdbc1f9ea74e1eb00f3af098f2a3b6b6.tar.xz slixmpp-8854509ccdbc1f9ea74e1eb00f3af098f2a3b6b6.zip |
* started converstion to stanza objects
Diffstat (limited to 'sleekxmpp/stanza/iq.py')
-rw-r--r-- | sleekxmpp/stanza/iq.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py index eece37bd..68a429e0 100644 --- a/sleekxmpp/stanza/iq.py +++ b/sleekxmpp/stanza/iq.py @@ -1,5 +1,8 @@ from .. xmlstream.stanzabase import StanzaBase from xml.etree import cElementTree as ET +from . error import Error +from .. xmlstream.handler.waiter import Waiter +from .. xmlstream.matcher.id import MatcherId class Iq(StanzaBase): interfaces = set(('type', 'to', 'from', 'id', 'body', 'subject')) @@ -11,7 +14,6 @@ class Iq(StanzaBase): StanzaBase.__init__(self, *args, **kwargs) if self['id'] == '': self['id'] = self.stream.getId() - print("________LOADED IQ CLASS") def result(self): self['type'] = 'result' @@ -37,3 +39,19 @@ class Iq(StanzaBase): def unhandled(self): pass # returned unhandled error + + def exception(self, traceback=None): + pass + + def send(self, block=True, timeout=10): + if block: + waitfor = Waiter('IqWait_%s' % self['id'], MatcherId(self['id'])) + self.stream.registerHandler(waitfor) + StanzaBase.send(self) + return waitfor.wait(timeout) + else: + return StanzaBase.send(self) + + +Iq.plugin_attrib_map['error'] = Error +Iq.plugin_tag_map["{%s}%s" % (Error.namespace, Error.name)] = Error |