summaryrefslogtreecommitdiff
path: root/slixmpp/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'slixmpp/plugins')
-rw-r--r--slixmpp/plugins/xep_0009/rpc.py12
-rw-r--r--slixmpp/plugins/xep_0012/last_activity.py3
-rw-r--r--slixmpp/plugins/xep_0027/gpg.py3
-rw-r--r--slixmpp/plugins/xep_0030/disco.py4
-rw-r--r--slixmpp/plugins/xep_0047/ibb.py3
-rw-r--r--slixmpp/plugins/xep_0047/stream.py6
-rw-r--r--slixmpp/plugins/xep_0050/adhoc.py6
-rw-r--r--slixmpp/plugins/xep_0054/vcard_temp.py2
-rw-r--r--slixmpp/plugins/xep_0065/proxy.py2
-rw-r--r--slixmpp/plugins/xep_0092/version.py2
-rw-r--r--slixmpp/plugins/xep_0202/time.py2
-rw-r--r--slixmpp/plugins/xep_0231/bob.py2
-rw-r--r--slixmpp/plugins/xep_0323/sensordata.py20
-rw-r--r--slixmpp/plugins/xep_0325/control.py12
14 files changed, 39 insertions, 40 deletions
diff --git a/slixmpp/plugins/xep_0009/rpc.py b/slixmpp/plugins/xep_0009/rpc.py
index 5ed8b84c..786b1d2f 100644
--- a/slixmpp/plugins/xep_0009/rpc.py
+++ b/slixmpp/plugins/xep_0009/rpc.py
@@ -93,7 +93,8 @@ class XEP_0009(BasePlugin):
def _item_not_found(self, iq):
payload = iq.get_payload()
- iq.reply().error().set_payload(payload)
+ iq = iq.reply()
+ iq.error().set_payload(payload)
iq['error']['code'] = '404'
iq['error']['type'] = 'cancel'
iq['error']['condition'] = 'item-not-found'
@@ -101,7 +102,8 @@ class XEP_0009(BasePlugin):
def _undefined_condition(self, iq):
payload = iq.get_payload()
- iq.reply().error().set_payload(payload)
+ iq = iq.reply()
+ iq.error().set_payload(payload)
iq['error']['code'] = '500'
iq['error']['type'] = 'cancel'
iq['error']['condition'] = 'undefined-condition'
@@ -109,7 +111,8 @@ class XEP_0009(BasePlugin):
def _forbidden(self, iq):
payload = iq.get_payload()
- iq.reply().error().set_payload(payload)
+ iq = iq.reply()
+ iq.error().set_payload(payload)
iq['error']['code'] = '403'
iq['error']['type'] = 'auth'
iq['error']['condition'] = 'forbidden'
@@ -117,7 +120,8 @@ class XEP_0009(BasePlugin):
def _recipient_unvailable(self, iq):
payload = iq.get_payload()
- iq.reply().error().set_payload(payload)
+ iq = iq.reply()
+ error().set_payload(payload)
iq['error']['code'] = '404'
iq['error']['type'] = 'wait'
iq['error']['condition'] = 'recipient-unavailable'
diff --git a/slixmpp/plugins/xep_0012/last_activity.py b/slixmpp/plugins/xep_0012/last_activity.py
index 76a68c7a..c1f69a44 100644
--- a/slixmpp/plugins/xep_0012/last_activity.py
+++ b/slixmpp/plugins/xep_0012/last_activity.py
@@ -132,8 +132,7 @@ class XEP_0012(BasePlugin):
if not isinstance(iq, Iq):
reply = self.xmpp.Iq()
else:
- iq.reply()
- reply = iq
+ reply = iq.reply()
if jid not in self._last_activities:
raise XMPPError('service-unavailable')
diff --git a/slixmpp/plugins/xep_0027/gpg.py b/slixmpp/plugins/xep_0027/gpg.py
index e9978416..a0b1df48 100644
--- a/slixmpp/plugins/xep_0027/gpg.py
+++ b/slixmpp/plugins/xep_0027/gpg.py
@@ -67,8 +67,7 @@ class XEP_0027(BasePlugin):
register_stanza_plugin(Message, Encrypted)
self.xmpp.add_event_handler('unverified_signed_presence',
- self._handle_unverified_signed_presence,
- threaded=True)
+ self._handle_unverified_signed_presence)
self.xmpp.register_handler(
Callback('Signed Presence',
diff --git a/slixmpp/plugins/xep_0030/disco.py b/slixmpp/plugins/xep_0030/disco.py
index 3fb005a9..c8c18ea7 100644
--- a/slixmpp/plugins/xep_0030/disco.py
+++ b/slixmpp/plugins/xep_0030/disco.py
@@ -634,7 +634,7 @@ class XEP_0030(BasePlugin):
info['id'] = iq['id']
info.send()
else:
- iq.reply()
+ iq = iq.reply()
if info:
info = self._fix_default_info(info)
iq.set_payload(info.xml)
@@ -674,7 +674,7 @@ class XEP_0030(BasePlugin):
if isinstance(items, Iq):
items.send()
else:
- iq.reply()
+ iq = iq.reply()
if items:
iq.set_payload(items.xml)
iq.send()
diff --git a/slixmpp/plugins/xep_0047/ibb.py b/slixmpp/plugins/xep_0047/ibb.py
index ce697f01..7c01c78a 100644
--- a/slixmpp/plugins/xep_0047/ibb.py
+++ b/slixmpp/plugins/xep_0047/ibb.py
@@ -191,8 +191,7 @@ class XEP_0047(BasePlugin):
self.window_size)
stream.stream_started.set()
self.api['set_stream'](stream.self_jid, stream.sid, stream.peer_jid, stream)
- iq.reply()
- iq.send()
+ iq.reply().send()
self.xmpp.event('ibb_stream_start', stream)
self.xmpp.event('stream:%s:%s' % (sid, stream.peer_jid), stream)
diff --git a/slixmpp/plugins/xep_0047/stream.py b/slixmpp/plugins/xep_0047/stream.py
index a8e7ff2a..ba0b2cec 100644
--- a/slixmpp/plugins/xep_0047/stream.py
+++ b/slixmpp/plugins/xep_0047/stream.py
@@ -103,8 +103,7 @@ class IBBytestream(object):
self.xmpp.event('ibb_stream_data', {'stream': self, 'data': data})
if isinstance(stanza, Iq):
- stanza.reply()
- stanza.send()
+ stanza.reply().send()
def recv(self, *args, **kwargs):
return self.read(block=True)
@@ -134,8 +133,7 @@ class IBBytestream(object):
def _closed(self, iq):
self.stream_in_closed.set()
self.stream_out_closed.set()
- iq.reply()
- iq.send()
+ iq.reply().send()
self.xmpp.event('ibb_stream_end', self)
def makefile(self, *args, **kwargs):
diff --git a/slixmpp/plugins/xep_0050/adhoc.py b/slixmpp/plugins/xep_0050/adhoc.py
index cb179a03..17c4f7d0 100644
--- a/slixmpp/plugins/xep_0050/adhoc.py
+++ b/slixmpp/plugins/xep_0050/adhoc.py
@@ -339,7 +339,7 @@ class XEP_0050(BasePlugin):
for item in payload:
register_stanza_plugin(Command, item.__class__, iterable=True)
- iq.reply()
+ iq = iq.reply()
iq['command']['node'] = session['node']
iq['command']['sessionid'] = session['id']
@@ -382,7 +382,7 @@ class XEP_0050(BasePlugin):
if handler:
handler(iq, session)
del self.sessions[sessionid]
- iq.reply()
+ iq = iq.reply()
iq['command']['node'] = node
iq['command']['sessionid'] = sessionid
iq['command']['status'] = 'canceled'
@@ -421,7 +421,7 @@ class XEP_0050(BasePlugin):
del self.sessions[sessionid]
- iq.reply()
+ iq = iq.reply()
iq['command']['node'] = node
iq['command']['sessionid'] = sessionid
iq['command']['actions'] = []
diff --git a/slixmpp/plugins/xep_0054/vcard_temp.py b/slixmpp/plugins/xep_0054/vcard_temp.py
index 9709c998..ae47a5f9 100644
--- a/slixmpp/plugins/xep_0054/vcard_temp.py
+++ b/slixmpp/plugins/xep_0054/vcard_temp.py
@@ -127,7 +127,7 @@ class XEP_0054(BasePlugin):
if isinstance(vcard, Iq):
vcard.send()
else:
- iq.reply()
+ iq = iq.reply()
iq.append(vcard)
iq.send()
elif iq['type'] == 'set':
diff --git a/slixmpp/plugins/xep_0065/proxy.py b/slixmpp/plugins/xep_0065/proxy.py
index cb6affde..a1c2bc60 100644
--- a/slixmpp/plugins/xep_0065/proxy.py
+++ b/slixmpp/plugins/xep_0065/proxy.py
@@ -178,7 +178,7 @@ class XEP_0065(BasePlugin):
else:
raise XMPPError(etype='cancel', condition='item-not-found')
- iq.reply()
+ iq = iq.reply()
with self._sessions_lock:
self._sessions[sid] = conn
iq['socks']['sid'] = sid
diff --git a/slixmpp/plugins/xep_0092/version.py b/slixmpp/plugins/xep_0092/version.py
index 398f6b30..9decbabe 100644
--- a/slixmpp/plugins/xep_0092/version.py
+++ b/slixmpp/plugins/xep_0092/version.py
@@ -64,7 +64,7 @@ class XEP_0092(BasePlugin):
Arguments:
iq -- The Iq stanza containing the software version query.
"""
- iq.reply()
+ iq = iq.reply()
iq['software_version']['name'] = self.software_name
iq['software_version']['version'] = self.version
iq['software_version']['os'] = self.os
diff --git a/slixmpp/plugins/xep_0202/time.py b/slixmpp/plugins/xep_0202/time.py
index 760ef26a..fbf6b4f0 100644
--- a/slixmpp/plugins/xep_0202/time.py
+++ b/slixmpp/plugins/xep_0202/time.py
@@ -72,7 +72,7 @@ class XEP_0202(BasePlugin):
Arguments:
iq -- The Iq time request stanza.
"""
- iq.reply()
+ iq = iq.reply()
iq['entity_time']['time'] = self.local_time(iq['to'])
iq.send()
diff --git a/slixmpp/plugins/xep_0231/bob.py b/slixmpp/plugins/xep_0231/bob.py
index d590c9dd..3c99ae6b 100644
--- a/slixmpp/plugins/xep_0231/bob.py
+++ b/slixmpp/plugins/xep_0231/bob.py
@@ -115,7 +115,7 @@ class XEP_0231(BasePlugin):
data.send()
return
- iq.reply()
+ iq = iq.reply()
iq.append(data)
iq.send()
diff --git a/slixmpp/plugins/xep_0323/sensordata.py b/slixmpp/plugins/xep_0323/sensordata.py
index e032bb7b..21afb55a 100644
--- a/slixmpp/plugins/xep_0323/sensordata.py
+++ b/slixmpp/plugins/xep_0323/sensordata.py
@@ -303,11 +303,11 @@ class XEP_0323(BasePlugin):
#print("added session: " + str(self.sessions))
- iq.reply()
+ iq = iq.reply()
iq['accepted']['seqnr'] = seqnr
if not request_delay_sec is None:
iq['accepted']['queued'] = "true"
- iq.send(block=False)
+ iq.send()
self.sessions[session]["node_list"] = process_nodes
@@ -327,11 +327,11 @@ class XEP_0323(BasePlugin):
self._threaded_node_request(session, process_fields, req_flags)
else:
- iq.reply()
+ iq = iq.reply()
iq['type'] = 'error'
iq['rejected']['seqnr'] = seqnr
iq['rejected']['error'] = error_msg
- iq.send(block=False)
+ iq.send()
def _threaded_node_request(self, session, process_fields, flags):
"""
@@ -515,21 +515,21 @@ class XEP_0323(BasePlugin):
self.sessions[s]["commTimers"][n].cancel()
# Confirm
- iq.reply()
+ iq = iq.reply()
iq['type'] = 'result'
iq['cancelled']['seqnr'] = seqnr
- iq.send(block=False)
+ iq.send()
# Delete session
del self.sessions[s]
return
# Could not find session, send reject
- iq.reply()
+ iq = iq.reply()
iq['type'] = 'error'
iq['rejected']['seqnr'] = seqnr
iq['rejected']['error'] = "Cancel request received, no matching request is active."
- iq.send(block=False)
+ iq.send()
# =================================================================
# Client side (data retriever) API
@@ -610,7 +610,7 @@ class XEP_0323(BasePlugin):
iq['req']._set_flags(flags)
self.sessions[seqnr] = {"from": iq['from'], "to": iq['to'], "seqnr": seqnr, "callback": callback}
- iq.send(block=False)
+ iq.send()
return seqnr
@@ -631,7 +631,7 @@ class XEP_0323(BasePlugin):
iq['type'] = "get"
iq['id'] = seqnr
iq['cancel']['seqnr'] = seqnr
- iq.send(block=False)
+ iq.send()
def _get_new_seqnr(self):
""" Returns a unique sequence number (unique across threads) """
diff --git a/slixmpp/plugins/xep_0325/control.py b/slixmpp/plugins/xep_0325/control.py
index e1c16d40..74e067d1 100644
--- a/slixmpp/plugins/xep_0325/control.py
+++ b/slixmpp/plugins/xep_0325/control.py
@@ -273,7 +273,7 @@ class XEP_0325(BasePlugin):
self._threaded_node_request(session, process_fields)
else:
- iq.reply()
+ iq = iq.reply()
iq['type'] = 'error'
iq['setResponse']['responseCode'] = "NotFound"
if missing_node is not None:
@@ -282,7 +282,7 @@ class XEP_0325(BasePlugin):
iq['setResponse'].add_data(missing_field)
iq['setResponse']['error']['var'] = "Output"
iq['setResponse']['error']['text'] = error_msg
- iq.send(block=False)
+ iq.send()
def _handle_direct_set(self, msg):
"""
@@ -382,7 +382,7 @@ class XEP_0325(BasePlugin):
iq['setResponse'].add_node(nodeId)
iq['setResponse']['error']['var'] = "Output"
iq['setResponse']['error']['text'] = "Timeout."
- iq.send(block=False)
+ iq.send()
## TODO - should we send one timeout per node??
@@ -443,7 +443,7 @@ class XEP_0325(BasePlugin):
iq['setResponse'].add_data(error_field)
iq['setResponse']['error']['var'] = error_field
iq['setResponse']['error']['text'] = error_msg
- iq.send(block=False)
+ iq.send()
# Drop communication with this device and check if we are done
self.sessions[session]["nodeDone"][nodeId] = True
@@ -463,7 +463,7 @@ class XEP_0325(BasePlugin):
iq['type'] = "result"
iq['id'] = self.sessions[session]['seqnr']
iq['setResponse']['responseCode'] = "OK"
- iq.send(block=False)
+ iq.send()
# The session is complete, delete it
del self.sessions[session]
@@ -526,7 +526,7 @@ class XEP_0325(BasePlugin):
iq['set'].add_data(name=name, typename=typename, value=value)
self.sessions[seqnr] = {"from": iq['from'], "to": iq['to'], "callback": callback}
- iq.send(block=False)
+ iq.send()
def set_command(self, from_jid, to_jid, fields, nodeIds=None):
"""