expose obtaining list of fresh messages to python

This commit is contained in:
holger krekel
2020-04-21 13:52:05 +02:00
parent 7846c23edd
commit 7c33c7f7da
2 changed files with 15 additions and 0 deletions

View File

@@ -273,6 +273,14 @@ class Account(object):
)
return list(iter_array(dc_array, lambda x: Contact(self, x)))
def get_fresh_messages(self):
""" yield all fresh messages from all chats. """
dc_array = ffi.gc(
lib.dc_get_fresh_msgs(self._dc_context),
lib.dc_array_unref
)
yield from iter_array(dc_array, lambda x: Message.from_db(self, x))
def create_chat_by_contact(self, contact):
""" create or get an existing 1:1 chat object for the specified contact or contact id.