+ self.__session.load(self.__cachePath)
+
+ for plumber in self._plumbing:
+ plumber.start()
+ 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 Exception:
+ _moduleLogger.exception("Setup failed")
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED)
+ return
+
+ _moduleLogger.info("Connected and set up")
+ self.StatusChanged(
+ telepathy.CONNECTION_STATUS_CONNECTED,
+ telepathy.CONNECTION_STATUS_REASON_REQUESTED
+ )
+
+ @misc_utils.log_exception(_moduleLogger)
+ def _on_login_error(self, error):
+ _moduleLogger.error(error)
+ if isinstance(error, gvoice.backend.NetworkError):
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR)
+ else:
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED)