mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
api: add legacy Python bindings for make_vcard and import_vcard
This commit is contained in:
@@ -368,6 +368,11 @@ class Account:
|
||||
dc_array = ffi.gc(lib.dc_get_contacts(self._dc_context, flags, query_c), lib.dc_array_unref)
|
||||
return list(iter_array(dc_array, lambda x: Contact(self, x)))
|
||||
|
||||
def import_vcard(self, vcard):
|
||||
"""Import a vCard and return an array of contacts."""
|
||||
dc_array = ffi.gc(lib.dc_import_vcard(self._dc_context, as_dc_charpointer(vcard)), lib.dc_array_unref)
|
||||
return list(iter_array(dc_array, lambda x: Contact(self, x)))
|
||||
|
||||
def get_fresh_messages(self) -> Generator[Message, None, None]:
|
||||
"""yield all fresh messages from all chats."""
|
||||
dc_array = ffi.gc(lib.dc_get_fresh_msgs(self._dc_context), lib.dc_array_unref)
|
||||
|
||||
@@ -90,6 +90,14 @@ class Contact:
|
||||
dc_res = lib.dc_contact_get_profile_image(self._dc_contact)
|
||||
return from_optional_dc_charpointer(dc_res)
|
||||
|
||||
def make_vcard(self) -> str:
|
||||
"""Make a contact vCard.
|
||||
|
||||
:returns: vCard
|
||||
"""
|
||||
dc_context = self.account._dc_context
|
||||
return from_dc_charpointer(lib.dc_make_vcard(dc_context, self.id))
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""Get contact status.
|
||||
|
||||
Reference in New Issue
Block a user