- def _create_contact_handle(self, name):
- requestedContactId, requestedContactName = handle.field_split(name)
-
- contacts = self._backend.get_contacts()
- contactsFound = [
- (contactId, contactName) for (contactId, contactName) in contacts
- if contactName == name
- ]
-
- if 0 < len(contactsFound):
- contactId, contactName = contactsFound[0]
- h = handle.create_handle(self, 'contact', contactId, contactName)
- else:
- h = handle.create_handle(self, 'contact', requestedContactId, requestedContactName)
+ def _create_contact_handle(self, requestedHandleName):
+ requestedContactId, requestedContactNumber = handle.ContactHandle.from_handle_name(
+ requestedHandleName
+ )
+ h = handle.create_handle(self, 'contact', requestedContactId, requestedContactNumber)
+ return h
+
+ @gobject_utils.async
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_conversations_updated(self, conv, conversationIds):
+ # @todo get conversations update running
+ # @todo test conversatiuons
+ _moduleLogger.info("Incoming messages from: %r" % (conversationIds, ))
+ channelManager = self._channelManager
+ 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
+ channel = channelManager.channel_for_text(h)