- self.check_connected()
- self.check_handle_type(handleType)
-
- handles = []
- for name in names:
- name = name.encode('utf-8')
- if handleType == telepathy.HANDLE_TYPE_CONTACT:
- h = self._create_contact_handle(name)
- elif handleType == telepathy.HANDLE_TYPE_LIST:
- h = handle.create_handle(self, 'list', name)
- elif handleType == telepathy.HANDLE_TYPE_GROUP:
- h = handle.create_handle(self, 'group', name)
- else:
- raise telepathy.NotAvailable('Handle type unsupported %d' % handleType)
- handles.append(h.id)
- self.add_client_handle(handle, sender)
- return handles
-
- def _create_contact_handle(self, name):
- requestedContactId = name
-
- contacts = self._backend.get_contacts()
- contactsFound = [
- (contactId, contactName) for (contactId, contactName) in contacts
- if contactId == requestedContactId
- ]
-
- if 0 < len(contactsFound):
- contactId, contactName = contactsFound[0]
- if len(contactsFound) != 1:
- _moduleLogger.error("Contact ID was not unique: %s for %s" % (contactId, contactName))
- else:
- contactId, contactName = requestedContactId, ""
- h = handle.create_handle(self, 'contact', contactId, contactName)
+ 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")