Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
efd417bf by Philipp Hörist at 2020-01-23T19:09:20+01:00
Use consistent callback signature for callbacks
- - - - -
3 changed files:
- nbxmpp/bind.py
- nbxmpp/dispatcher.py
- nbxmpp/features.py
Changes:
=====================================
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()
=====================================
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:
=====================================
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
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/commit/efd417bf608b87b70bb56c34bde9b860fd365bb9
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/commit/efd417bf608b87b70bb56c34bde9b860fd365bb9
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits