aboutsummaryrefslogtreecommitdiff
path: root/context.cpp
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2021-11-20 13:07:17 +0100
committerMiquel Lionel <lionel@les-miquelots.net>2021-11-20 13:15:21 +0100
commitb51a3e81dd2178c681226458ca4bb73ae98a5e34 (patch)
tree5a46cd966b7d3cbb7ae10664b367ed62da170858 /context.cpp
parent3a23720bd8390fc96efdccfe65f27389672155c4 (diff)
downloadkdeltachat-b51a3e81dd2178c681226458ca4bb73ae98a5e34.tar.gz
kdeltachat-b51a3e81dd2178c681226458ca4bb73ae98a5e34.zip
You can unblock people now and some small fixes
- the chatlist is now properly updated on blocking a contact request or contact. - A small message is now displayed after blocking a contact request - A list of blocked contact can be found on the settings page, after clicking 'View blocked users' - The message timestamp is now slightly padded
Diffstat (limited to 'context.cpp')
-rw-r--r--context.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/context.cpp b/context.cpp
index 59d8211..11372d0 100644
--- a/context.cpp
+++ b/context.cpp
@@ -100,6 +100,34 @@ Context::acceptChat(uint32_t chatId)
dc_accept_chat(m_context, chatId);
}
+void
+Context::blockContact(uint32_t contactId, uint32_t blockMode)
+{
+ dc_block_contact(m_context, contactId, blockMode);
+}
+
+QVariantMap
+Context::getBlockedContacts()
+{
+ QVariantMap blockList;
+ uint32_t CID;
+ char *addr;
+ dc_contact_t *contact;
+ dc_array_t *blockedContacts = dc_get_blocked_contacts(m_context);
+ size_t max = dc_array_get_cnt(blockedContacts);
+
+ for (size_t i = 0; i < max; i++) {
+ CID = dc_array_get_id(blockedContacts, i);
+ contact = dc_get_contact(m_context, CID);
+ addr = dc_contact_get_addr(contact);
+ blockList.insert(addr, CID);
+ dc_contact_unref(contact);
+ dc_str_unref(addr);
+ }
+ dc_array_unref(blockedContacts);
+ return blockList;
+}
+
QString
Context::getChatEncrinfo(uint32_t chatId)
{