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

@@ -149,13 +149,12 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME
#ifndef HAVE_OMEMO
if (chatwin->pgp_send) {
// TODO: replace_id
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id);
} else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@@ -175,7 +174,7 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBOTR
#ifndef HAVE_LIBGPGME
#ifndef HAVE_OMEMO
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@@ -195,9 +194,9 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME
#ifndef HAVE_OMEMO
if (chatwin->pgp_send) {
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id);
} else {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
@@ -218,7 +217,7 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifndef HAVE_LIBGPGME
#ifdef HAVE_OMEMO
if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
free(id);
@@ -241,12 +240,12 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifndef HAVE_LIBGPGME
#ifdef HAVE_OMEMO
if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
free(id);
} else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@@ -267,19 +266,19 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME
#ifdef HAVE_OMEMO
if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
free(id);
} else if (chatwin->pgp_send) {
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id);
} else {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt, replace_id);
free(id);
}
@@ -295,17 +294,17 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifdef HAVE_LIBGPGME
#ifdef HAVE_OMEMO
if (chatwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE, replace_id);
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt, replace_id);
free(id);
} else if (chatwin->pgp_send) {
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt, replace_id);
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt, replace_id);
free(id);
} else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt, replace_id);
if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
@@ -325,9 +324,9 @@ cl_ev_send_msg_correct(ProfChatWin *chatwin, const char *const msg, const char *
#ifndef HAVE_LIBOTR
#ifndef HAVE_LIBGPGME
#ifndef HAVE_OMEMO
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt, replace_id);
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt, replace_id);
free(id);
plugins_post_chat_message_send(chatwin->barejid, plugin_msg);
@@ -354,7 +353,8 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
#ifdef HAVE_OMEMO
if (mucwin->is_omemo) {
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE);
// TODO: replace_id for MUC
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE, NULL);
groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg);
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_ENC_OMEMO);
free(id);