diff options
-rw-r--r-- | sleekxmpp/__init__.py | 3 | ||||
-rw-r--r-- | sleekxmpp/basexmpp.py | 3 | ||||
-rw-r--r-- | sleekxmpp/plugins/gmail_notify.py | 2 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0030.py | 4 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0045.py | 2 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0060.py | 22 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0078.py | 4 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0092.py | 2 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0199.py | 3 |
9 files changed, 23 insertions, 22 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py index c788313d..773f7936 100644 --- a/sleekxmpp/__init__.py +++ b/sleekxmpp/__init__.py @@ -229,7 +229,8 @@ class ClientXMPP(basexmpp, XMLStream): def handler_start_session(self, xml): if self.authenticated: - response = self.send(self.makeIqSet(xml), self.makeIq(self.getId())) + iq = self.makeIqSet(xml) + response = iq.send() logging.debug("Established Session") self.sessionstarted = True self.event("session_start") diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 34b8d764..585ecacb 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -14,6 +14,7 @@ from . xmlstream.matcher.xmlmask import MatchXMLMask from . xmlstream.matcher.many import MatchMany from . xmlstream.handler.xmlcallback import XMLCallback from . xmlstream.handler.xmlwaiter import XMLWaiter +from . xmlstream.handler.waiter import Waiter from . xmlstream.handler.callback import Callback from . import plugins from . stanza.message import Message @@ -138,7 +139,7 @@ class basexmpp(object): mask = mask.xml data = str(data) if mask is not None: - waitfor = XMLWaiter('SendWait_%s' % self.getNewId(), MatchXMLMask(mask)) + waitfor = Waiter('SendWait_%s' % self.getNewId(), MatchXMLMask(mask)) self.registerHandler(waitfor) self.sendRaw(data) if mask is not None: diff --git a/sleekxmpp/plugins/gmail_notify.py b/sleekxmpp/plugins/gmail_notify.py index 330bf2a5..b709ef69 100644 --- a/sleekxmpp/plugins/gmail_notify.py +++ b/sleekxmpp/plugins/gmail_notify.py @@ -51,7 +51,7 @@ class gmail_notify(base.base_plugin): iq.attrib['from'] = self.xmpp.fulljid iq.attrib['to'] = self.xmpp.jid self.xmpp.makeIqQuery(iq, 'google:mail:notify') - emails = self.xmpp.send(iq, self.xmpp.makeIq(self.xmpp.id)) + emails = iq.send() mailbox = emails.find('{google:mail:notify}mailbox') total = int(mailbox.get('total-matched', 0)) logging.info("%s New Gmail Messages" % total) diff --git a/sleekxmpp/plugins/xep_0030.py b/sleekxmpp/plugins/xep_0030.py index bff0dc17..5432dd56 100644 --- a/sleekxmpp/plugins/xep_0030.py +++ b/sleekxmpp/plugins/xep_0030.py @@ -93,7 +93,7 @@ class xep_0030(base.base_plugin): self.xmpp.makeIqQuery(iq, 'http://jabber.org/protocol/disco#items') if node: iq.find('{http://jabber.org/protocol/disco#items}query').attrib['node'] = node - return self.xmpp.send(iq, "<iq id='%s' />" % iq.get('id')) + return iq.send() def getInfo(self, jid, node=None): iq = self.xmpp.makeIqGet() @@ -102,7 +102,7 @@ class xep_0030(base.base_plugin): self.xmpp.makeIqQuery(iq, 'http://jabber.org/protocol/disco#info') if node: iq.find('{http://jabber.org/protocol/disco#info}query').attrib['node'] = node - return self.xmpp.send(iq, self.xmpp.makeIq(iq.get('id'))) + return iq.send() def parseInfo(self, xml): result = {'identity': {}, 'feature': []} diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py index 1e695233..7fc8a2bf 100644 --- a/sleekxmpp/plugins/xep_0045.py +++ b/sleekxmpp/plugins/xep_0045.py @@ -182,7 +182,6 @@ class xep_0045(base.base_plugin): form = form.getXML('submit') query.append(form) iq.append(query) - #result = self.xmpp.send(iq, self.xmpp.makeIq(iq.get('id'))) result = iq.send() if result['type'] == 'error': return False @@ -224,7 +223,6 @@ class xep_0045(base.base_plugin): destroy.append(xreason) query.append(destroy) iq.append(query) - #r = self.xmpp.send(iq, self.xmpp.makeIq(iq.get('id'))) r = iq.send() if r is False or r['type'] == 'error': return False diff --git a/sleekxmpp/plugins/xep_0060.py b/sleekxmpp/plugins/xep_0060.py index cbc89df6..8c6acd01 100644 --- a/sleekxmpp/plugins/xep_0060.py +++ b/sleekxmpp/plugins/xep_0060.py @@ -44,7 +44,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is False or result is None or result['type'] == 'error': return False return True @@ -64,7 +64,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is False or result is None or result['type'] == 'error': return False return True @@ -84,7 +84,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is False or result is None or result['type'] == 'error': return False return True @@ -103,7 +103,7 @@ class xep_0060(base.base_plugin): iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] #self.xmpp.add_handler("<iq id='%s'/>" % id, self.handlerCreateNodeResponse) - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result == False or result['type'] == 'error': logging.warning("got error instead of config") return False @@ -126,7 +126,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result == False or result['type'] == 'error': logging.warning("got error instead of config") return False @@ -149,7 +149,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result == False or result['type'] == 'error': logging.warning("got error instead of config") return False @@ -172,7 +172,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is not None and result is not False and result.attrib.get('type', 'error') != 'error': return True else: @@ -190,7 +190,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result['type'] == 'error': return False return True @@ -211,7 +211,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result is False or result['type'] == 'error': return False return True @@ -227,7 +227,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result is False or result['type'] == 'error': return False return True @@ -281,7 +281,7 @@ class xep_0060(base.base_plugin): iq.attrib['to'] = ps_jid iq.attrib['from'] = self.xmpp.fulljid id = iq['id'] - result = self.xmpp.send(iq, "<iq id='%s'/>" % id) + result = iq.send() if result is None or result is False or result['type'] == 'error': return False return True diff --git a/sleekxmpp/plugins/xep_0078.py b/sleekxmpp/plugins/xep_0078.py index 8cce0eb0..f8732905 100644 --- a/sleekxmpp/plugins/xep_0078.py +++ b/sleekxmpp/plugins/xep_0078.py @@ -50,7 +50,7 @@ class xep_0078(base.base_plugin): username.text = self.xmpp.username auth_request_query.append(username) auth_request.append(auth_request_query) - result = self.xmpp.send(auth_request, self.xmpp.makeIqResult(self.xmpp.id)) + result = auth_request.send() rquery = result.find('{jabber:iq:auth}query') attempt = self.xmpp.makeIqSet() query = ET.Element('{jabber:iq:auth}query') @@ -69,7 +69,7 @@ class xep_0078(base.base_plugin): digest.text = hashlib.sha1(b"%s%s" % (self.streamid, self.xmpp.password)).hexdigest() query.append(digest) attempt.append(query) - result = self.xmpp.send(attempt, self.xmpp.makeIq(self.xmpp.id)) + result = attempt.send() if result.attrib['type'] == 'result': with self.xmpp.lock: self.xmpp.authenticated = True diff --git a/sleekxmpp/plugins/xep_0092.py b/sleekxmpp/plugins/xep_0092.py index 97346d91..3d026382 100644 --- a/sleekxmpp/plugins/xep_0092.py +++ b/sleekxmpp/plugins/xep_0092.py @@ -55,7 +55,7 @@ class xep_0092(base.base_plugin): iq.attrib['to'] = jid iq.attrib['from'] = self.xmpp.fulljid id = iq.get('id') - result = self.xmpp.send(iq, "<iq xmlns='%s' id='%s'/>" % (self.xmpp.default_ns, id)) + result = iq.send() if result and result is not None and result.get('type', 'error') != 'error': qry = result.find('{jabber:iq:version}query') version = {} diff --git a/sleekxmpp/plugins/xep_0199.py b/sleekxmpp/plugins/xep_0199.py index 57d56c02..989e6450 100644 --- a/sleekxmpp/plugins/xep_0199.py +++ b/sleekxmpp/plugins/xep_0199.py @@ -62,7 +62,8 @@ class xep_0199(base.base_plugin): ping = ET.Element('{http://www.xmpp.org/extensions/xep-0199.html#ns}ping') iq.append(ping) startTime = time.clock() - pingresult = self.xmpp.send(iq, self.xmpp.makeIq(id), timeout) + #pingresult = self.xmpp.send(iq, self.xmpp.makeIq(id), timeout) + pingresult = iq.send() endTime = time.clock() if pingresult == False: #self.xmpp.disconnect(reconnect=True) |