Mercurial > libervia-backend
changeset 438:62145e50eae5
core: plugins can now have profileConnected/profileDisconnected method to initialise/free profile dependant resources
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 03 Dec 2011 15:45:48 +0100 |
parents | 02c633a0ddcf |
children | 866dbb0d7d87 |
files | src/core/sat_main.py src/core/xmpp.py |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/sat_main.py Wed Nov 30 00:24:41 2011 +0100 +++ b/src/core/sat_main.py Sat Dec 03 15:45:48 2011 +0100 @@ -247,6 +247,9 @@ for plugin in self.plugins.iteritems(): if plugin[1].is_handler: plugin[1].getHandler(profile).setHandlerParent(current) + connected_cb = getattr(plugin[1], "profileConnected", None) + if connected_cb: + connected_cb(profile) current.startService() @@ -262,6 +265,10 @@ profile = self.memory.getProfileName(profile_key) info(_("Disconnecting...")) self.profiles[profile].stopService() + for plugin in self.plugins.iteritems(): + disconnected_cb = getattr(plugin[1], "profileDisconnected", None) + if disconnected_cb: + disconnected_cb(profile) def purgeClient(self, profile): """Remove reference to a profile client and purge cache
--- a/src/core/xmpp.py Wed Nov 30 00:24:41 2011 +0100 +++ b/src/core/xmpp.py Sat Dec 03 15:45:48 2011 +0100 @@ -229,8 +229,8 @@ def available(self, entity=None, show=None, statuses=None, priority=0): if not statuses: statuses = {} - # default for us is None for wokkel - # so we must temporarily switch to wokkel's convention... + # default for us is None for wokkel + # so we must temporarily switch to wokkel's convention... if 'default' in statuses: statuses[None] = statuses['default']