aboutsummaryrefslogtreecommitdiff
path: root/context.cpp
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-07-28 10:41:54 +0300
committerlink2xt <link2xt@testrun.org>2021-08-01 16:53:15 +0300
commit9b2ce7538d28529f3c47e713779e4b0ae7b6aaf1 (patch)
tree8613a74ee1ee5b5074e91ecb9b12a8081d34ade2 /context.cpp
parent4103ae47823671eaaf52d18b10cb6aaac0ea2d0d (diff)
downloadkdeltachat-9b2ce7538d28529f3c47e713779e4b0ae7b6aaf1.tar.gz
kdeltachat-9b2ce7538d28529f3c47e713779e4b0ae7b6aaf1.zip
Add New Chat page
Diffstat (limited to 'context.cpp')
-rw-r--r--context.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/context.cpp b/context.cpp
index cf0d24f..4c9163d 100644
--- a/context.cpp
+++ b/context.cpp
@@ -62,6 +62,12 @@ Context::getChatlist(int flags)
return new DcChatlist{chatlist};
}
+uint32_t
+Context::createChatByContactId(uint32_t contactId)
+{
+ return dc_create_chat_by_contact_id(m_context, contactId);
+}
+
void
Context::setChatVisibility(uint32_t chatId, int visibility)
{
@@ -119,6 +125,19 @@ Context::getMsgIdList(uint32_t chatId) {
return result;
}
+QVariantList
+Context::getContacts(uint32_t flags, QString query)
+{
+ QVariantList result;
+ QByteArray utf8Query = query.toUtf8();
+ dc_array_t *contactsArray = dc_get_contacts(m_context, flags, utf8Query.constData());
+ for (size_t i = 0; i < dc_array_get_cnt(contactsArray); i++) {
+ result << dc_array_get_id(contactsArray, i);
+ }
+ dc_array_unref(contactsArray);
+ return result;
+}
+
int
Context::getFreshMsgCnt(uint32_t chatId) {
return dc_get_fresh_msg_cnt(m_context, chatId);