From 88d351d4a271fa13f5ca43be01ab14267f04366a Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 1 Mar 2021 00:21:55 +0300 Subject: Implement more context methods --- context.cpp | 27 +++++++++++++++++++++++++++ context.h | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/context.cpp b/context.cpp index 9c1ac94..6a7148a 100644 --- a/context.cpp +++ b/context.cpp @@ -62,6 +62,33 @@ Context::getChatlist() return new DcChatlist{chatlist}; } +void +Context::setChatVisibility(uint32_t chatId, int visibility) +{ + dc_set_chat_visibility(m_context, chatId, visibility); +} + +void +Context::deleteChat(uint32_t chatId) +{ + dc_delete_chat(m_context, chatId); +} + +QString +Context::getChatEncrinfo(uint32_t chatId) +{ + char *encrinfo = dc_get_chat_encrinfo(m_context, chatId); + QString result{encrinfo}; + dc_str_unref(encrinfo); + return result; +} + +uint32_t +Context::getChatEphemeralTimer(uint32_t chatId) +{ + return dc_get_chat_ephemeral_timer(m_context, chatId); +} + DcChat * Context::getChat(uint32_t chatId) { diff --git a/context.h b/context.h index c62529e..c8d9691 100644 --- a/context.h +++ b/context.h @@ -26,6 +26,10 @@ public: Q_INVOKABLE void stopIo(); Q_INVOKABLE void maybeNetwork(); Q_INVOKABLE DcChatlist *getChatlist(); + Q_INVOKABLE void setChatVisibility(uint32_t chatId, int visibility); + Q_INVOKABLE void deleteChat(uint32_t chatId); + Q_INVOKABLE QString getChatEncrinfo(uint32_t chatId); + Q_INVOKABLE uint32_t getChatEphemeralTimer(uint32_t chatId); Q_INVOKABLE DcChat *getChat(uint32_t chatId); Q_INVOKABLE QVariantList getMsgIdList(uint32_t chatId); Q_INVOKABLE int getFreshMsgCnt(uint32_t chatId); -- cgit v1.2.3-70-g09d2