Add a test for bug "Partially downloaded messages are received out of order" (#3688)

+ add Message.download_state property.
This commit is contained in:
iequidoo
2022-11-21 09:06:23 -03:00
committed by iequidoo
parent 36991b5c8a
commit 0b44886b62
3 changed files with 72 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ def extract_defines(flags):
| DC_KEY_GEN
| DC_IMEX
| DC_CONNECTIVITY
| DC_DOWNLOAD
) # End of prefix matching
_[\w_]+ # Match the suffix, e.g. _RSA2048 in DC_KEY_GEN_RSA2048
) # Close the capturing group, this contains

View File

@@ -461,6 +461,17 @@ class Message(object):
"""mark this message as seen."""
self.account.mark_seen_messages([self.id])
#
# Message download state
#
@property
def download_state(self):
assert self.id > 0
# load message from db to get a fresh/current state
dc_msg = ffi.gc(lib.dc_get_msg(self.account._dc_context, self.id), lib.dc_msg_unref)
return lib.dc_msg_get_download_state(dc_msg)
# some code for handling DC_MSG_* view types