Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2008-02-13 16:46:15 (GMT)
committer Morgan Collett <morgan.collett@gmail.com>2008-02-15 12:08:49 (GMT)
commit1351084b0cd16c5bb92d5689da3f11ada3c7cee6 (patch)
tree5844d781cd63ed98a2d5acb8c9221232ce82347b
parent163f3aef889cb581dbba1f02d825978655ba8f0b (diff)
add a want-to-connect signal to tp plugin so presenceservice.py can accept or decline the request according to its policy
-rw-r--r--src/presenceservice.py14
-rw-r--r--src/telepathy_plugin.py4
2 files changed, 18 insertions, 0 deletions
diff --git a/src/presenceservice.py b/src/presenceservice.py
index 02a5ba4..0c51f61 100644
--- a/src/presenceservice.py
+++ b/src/presenceservice.py
@@ -125,6 +125,7 @@ class PresenceService(ExportedGObject):
self._activity_invitation)
tp.connect('private-invitation',
self._private_invitation)
+ tp.connect('want-to-connect', self._want_to_connect)
tp.start()
self._contacts_online_queue = []
@@ -572,6 +573,19 @@ class PresenceService(ExportedGObject):
self.PrivateInvitation(str(conn.service_name), conn.object_path,
chan_path)
+ def _want_to_connect(self, plugin):
+ if plugin == self._ll_plugin:
+ # Link-local plugin can connect only if the Server plugin isn't
+ # connected
+ if not self._server_plugin or \
+ self._server_plugin.status != CONNECTION_STATUS_CONNECTED:
+ plugin.start()
+
+ elif plugin == self._server_plugin:
+ # Server plugin can always try to connect
+ plugin.start()
+
+
@dbus.service.signal(PRESENCE_INTERFACE, signature="o")
def ActivityAppeared(self, activity):
pass
diff --git a/src/telepathy_plugin.py b/src/telepathy_plugin.py
index 0fb4b05..b4581d8 100644
--- a/src/telepathy_plugin.py
+++ b/src/telepathy_plugin.py
@@ -75,6 +75,10 @@ class TelepathyPlugin(gobject.GObject):
# args:
# channel object path
(gobject.SIGNAL_RUN_FIRST, None, [object]),
+ 'want-to-connect':
+ # The TelepathyPlugin wants to connect. presenceservice.py will
+ # call the start() method if that's OK with its policy.
+ (gobject.SIGNAL_RUN_FIRST, None, []),
}
_RECONNECT_INITIAL_TIMEOUT = 5000 # 5 seconds