From f6f3e9de77e9b67dab7c2869dc94389f0252caa9 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 15 Aug 2021 12:18:52 +0000 Subject: Add Context::createContact --- context.cpp | 8 ++++++++ context.h | 1 + 2 files changed, 9 insertions(+) diff --git a/context.cpp b/context.cpp index 7c0bcc3..a4e58db 100644 --- a/context.cpp +++ b/context.cpp @@ -168,6 +168,14 @@ Context::getContact(uint32_t contactId) return new DcContact{contact}; } +uint32_t +Context::createContact(QString name, QString addr) +{ + QByteArray utf8name = name.toUtf8(); + QByteArray utf8addr = addr.toUtf8(); + return dc_create_contact(m_context, utf8name.constData(), utf8addr.constData()); +} + QString Context::getBlobdir() { diff --git a/context.h b/context.h index b3eb02f..0ae2eac 100644 --- a/context.h +++ b/context.h @@ -42,6 +42,7 @@ public: Q_INVOKABLE void markseenMsgs(QVector msg_ids); Q_INVOKABLE DcMessage *getMessage(uint32_t msgId); Q_INVOKABLE DcContact *getContact(uint32_t contactId); + Q_INVOKABLE uint32_t createContact(QString name, QString addr); Q_INVOKABLE uint32_t sendTextMessage(uint32_t chatId, QString textToSend); Q_INVOKABLE void setDraft(uint32_t chatId, DcMessage *message); Q_INVOKABLE DcMessage *getDraft(uint32_t chatId); -- cgit v1.2.3-54-g00ecf