mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
adapt python bindings
This commit is contained in:
@@ -423,33 +423,7 @@ class Chat(object):
|
|||||||
"""return True if this chat is archived.
|
"""return True if this chat is archived.
|
||||||
:returns: True if archived.
|
:returns: True if archived.
|
||||||
"""
|
"""
|
||||||
return lib.dc_chat_get_archived(self._dc_chat) == const.DC_CHAT_ARCHIVE_STATE_ARCHIVED
|
return lib.dc_chat_get_visibility(self._dc_chat) == const.DC_CHAT_VISIBILITY_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) == const.DC_CHAT_ARCHIVE_STATE_PINNED
|
|
||||||
|
|
||||||
def archive(self):
|
|
||||||
"""archive the chat.
|
|
||||||
"""
|
|
||||||
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, const.DC_CHAT_ARCHIVE_STATE_NORMAL)
|
|
||||||
|
|
||||||
def pin(self):
|
|
||||||
"""pin the chat.
|
|
||||||
"""
|
|
||||||
lib.dc_archive_chat(self._dc_context, self.id, const.DC_CHAT_ARCHIVE_STATE_PINNED)
|
|
||||||
|
|
||||||
def unpin(self):
|
|
||||||
"""unpin the chat. (same as unarchive)
|
|
||||||
"""
|
|
||||||
self.unarchive()
|
|
||||||
|
|
||||||
def enable_sending_locations(self, seconds):
|
def enable_sending_locations(self, seconds):
|
||||||
"""enable sending locations for this chat.
|
"""enable sending locations for this chat.
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ DC_CHAT_TYPE_UNDEFINED = 0
|
|||||||
DC_CHAT_TYPE_SINGLE = 100
|
DC_CHAT_TYPE_SINGLE = 100
|
||||||
DC_CHAT_TYPE_GROUP = 120
|
DC_CHAT_TYPE_GROUP = 120
|
||||||
DC_CHAT_TYPE_VERIFIED_GROUP = 130
|
DC_CHAT_TYPE_VERIFIED_GROUP = 130
|
||||||
DC_CHAT_ARCHIVE_STATE_NORMAL = 0
|
DC_CHAT_VISIBILITY_NORMAL = 0
|
||||||
DC_CHAT_ARCHIVE_STATE_ARCHIVED = 1
|
DC_CHAT_VISIBILITY_ARCHIVED = 1
|
||||||
DC_CHAT_ARCHIVE_STATE_PINNED = 2
|
DC_CHAT_VISIBILITY_PINNED = 2
|
||||||
DC_MSG_ID_MARKER1 = 1
|
DC_MSG_ID_MARKER1 = 1
|
||||||
DC_MSG_ID_DAYMARKER = 9
|
DC_MSG_ID_DAYMARKER = 9
|
||||||
DC_MSG_ID_LAST_SPECIAL = 9
|
DC_MSG_ID_LAST_SPECIAL = 9
|
||||||
|
|||||||
@@ -426,17 +426,6 @@ class TestOfflineChat:
|
|||||||
chat.remove_contact(contacts[3])
|
chat.remove_contact(contacts[3])
|
||||||
assert len(chat.get_contacts()) == 9
|
assert len(chat.get_contacts()) == 9
|
||||||
|
|
||||||
def test_archive_and_pin_chat(self, ac1):
|
|
||||||
chat = ac1.create_group_chat(name="title1")
|
|
||||||
|
|
||||||
assert not chat.is_archived()
|
|
||||||
chat.archive()
|
|
||||||
assert chat.is_archived()
|
|
||||||
chat.unarchive()
|
|
||||||
assert not chat.is_archived()
|
|
||||||
chat.pin()
|
|
||||||
assert chat.is_pinned()
|
|
||||||
|
|
||||||
|
|
||||||
class TestOnlineAccount:
|
class TestOnlineAccount:
|
||||||
@pytest.mark.ignored
|
@pytest.mark.ignored
|
||||||
|
|||||||
Reference in New Issue
Block a user