introduce chat.num_contacts() as a more efficient shortcut

This commit is contained in:
holger krekel
2020-06-09 09:40:20 +02:00
parent f93a863f5f
commit 0bb4ef0bd9
2 changed files with 18 additions and 14 deletions

View File

@@ -368,6 +368,14 @@ class Chat(object):
dc_array, lambda id: Contact(self.account, id))
)
def num_contacts(self):
""" return number of contacts in this chat. """
dc_array = ffi.gc(
lib.dc_get_chat_contacts(self.account._dc_context, self.id),
lib.dc_array_unref
)
return lib.dc_array_get_cnt(dc_array)
def set_profile_image(self, img_path):
"""Set group profile image.