From a441a4ae1223e745c41ad7b9a111ad4401125d16 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 5 Nov 2020 23:28:54 +0300 Subject: Implement Context.getConfig() --- context.cpp | 10 ++++++++++ context.h | 1 + 2 files changed, 11 insertions(+) diff --git a/context.cpp b/context.cpp index ad5c2c9..1e44f7e 100644 --- a/context.cpp +++ b/context.cpp @@ -85,6 +85,16 @@ Context::getBlobdir() return result; } +QString +Context::getConfig(QString key) +{ + QByteArray utf8Key = key.toUtf8(); + char *value = dc_get_config(m_context, utf8Key.constData()); + QString result{value}; + dc_str_unref(value); + return result; +} + QString Context::getMessageInfo(uint32_t msgId) { diff --git a/context.h b/context.h index c063709..98c4196 100644 --- a/context.h +++ b/context.h @@ -29,6 +29,7 @@ public: Q_INVOKABLE DcContact *getContact(uint32_t contactId); Q_INVOKABLE uint32_t sendTextMessage(uint32_t chatId, QString textToSend); QString getBlobdir(); + Q_INVOKABLE QString getConfig(QString key); Q_INVOKABLE QString getMessageInfo(uint32_t msgId); private: -- cgit v1.2.3-70-g09d2