xep-0308: enable corrections for outgoing encrypted messages

This commit is contained in:
Michael Vetter
2020-02-12 08:54:12 +01:00
parent 38c32be14c
commit 11b6e1bfa0
8 changed files with 55 additions and 44 deletions

View File

@@ -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);