Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/presence/util.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-07-12 18:33:19 (GMT)
committer Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-20 13:33:53 (GMT)
commit1a4c721f3d564dcb7d395196130c0299a4ec1fd4 (patch)
tree0623c114feecc44fbc1a74f75a2b2bda1b5b7184 /src/sugar/presence/util.py
parentcc8ecd81e7eb5ee77d76b3752492cdbd6165625e (diff)
Identify buddies and activities by their account and ids instead
of connection and handle.
Diffstat (limited to 'src/sugar/presence/util.py')
-rw-r--r--src/sugar/presence/util.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sugar/presence/util.py b/src/sugar/presence/util.py
index 265e390..f00228f 100644
--- a/src/sugar/presence/util.py
+++ b/src/sugar/presence/util.py
@@ -10,7 +10,7 @@ ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
class ConnectionManager(object):
def __init__(self):
- self.connections_per_account = []
+ self._connections_per_account = {}
bus = dbus.SessionBus()
obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, ACCOUNT_MANAGER_PATH)
@@ -32,11 +32,11 @@ class ConnectionManager(object):
connection_name = connection_path.replace('/', '.')[1:]
connection = bus.get_object(connection_name, connection_path)
- self.connections[account_path] = connection
+ self._connections_per_account[account_path] = connection
def get_preferred_connection(self):
best_connection = None, None
- for account_path, connection in self.connections.items():
+ for account_path, connection in self._connections_per_account.items():
if 'salut' in connection.object_path:
best_connection = account_path, connection
elif 'gabble' in connection.object_path:
@@ -44,6 +44,14 @@ class ConnectionManager(object):
break
return best_connection
+ def get_connection(self, account_path):
+ return self._connections_per_account[account_path]
+
+ def get_connections(self):
+ return self._connections_per_account.values()
+
+ connections = property(get_connections)
+
_connection_manager = None
def get_connection_manager():