Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits: 964d31b5 by Philipp Hörist at 2018-05-18T17:11:06+02:00 Pass arguments to plugin/plugout method
- - - - - 467572b7 by Philipp Hörist at 2018-05-18T17:14:18+02:00 Allow initRoster without requesting the roster
- - - - -
2 changed files:
- nbxmpp/client_nb.py - nbxmpp/plugin.py
Changes:
===================================== nbxmpp/client_nb.py ===================================== --- a/nbxmpp/client_nb.py +++ b/nbxmpp/client_nb.py @@ -601,12 +601,13 @@ class NonBlockingClient(object): self.NonBlockingBind.NonBlockingBind(self._Resource, self._on_sasl_auth) return True
- def initRoster(self, version=''): + def initRoster(self, version='', request=True): """ Plug in the roster """ if 'NonBlockingRoster' not in self.__dict__: - return roster_nb.NonBlockingRoster.get_instance(version=version).PlugIn(self) + return roster_nb.NonBlockingRoster.get_instance( + version=version).PlugIn(self, request=request)
def getRoster(self, on_ready=None, force=False): """
===================================== nbxmpp/plugin.py ===================================== --- a/nbxmpp/plugin.py +++ b/nbxmpp/plugin.py @@ -37,7 +37,7 @@ class PlugIn(object): def __init__(self): self._exported_methods=[]
- def PlugIn(self, owner): + def PlugIn(self, owner, *args, **kwargs): """ Attach to owner and register ourself and our _exported_methods in it. If defined by a subclass, call self.plugin(owner) to execute hook @@ -62,9 +62,9 @@ class PlugIn(object):
# Execute hook if hasattr(self, 'plugin'): - return self.plugin(owner) + return self.plugin(owner, *args, **kwargs)
- def PlugOut(self): + def PlugOut(self, *args, **kwargs): """ Unregister our _exported_methods from owner and detach from it. If defined by a subclass, call self.plugout() after unplugging to execute @@ -82,7 +82,7 @@ class PlugIn(object): del self._owner.__dict__[self.__class__.__name__] # Execute hook if hasattr(self, 'plugout'): - return self.plugout() + return self.plugout(*args, **kwargs) del self._owner
@classmethod
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/e471a74e40d378d2c27e1a045b...
--- View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/e471a74e40d378d2c27e1a045b... You're receiving this email because of your account on dev.gajim.org.