- 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
+
+ @coroutines.func_sink
+ @coroutines.expand_positional
+ @gobject_utils.async
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_conversations_updated(self, 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 = self._create_contact_handle(contactId, phoneNumber)
+ # if its new, __init__ will take care of things
+ # if its old, its own update will take care of it
+ channel = channelManager.channel_for_text(handle)