* started converstion to stanza objects
This commit is contained in:
+19
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user