core: plugins can now have profileConnected/profileDisconnected method to initialise/free profile dependant resources

This commit is contained in:
Goffi 2011-12-03 15:45:48 +01:00
commit 07b44d3170
2 changed files with 9 additions and 2 deletions

View file

@ -247,6 +247,9 @@ class SAT(service.Service):
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 @@ class SAT(service.Service):
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

View file

@ -229,8 +229,8 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
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']