mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
make Message.id a property
This commit is contained in:
@@ -21,8 +21,8 @@ class Message(object):
|
|||||||
assert isinstance(dc_msg, ffi.CData)
|
assert isinstance(dc_msg, ffi.CData)
|
||||||
assert dc_msg != ffi.NULL
|
assert dc_msg != ffi.NULL
|
||||||
self._dc_msg = dc_msg
|
self._dc_msg = dc_msg
|
||||||
self.id = lib.dc_msg_get_id(dc_msg)
|
msg_id = self.id
|
||||||
assert self.id is not None and self.id >= 0, repr(self.id)
|
assert msg_id is not None and msg_id >= 0, repr(msg_id)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.account == other.account and self.id == other.id
|
return self.account == other.account and self.id == other.id
|
||||||
@@ -72,6 +72,11 @@ class Message(object):
|
|||||||
self._dc_msg = ffi.gc(lib.dc_get_msg(ctx, self.id), lib.dc_msg_unref)
|
self._dc_msg = ffi.gc(lib.dc_get_msg(ctx, self.id), lib.dc_msg_unref)
|
||||||
return Chat(self.account, chat_id)
|
return Chat(self.account, chat_id)
|
||||||
|
|
||||||
|
@props.with_doc
|
||||||
|
def id(self):
|
||||||
|
"""id of this message. """
|
||||||
|
return lib.dc_msg_get_id(self._dc_msg)
|
||||||
|
|
||||||
@props.with_doc
|
@props.with_doc
|
||||||
def text(self):
|
def text(self):
|
||||||
"""unicode text of this messages (might be empty if not a text message). """
|
"""unicode text of this messages (might be empty if not a text message). """
|
||||||
|
|||||||
Reference in New Issue
Block a user