diff options
author | Philipp Hörist <philipp@hoerist.com> | 2020-01-23 20:47:55 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2020-01-23 21:09:20 +0300 |
commit | efd417bf608b87b70bb56c34bde9b860fd365bb9 (patch) | |
tree | 36ec2cd843553b96ae73a9f1a31ab3507b5cadfe | |
parent | c328063fa1a40884bac7b71f1ba08e4f49741a16 (diff) |
Use consistent callback signature for callbacks
-rw-r--r-- | nbxmpp/bind.py | 4 | ||||
-rw-r--r-- | nbxmpp/dispatcher.py | 2 | ||||
-rw-r--r-- | nbxmpp/features.py | 10 |
3 files changed, 8 insertions, 8 deletions
diff --git a/nbxmpp/bind.py b/nbxmpp/bind.py index c780aa1..207fd87 100644 --- a/nbxmpp/bind.py +++ b/nbxmpp/bind.py @@ -89,7 +89,7 @@ class NonBlockingBind(PlugIn): self._owner.Dispatcher.SendAndCallForResponse(node, func=self._on_bind) - def _on_bind(self, stanza): + def _on_bind(self, _client, stanza): if isResultNode(stanza): bind = stanza.getTag('bind') if bind is not None: @@ -115,7 +115,7 @@ class NonBlockingBind(PlugIn): self._owner.Dispatcher.Event(Realm.CONNECTING, Event.BIND_FAILED) self.PlugOut() - def _on_session(self, stanza): + def _on_session(self, _client, stanza): if isResultNode(stanza): log.info('Successfully started session') self._on_bind_successful() diff --git a/nbxmpp/dispatcher.py b/nbxmpp/dispatcher.py index 1249252..60f68d5 100644 --- a/nbxmpp/dispatcher.py +++ b/nbxmpp/dispatcher.py @@ -613,7 +613,7 @@ class XMPPDispatcher(PlugIn): cb, args) try: if args is None: - cb(stanza) + cb(self, stanza) else: cb(self, stanza, **args) except NodeProcessed: diff --git a/nbxmpp/features.py b/nbxmpp/features.py index 8a85291..69b8b6e 100644 --- a/nbxmpp/features.py +++ b/nbxmpp/features.py @@ -21,7 +21,7 @@ Different stuff that wasn't worth separating it into modules from .protocol import NS_REGISTER, NS_PRIVACY, NS_DATA, Iq, isResultNode, Node def _on_default_response(disp, iq, cb): - def _on_response(resp): + def _on_response(_client, resp): if isResultNode(resp): if cb: cb(True) @@ -47,7 +47,7 @@ def getRegInfo(disp, host, info={}, sync=True): for i in info.keys(): iq.setTagData(i, info[i]) if sync: - disp.SendAndCallForResponse(iq, lambda resp: + disp.SendAndCallForResponse(iq, lambda _client, resp: _ReceivedRegInfo(disp.Dispatcher, resp, host)) else: disp.SendAndCallForResponse(iq, _ReceivedRegInfo, {'agent': host }) @@ -127,7 +127,7 @@ def getPrivacyLists(disp): lists on success. """ iq = Iq('get', NS_PRIVACY) - def _on_response(resp): + def _on_response(_client, resp): dict_ = {'lists': []} if not isResultNode(resp): disp.Event(NS_PRIVACY, PRIVACY_LISTS_RECEIVED, False) @@ -142,7 +142,7 @@ def getPrivacyLists(disp): def getActiveAndDefaultPrivacyLists(disp): iq = Iq('get', NS_PRIVACY) - def _on_response(resp): + def _on_response(_client, resp): dict_ = {'active': '', 'default': ''} if not isResultNode(resp): disp.Event(NS_PRIVACY, PRIVACY_LISTS_ACTIVE_DEFAULT, False) @@ -160,7 +160,7 @@ def getPrivacyList(disp, listname): Request specific privacy list listname. Returns list of XML nodes (rules) taken from the server responce. """ - def _on_response(resp): + def _on_response(_client, resp): if not isResultNode(resp): disp.Event(NS_PRIVACY, PRIVACY_LIST_RECEIVED, False) return |