diff options
-rw-r--r-- | context.cpp | 6 | ||||
-rw-r--r-- | context.h | 1 | ||||
-rw-r--r-- | qml/ComposePane.qml | 7 |
3 files changed, 13 insertions, 1 deletions
diff --git a/context.cpp b/context.cpp index 4c9163d..7c0bcc3 100644 --- a/context.cpp +++ b/context.cpp @@ -250,6 +250,12 @@ Context::newMessage(int viewtype) return new DcMessage{message}; } +uint32_t +Context::sendMessage(uint32_t chatId, DcMessage *message) +{ + return dc_send_msg(m_context, chatId, message->m_message); +} + void Context::importBackup(QString tarfile) { @@ -52,6 +52,7 @@ public: Q_INVOKABLE QString getMessageInfo(uint32_t msgId); Q_INVOKABLE QString getMessageHtml(uint32_t msgId); Q_INVOKABLE DcMessage *newMessage(int viewtype); + Q_INVOKABLE uint32_t sendMessage(uint32_t chatId, DcMessage *message); Q_INVOKABLE void importBackup(QString tarfile); private: diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml index 5ba77f5..dab07f1 100644 --- a/qml/ComposePane.qml +++ b/qml/ComposePane.qml @@ -48,7 +48,12 @@ Pane { text: qsTr("Send") enabled: messageField.length > 0 onClicked: { - root.context.sendTextMessage(chatId, messageField.text) + let DC_MSG_TEXT = 10; + + let msg = root.context.newMessage(DC_MSG_TEXT); + msg.setText(messageField.text) + root.context.sendMessage(root.chatId, msg) + messageField.text = "" root.context.setDraft(chatId, null) } |