address some of flubs comments

This commit is contained in:
Simon Laux
2020-02-11 11:54:04 +01:00
committed by B. Petersen
parent ac4b2b9dfe
commit 2e8409f146
5 changed files with 21 additions and 16 deletions

View File

@@ -423,28 +423,28 @@ class Chat(object):
"""return True if this chat is archived.
:returns: True if archived.
"""
return lib.dc_chat_get_archived(self._dc_chat) == 1
return lib.dc_chat_get_archived(self._dc_chat) == const.DC_CHAT_ARCHIVE_STATE_ARCHIVED
def is_pinned(self):
"""return True if this chat is pinned.
:returns: True if pinned.
"""
return lib.dc_chat_get_archived(self._dc_chat) == 2
return lib.dc_chat_get_archived(self._dc_chat) == const.DC_CHAT_ARCHIVE_STATE_PINNED
def archive(self):
"""archive the chat.
"""
lib.dc_archive_chat(self._dc_context, self.id, 1)
lib.dc_archive_chat(self._dc_context, self.id, const.DC_CHAT_ARCHIVE_STATE_ARCHIVED)
def unarchive(self):
"""unarchive the chat.
"""
lib.dc_archive_chat(self._dc_context, self.id, 0)
lib.dc_archive_chat(self._dc_context, self.id, const.DC_CHAT_ARCHIVE_STATE_NORMAL)
def pin(self):
"""pin the chat.
"""
lib.dc_archive_chat(self._dc_context, self.id, 2)
lib.dc_archive_chat(self._dc_context, self.id, const.DC_CHAT_ARCHIVE_STATE_PINNED)
def unpin(self):
"""unpin the chat. (same as unarchive)

View File

@@ -33,6 +33,9 @@ DC_CHAT_TYPE_UNDEFINED = 0
DC_CHAT_TYPE_SINGLE = 100
DC_CHAT_TYPE_GROUP = 120
DC_CHAT_TYPE_VERIFIED_GROUP = 130
DC_CHAT_ARCHIVE_STATE_NORMAL = 0
DC_CHAT_ARCHIVE_STATE_ARCHIVED = 1
DC_CHAT_ARCHIVE_STATE_PINNED = 2
DC_MSG_ID_MARKER1 = 1
DC_MSG_ID_DAYMARKER = 9
DC_MSG_ID_LAST_SPECIAL = 9