+ if self._status != telepathy.CONNECTION_STATUS_DISCONNECTED:
+ _moduleLogger.info("Attempting connect when not disconnected")
+ return
+ _moduleLogger.info("Kicking off connect")
+ self._delayedConnect.start()
+ self._timedDisconnect.stop()
+
+ @misc_utils.log_exception(_moduleLogger)
+ def _delayed_connect(self):
+ _moduleLogger.info("Connecting...")
+ self.StatusChanged(
+ telepathy.CONNECTION_STATUS_CONNECTING,
+ telepathy.CONNECTION_STATUS_REASON_REQUESTED
+ )
+ try:
+ self.__session.load(self.__cachePath)
+
+ for plumber in self._plumbing:
+ plumber.start()
+ self.session.login(*self.__credentials)
+ if not self.__callbackNumberParameter:
+ callback = gvoice.backend.get_sane_callback(
+ self.session.backend
+ )
+ self.__callbackNumberParameter = misc_utils.normalize_number(callback)
+ self.session.backend.set_callback_number(self.__callbackNumberParameter)
+
+ subscribeHandle = self.get_handle_by_name(telepathy.HANDLE_TYPE_LIST, "subscribe")
+ subscribeProps = self.generate_props(telepathy.CHANNEL_TYPE_CONTACT_LIST, subscribeHandle, False)
+ self.__channelManager.channel_for_props(subscribeProps, signal=True)
+ publishHandle = self.get_handle_by_name(telepathy.HANDLE_TYPE_LIST, "publish")
+ publishProps = self.generate_props(telepathy.CHANNEL_TYPE_CONTACT_LIST, publishHandle, False)
+ self.__channelManager.channel_for_props(publishProps, signal=True)
+ except gvoice.backend.NetworkError:
+ _moduleLogger.exception("Connection Failed")
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR)
+ return
+ except Exception:
+ _moduleLogger.exception("Connection Failed")
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED)
+ return