about summary refs log tree commit diff stats
path: root/src/otr/otr.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-12 08:54:12 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-12 08:54:12 +0100
commit11b6e1bfa07fba1028a6ef31a336ad5856fc5801 (patch)
treed1b9f3ae89bff9d6ed998d31b0de804f932b5263 /src/otr/otr.c
parent38c32be14cb6b985a0c3982d5fef7127c7dbbaa7 (diff)
downloadprofani-tty-11b6e1bfa07fba1028a6ef31a336ad5856fc5801.tar.gz
xep-0308: enable corrections for outgoing encrypted messages
Diffstat (limited to 'src/otr/otr.c')
-rw-r--r--src/otr/otr.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c
index bd88ae0b..5ce34758 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -118,7 +118,7 @@ static void
 cb_inject_message(void *opdata, const char *accountname,
     const char *protocol, const char *recipient, const char *message)
 {
-    char *id = message_send_chat_otr(recipient, message, FALSE);
+    char *id = message_send_chat_otr(recipient, message, FALSE, NULL);
     free(id);
 }
 
@@ -315,7 +315,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
                 memmove(whitespace_base, whitespace_base+tag_length, tag_length);
                 char *otr_query_message = otr_start_query();
                 cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
-                char *id = message_send_chat_otr(barejid, otr_query_message, FALSE);
+                char *id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
                 free(id);
             }
         }
@@ -329,7 +329,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
     if (policy == PROF_OTRPOLICY_ALWAYS && *decrypted == FALSE && !whitespace_base) {
         char *otr_query_message = otr_start_query();
         cons_show("Attempting to start OTR session...");
-        char *id = message_send_chat_otr(barejid, otr_query_message, FALSE);
+        char *id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
         free(id);
     }
 
@@ -337,7 +337,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
 }
 
 gboolean
-otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt)
+otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt, const char *const replace_id)
 {
     char *id = NULL;
     prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid);
@@ -346,10 +346,9 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
     if (otr_is_secure(chatwin->barejid)) {
         char *encrypted = otr_encrypt_message(chatwin->barejid, message);
         if (encrypted) {
-            id = message_send_chat_otr(chatwin->barejid, encrypted, request_receipt);
+            id = message_send_chat_otr(chatwin->barejid, encrypted, request_receipt, replace_id);
             chat_log_otr_msg_out(chatwin->barejid, message, NULL);
-            // TODO replace_id
-            chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_OTR, request_receipt, NULL);
+            chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_OTR, request_receipt, replace_id);
             otr_free_message(encrypted);
             free(id);
             return TRUE;
@@ -368,9 +367,8 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
     // tag and send for policy opportunistic
     if (policy == PROF_OTRPOLICY_OPPORTUNISTIC) {
         char *otr_tagged_msg = otr_tag_message(message);
-        id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg, request_receipt);
-        //TODO replace_id
-        chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_PLAIN, request_receipt, NULL);
+        id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg, request_receipt, replace_id);
+        chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_PLAIN, request_receipt, replace_id);
         chat_log_msg_out(chatwin->barejid, message, NULL);
         free(otr_tagged_msg);
         free(id);