From 6df1f3eca5d7791305b4fbf94f07301efa988a07 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 19 Sep 2007 13:46:13 +0000 Subject: * #3506: LL and server plugins are mutually exclusive for trial-3 --- diff --git a/NEWS b/NEWS index 282e7a7..22124f0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +* #3506: LL and server plugins are mutually exclusive for trial-3 (dcbw) + Snapshot 46898a3e00 * Adapt to sugar API change (marco) diff --git a/src/presenceservice.py b/src/presenceservice.py index 8452410..218c974 100644 --- a/src/presenceservice.py +++ b/src/presenceservice.py @@ -148,8 +148,17 @@ class PresenceService(ExportedGObject): def _tp_status_cb(self, plugin, status, reason): if status == CONNECTION_STATUS_CONNECTED: self._tp_connected(plugin) + if plugin == self._server_plugin and self._ll_plugin: + # For now, Gabble takes precedence over Salut to alleviate + # corner cases where laptops on mesh can't talk to ones on APs + self._ll_plugin.cleanup() else: self._tp_disconnected(plugin) + if plugin == self._server_plugin and self._ll_plugin and status == CONNECTION_STATUS_DISCONNECTED: + # For now, Gabble takes precedence over Salut to alleviate + # corner cases where laptops on mesh can't talk to ones on APs + if self._ll_plugin.status == CONNECTION_STATUS_DISCONNECTED: + self._ll_plugin.start() def _tp_connected(self, tp): self._connected_plugins.add(tp) diff --git a/src/telepathy_plugin.py b/src/telepathy_plugin.py index f597476..6b99cbe 100644 --- a/src/telepathy_plugin.py +++ b/src/telepathy_plugin.py @@ -278,11 +278,20 @@ class TelepathyPlugin(gobject.GObject): self._conn[CONN_INTERFACE].Disconnect() except: pass - self._conn = None + self._conn_status = CONNECTION_STATUS_DISCONNECTED + self.emit('status', self._conn_status, 0) if self._online_contacts: - self._contacts_offline(self._online_contacts) + # Copy contacts when passing them to self._contacts_offline to + # ensure it's pass by _value_, otherwise (since it's a set) it's + # passed by reference and odd things happen when it gets subtracted + # from itself + self._contacts_offline(self._online_contacts.copy()) + + # Erase connection as the last thing done, because some of the + # above calls depend on self._conn being valid + self._conn = None def cleanup(self): self._stop() -- cgit v0.9.1