[sugar] [PATCH] services/presence/: keep track of the owner's Telepathy handles
Dan Williams
dcbw at redhat.com
Thu May 24 13:45:57 EDT 2007
On Tue, 2007-05-22 at 16:49 +0100, Simon McVittie wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> - ---
> services/presence/presenceservice.py | 7 +++++++
> services/presence/server_plugin.py | 5 +++--
> 2 files changed, 10 insertions(+), 2 deletions(-)
Looks good
> diff --git a/services/presence/presenceservice.py b/services/presence/presenceservice.py
> index 4bd4da8..0c8a2a5 100644
> - --- a/services/presence/presenceservice.py
> +++ b/services/presence/presenceservice.py
> @@ -107,12 +107,19 @@ class PresenceService(ExportedGObject):
> _logger.debug("Disconnected from session bus!!!")
>
> def _server_status_cb(self, plugin, status, reason):
> +
> # FIXME: figure out connection status when we have a salut plugin too
> old_status = self._connected
> if status == CONNECTION_STATUS_CONNECTED:
> self._connected = True
> + self._handles_buddies[plugin][plugin.self_handle] = self._owner
> + self._owner.add_telepathy_handle(plugin, plugin.self_handle)
> else:
> self._connected = False
> + if plugin.self_handle is not None:
> + self._handles_buddies.setdefault(plugin, {}).pop(
> + plugin.self_handle, None)
> + self._owner.remove_telepathy_handle(plugin, plugin.self_handle)
>
> if self._connected != old_status:
> self.emit('connection-status', self._connected)
> diff --git a/services/presence/server_plugin.py b/services/presence/server_plugin.py
> index a886fdb..6b21888 100644
> - --- a/services/presence/server_plugin.py
> +++ b/services/presence/server_plugin.py
> @@ -137,6 +137,7 @@ class ServerPlugin(gobject.GObject):
> self._owner = owner
> self._owner.connect("property-changed", self._owner_property_changed_cb)
> self._owner.connect("icon-changed", self._owner_icon_changed_cb)
> + self.self_handle = None
>
> self._account = self._get_account_info()
> self._conn_status = CONNECTION_STATUS_DISCONNECTED
> @@ -348,8 +349,8 @@ class ServerPlugin(gobject.GObject):
> # accept pending subscriptions
> publish[CHANNEL_INTERFACE_GROUP].AddMembers(local_pending, '')
>
> - - self_handle = self._conn[CONN_INTERFACE].GetSelfHandle()
> - - self._online_contacts[self_handle] = self._account['account']
> + self.self_handle = self._conn[CONN_INTERFACE].GetSelfHandle()
> + self._online_contacts[self.self_handle] = self._account['account']
>
> # request subscriptions from people subscribed to us if we're not subscribed to them
> not_subscribed = list(set(publish_handles) - set(subscribe_handles))
> - --
> 1.5.2-rc3.GIT
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net
>
> iD8DBQFGUxEBWSc8zVUw7HYRAkjQAKDUfFxmfHBOqYOcLLM4mZX6lv72gQCcDm50
> /W56qua0c+iTwNcMdXtC7DI=
> =scbA
> -----END PGP SIGNATURE-----
> _______________________________________________
> Sugar mailing list
> Sugar at laptop.org
> http://mailman.laptop.org/mailman/listinfo/sugar
More information about the Sugar
mailing list