contact: use last_seen column

It was there since the C core, labeled with "/* last_seen is for
future use */" but never actually used. The comment was lost during
the translation from C to Rust.
This commit is contained in:
link2xt
2021-11-21 12:14:11 +00:00
parent ddefd2cf09
commit 5c571520a0
5 changed files with 104 additions and 9 deletions

View File

@@ -1,12 +1,13 @@
""" Contact object. """
from . import props
from .cutil import from_dc_charpointer, from_optional_dc_charpointer
from .capi import lib, ffi
from .chat import Chat
from . import const
from datetime import date, datetime, timezone
from typing import Optional
from . import const, props
from .capi import ffi, lib
from .chat import Chat
from .cutil import from_dc_charpointer, from_optional_dc_charpointer
class Contact(object):
""" Delta-Chat Contact.
@@ -48,6 +49,13 @@ class Contact(object):
# deprecated alias
display_name = name
@props.with_doc
def last_seen(self) -> date:
"""Last seen timestamp."""
return datetime.fromtimestamp(
lib.dc_contact_get_last_seen(self._dc_contact), timezone.utc
)
def is_blocked(self):
""" Return True if the contact is blocked. """
return lib.dc_contact_is_blocked(self._dc_contact)