From ecd5a172ed49cbdf69cb3eaf0786fd18d801ee65 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Wed, 7 Apr 2010 23:10:32 -0700 Subject: replaced usage of deprecated iq result on send. Fixed old send result to use stanzas instead of ElementTree --- sleekxmpp/plugins/gmail_notify.py | 2 +- sleekxmpp/plugins/xep_0030.py | 4 ++-- sleekxmpp/plugins/xep_0045.py | 2 -- sleekxmpp/plugins/xep_0060.py | 22 +++++++++++----------- sleekxmpp/plugins/xep_0078.py | 4 ++-- sleekxmpp/plugins/xep_0092.py | 2 +- sleekxmpp/plugins/xep_0199.py | 3 ++- 7 files changed, 19 insertions(+), 20 deletions(-) (limited to 'sleekxmpp/plugins') 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.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, "" % 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, "" % 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, "" % 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("" % id, self.handlerCreateNodeResponse) - result = self.xmpp.send(iq, "" % 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, "" % 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, "" % 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, "" % 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, "" % 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, "" % 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, "" % 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, "" % 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, "" % (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) -- cgit v1.2.3