- if 0 < len(contactsFound):
- contactId = contactsFound[0]
- if len(contactsFound) != 1:
- _moduleLogger.error("Contact ID was not unique: %s for %s" % (contactId, ))
- else:
- contactId = requestedContactId
- h = handle.create_handle(self, 'contact', contactId)
+ return props
+
+ def _disconnect(self):
+ _moduleLogger.info("Disconnecting")
+ self.session.voicemails.updateSignalHandler.unregister_sink(
+ self.__callback
+ )
+ self.session.texts.updateSignalHandler.unregister_sink(
+ self.__callback
+ )
+ self.__callback = None
+
+ self.__channelManager.close()
+ self.session.logout()
+ self.session.close()
+ self.__session = None
+ if self.__connection is not None:
+ self.__connection.disconnect(self.__connectionEventId)
+ self.__connectionEventId = None
+
+ self.manager.disconnected(self)
+ _moduleLogger.info("Disconnected")
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_conversations_updated(self, conv, conversationIds):
+ _moduleLogger.debug("Incoming messages from: %r" % (conversationIds, ))
+ for contactId, phoneNumber in conversationIds:
+ h = handle.create_handle(self, 'contact', contactId, phoneNumber)
+ # Just let the TextChannel decide whether it should be reported to the user or not
+ props = self._generate_props(telepathy.CHANNEL_TYPE_TEXT, h, False)
+ channel = self.__channelManager.channel_for_props(props, signal=True)
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_connection_change(self, connection, event):
+ """
+ @note Maemo specific
+ """
+ status = event.get_status()
+ error = event.get_error()
+ iap_id = event.get_iap_id()
+ bearer = event.get_bearer_type()
+
+ if status == conic.STATUS_DISCONNECTED:
+ _moduleLogger.info("Disconnecting due to loss of network connection")
+ self.StatusChanged(
+ telepathy.CONNECTION_STATUS_DISCONNECTED,
+ telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR
+ )
+ try:
+ self._disconnect()
+ except Exception:
+ _moduleLogger.exception("Error durring disconnect")