From 93386a4d8afe1d836e5ff405368d03dc9e7aed38 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 23 Feb 2007 12:34:35 -0500 Subject: [PATCH] Handle contact approval and request presence when using existing connection --- services/presence2/telepathyclient.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/presence2/telepathyclient.py b/services/presence2/telepathyclient.py index aeb2a2d2..34843bd6 100644 --- a/services/presence2/telepathyclient.py +++ b/services/presence2/telepathyclient.py @@ -116,7 +116,17 @@ class TelepathyClient(gobject.GObject): loop.quit() def run(self): - self.conn[CONN_INTERFACE].Connect() + # If the connection is already connected query initial contacts + conn_status = self.conn[CONN_INTERFACE].GetStatus() + if conn_status == CONNECTION_STATUS_CONNECTED: + self._connected_cb() + subscribe = self._request_list_channel('subscribe') + subscribe_handles = subscribe[CHANNEL_INTERFACE_GROUP].GetMembers() + self.conn[CONN_INTERFACE_PRESENCE].RequestPresence(subscribe_handles) + elif conn_status == CONNECTION_STATUS_CONNECTING: + pass + else: + self.conn[CONN_INTERFACE].Connect() def disconnect(self): self.conn[CONN_INTERFACE].Disconnect()