diff options
-rw-r--r-- | context.cpp | 9 | ||||
-rw-r--r-- | context.h | 1 | ||||
-rw-r--r-- | message.cpp | 39 | ||||
-rw-r--r-- | message.h | 9 |
4 files changed, 56 insertions, 2 deletions
diff --git a/context.cpp b/context.cpp index 89a7937..e7742f6 100644 --- a/context.cpp +++ b/context.cpp @@ -173,6 +173,15 @@ Context::getMessageInfo(uint32_t msgId) return result; } +QString +Context::getMessageHtml(uint32_t msgId) +{ + char *html = dc_get_msg_html(m_context, msgId); + QString result{html}; + dc_str_unref(html); + return result; +} + uint32_t Context::sendTextMessage(uint32_t chatId, QString textToSend) { @@ -44,6 +44,7 @@ public: Q_INVOKABLE QString getConfig(QString key); Q_INVOKABLE bool setChatMuteDuration(uint32_t chatId, int64_t duration); Q_INVOKABLE QString getMessageInfo(uint32_t msgId); + Q_INVOKABLE QString getMessageHtml(uint32_t msgId); Q_INVOKABLE uint32_t decideOnContactRequest(uint32_t msgId, int decision); private: diff --git a/message.cpp b/message.cpp index ff4bab9..cf29dae 100644 --- a/message.cpp +++ b/message.cpp @@ -56,6 +56,15 @@ DcMessage::getText() } QString +DcMessage::getSubject() +{ + char *subject = dc_msg_get_subject(m_message); + QString result{subject}; + dc_str_unref(subject); + return result; +} + +QString DcMessage::getFile() { char *file = dc_msg_get_file(m_message); @@ -73,6 +82,15 @@ DcMessage::getFilename() return result; } +QString +DcMessage::getFilemime() +{ + char *filemime = dc_msg_get_filemime(m_message); + QString result{filemime}; + dc_str_unref(filemime); + return result; +} + int DcMessage::getWidth() { @@ -85,6 +103,12 @@ DcMessage::getHeight() return dc_msg_get_height(m_message); } +bool +DcMessage::getShowPadlock() +{ + return dc_msg_get_showpadlock(m_message); +} + QString DcMessage::getOverrideSenderName() { @@ -101,6 +125,21 @@ DcMessage::isInfo() } QString +DcMessage::getError() +{ + char *error = dc_msg_get_error(m_message); + QString result{error}; + dc_str_unref(error); + return result; +} + +bool +DcMessage::hasHtml() +{ + return dc_msg_has_html(m_message); +} + +QString DcMessage::getQuotedText() { char *text = dc_msg_get_quoted_text(m_message); @@ -12,6 +12,7 @@ class DcMessage : public QObject { Q_PROPERTY(int viewtype READ getViewtype CONSTANT) Q_PROPERTY(int state READ getState CONSTANT) Q_PROPERTY(QString text READ getText CONSTANT) + Q_PROPERTY(QString subject READ getSubject CONSTANT) Q_PROPERTY(QString file READ getFile CONSTANT) Q_PROPERTY(QString filename READ getFilename CONSTANT) Q_PROPERTY(int width READ getWidth CONSTANT) @@ -19,6 +20,7 @@ class DcMessage : public QObject { Q_PROPERTY(bool isInfo READ isInfo CONSTANT) Q_PROPERTY(QString quotedText READ getQuotedText CONSTANT) Q_PROPERTY(DcMessage *quotedMessage READ getQuotedMessage CONSTANT) + Q_PROPERTY(bool hasHtml READ hasHtml CONSTANT) dc_msg_t *m_message{nullptr}; public: @@ -35,14 +37,15 @@ public: //Q_INVOKABLE int64_t getReceivedTimestamp(); //Q_INVOKABLE int64_t getSortTimestamp(); Q_INVOKABLE QString getText(); + Q_INVOKABLE QString getSubject(); QString getFile(); QString getFilename(); - //QString getFilemime(); + QString getFilemime(); //uint64_t getFilebytes(); int getWidth(); int getHeight(); //int getDuration(); - //bool showPadlock(); + bool getShowPadlock(); //uint32_t getEphemeralTimer(); //int64_t getEphemeralTimestamp(); //... getsummary ... @@ -53,6 +56,8 @@ public: //isStarred //isForwarded bool isInfo(); + Q_INVOKABLE QString getError(); + bool hasHtml(); //isIncreation //isSetupmessage Q_INVOKABLE QString getQuotedText(); |