aboutsummaryrefslogtreecommitdiff
path: root/context.cpp
diff options
context:
space:
mode:
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);