summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk>2010-10-22 15:15:22 -0400
committerLouis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk>2010-12-03 10:55:43 -0500
commit0778d47b25c6094079faa4403b33735c50e96ddb (patch)
tree424e434fab700cbf9bb1086536c3912d5ea2c89c /src
parentfb00d7ad2c8481a777844fd7ca20be76d2682fbd (diff)
Implement new properties of ConnectionManager
Diffstat (limited to 'src')
-rw-r--r--src/server/connmgr.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/server/connmgr.py b/src/server/connmgr.py
index 9c97b7d..f087aae 100644
--- a/src/server/connmgr.py
+++ b/src/server/connmgr.py
@@ -21,12 +21,14 @@ import dbus
import dbus.service
from telepathy.errors import NotImplemented
-from telepathy.interfaces import CONN_MGR_INTERFACE
+from telepathy.interfaces import (CONN_MGR_INTERFACE,
+ PROTOCOL)
+from telepathy.server.properties import DBusProperties
from telepathy._generated.Connection_Manager \
import ConnectionManager as _ConnectionManager
-class ConnectionManager(_ConnectionManager):
+class ConnectionManager(_ConnectionManager, DBusProperties):
def __init__(self, name):
"""
Initialise the connection manager.
@@ -37,8 +39,17 @@ class ConnectionManager(_ConnectionManager):
dbus.service.BusName(bus_name, dbus.Bus(), do_not_queue=True),
object_path)
+ self._interfaces = set()
self._connections = set()
self._protos = {} # proto name => Connection class
+ self._protocols = {} # proto name => Protocol object
+
+ DBusProperties.__init__(self)
+ self._implement_property_get(CONN_MGR_INTERFACE, {
+ 'Interfaces': lambda: dbus.Array(self._interfaces, signature='s'),
+ 'Protocols': lambda: dbus.Dictionary(self._protocol_properties,
+ signature='sa{sv}')
+ })
def connected(self, conn):
"""
@@ -74,3 +85,10 @@ class ConnectionManager(_ConnectionManager):
conn = self._protos[proto](self, parameters)
self.connected(conn)
return (conn._name.get_name(), conn._object_path)
+
+ @property
+ def _protocol_properties(self):
+ properties = {}
+ for name, protocol in self._protocols.items():
+ properties[name] = protocol.GetAll(PROTOCOL)
+ return properties