diff options
Diffstat (limited to 'src/telepathy_plugin.py')
-rw-r--r-- | src/telepathy_plugin.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/telepathy_plugin.py b/src/telepathy_plugin.py index c486884..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 @@ -163,9 +167,6 @@ class TelepathyPlugin(gobject.GObject): """ raise NotImplementedError - def start(self): - raise NotImplementedError - def suggest_room_for_activity(self, activity_id): """Suggest a room to use to share the given activity. """ @@ -340,6 +341,7 @@ class TelepathyPlugin(gobject.GObject): self._backoff_id = 0 self._ip4am.disconnect(self._ip4am_sigid) + self._ip4am_sigid = 0 def _contacts_offline(self, handles): """Handle contacts going offline (send message, update set)""" @@ -544,6 +546,11 @@ class TelepathyPlugin(gobject.GObject): otherwise initiate a connection and transfer control to _connect_reply_cb or _connect_error_cb """ + + if self._ip4am_sigid == 0: + self._ip4am_sigid = self._ip4am.connect('address-changed', + self._ip4_address_changed_cb) + if self._conn is not None: return @@ -555,7 +562,7 @@ class TelepathyPlugin(gobject.GObject): else: _logger.debug('%r: Postponing connection', self) - def _ip4_address_changed_cb(self, ip4am, address): + def _ip4_address_changed_cb(self, ip4am, address, iface): _logger.debug("::: IP4 address now %s", address) self._reconnect_timeout = self._RECONNECT_INITIAL_TIMEOUT |