From 11b6e1bfa07fba1028a6ef31a336ad5856fc5801 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 12 Feb 2020 08:54:12 +0100 Subject: xep-0308: enable corrections for outgoing encrypted messages --- src/otr/otr.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/otr/otr.c') 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); -- cgit 1.4.1-2-gfad0