Add prof_message_t to wrap all message attributes
Probably missing copy of body to plain in carbon and privmessage. Only covers the incoming message path because goal is OMEMO decryption of untrusted message. Cover some of the log functions but not all.
This commit is contained in:
@@ -143,14 +143,14 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (chatwin->pgp_send) {
|
||||
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
|
||||
@@ -188,12 +188,12 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (chatwin->pgp_send) {
|
||||
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
|
||||
@@ -211,12 +211,12 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (chatwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
|
||||
@@ -234,14 +234,14 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (chatwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt);
|
||||
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);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
}
|
||||
@@ -260,17 +260,17 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (chatwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt);
|
||||
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);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
|
||||
@@ -288,19 +288,19 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
if (chatwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt);
|
||||
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);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifndef HAVE_OMEMO
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
|
||||
plugins_post_chat_message_send(chatwin->barejid, plugin_msg);
|
||||
@@ -341,12 +341,12 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
|
||||
if (mucwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE);
|
||||
groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_OMEMO);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_ENC_OMEMO);
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
groupchat_log_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_ENC_PLAIN);
|
||||
free(id);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
|
||||
#ifndef HAVE_OMEMO
|
||||
char *id = message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
groupchat_log_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_ENC_PLAIN);
|
||||
free(id);
|
||||
|
||||
plugins_post_room_message_send(mucwin->roomjid, plugin_msg);
|
||||
|
||||
Reference in New Issue
Block a user