summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/iq.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2010-01-05 21:56:48 +0000
committerNathan Fritz <fritzy@netflint.net>2010-01-05 21:56:48 +0000
commit093644ffbd6708121150c92359bce60408f924bb (patch)
treea7d6da57ff76a8e54b1ec3703aeffeed82f34fa1 /sleekxmpp/stanza/iq.py
parent805afa4bc1f44598d786fddc92c5129c62464227 (diff)
downloadslixmpp-093644ffbd6708121150c92359bce60408f924bb.tar.gz
slixmpp-093644ffbd6708121150c92359bce60408f924bb.tar.bz2
slixmpp-093644ffbd6708121150c92359bce60408f924bb.tar.xz
slixmpp-093644ffbd6708121150c92359bce60408f924bb.zip
* major stanza improvements
* raise XMPPError in handler to reply with error stanza * started work on pubsub stanzas
Diffstat (limited to 'sleekxmpp/stanza/iq.py')
-rw-r--r--sleekxmpp/stanza/iq.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py
index a9c9c4be..cec0f8bc 100644
--- a/sleekxmpp/stanza/iq.py
+++ b/sleekxmpp/stanza/iq.py
@@ -3,8 +3,9 @@ from xml.etree import cElementTree as ET
from . error import Error
from .. xmlstream.handler.waiter import Waiter
from .. xmlstream.matcher.id import MatcherId
+from . rootstanza import RootStanza
-class Iq(StanzaBase):
+class Iq(RootStanza):
interfaces = set(('type', 'to', 'from', 'id','query'))
types = set(('get', 'result', 'set', 'error'))
name = 'iq'
@@ -13,13 +14,10 @@ class Iq(StanzaBase):
def __init__(self, *args, **kwargs):
StanzaBase.__init__(self, *args, **kwargs)
if self['id'] == '':
- self['id'] = self.stream.getNewId()
-
- def exception(self, text):
- self.reply()
- self['error']['condition'] = 'undefined-condition'
- self['error']['text'] = text
- self.send()
+ if self.stream is not None:
+ self['id'] = self.stream.getNewId()
+ else:
+ self['id'] = '0'
def unhandled(self):
self.reply()
@@ -84,7 +82,3 @@ class Iq(StanzaBase):
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