1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Log after displaying the message

Otherwise we print the freshly received message to the window twice.
Once when receiving (and immediately printing), then logging it, and
then again when we print the last 10 log entries.

Fix https://github.com/profanity-im/profanity/issues/1305
This commit is contained in:
Michael Vetter 2020-04-08 12:21:07 +02:00
parent 2c46a56e3c
commit 444ce95aae

View File

@ -401,8 +401,8 @@ sv_ev_incoming_private_message(ProfMessage *message)
} }
_clean_incoming_message(message); _clean_incoming_message(message);
log_database_add_incoming(message);
privwin_incoming_msg(privatewin, message); privwin_incoming_msg(privatewin, message);
log_database_add_incoming(message);
chat_log_msg_in(message); chat_log_msg_in(message);
plugins_post_priv_message_display(message->jid->fulljid, message->plain); plugins_post_priv_message_display(message->jid->fulljid, message->plain);
@ -537,8 +537,8 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
if (message->plain) { if (message->plain) {
message->enc = PROF_MSG_ENC_PGP; message->enc = PROF_MSG_ENC_PGP;
_clean_incoming_message(message); _clean_incoming_message(message);
log_database_add_incoming(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
log_database_add_incoming(message);
if (logit) { if (logit) {
chat_log_pgp_msg_in(message); chat_log_pgp_msg_in(message);
} }
@ -553,8 +553,8 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
message->enc = PROF_MSG_ENC_NONE; message->enc = PROF_MSG_ENC_NONE;
message->plain = strdup(message->body); message->plain = strdup(message->body);
_clean_incoming_message(message); _clean_incoming_message(message);
log_database_add_incoming(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
log_database_add_incoming(message);
chat_log_msg_in(message); chat_log_msg_in(message);
chatwin->pgp_recv = FALSE; chatwin->pgp_recv = FALSE;
} }
@ -576,8 +576,8 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
} }
_clean_incoming_message(message); _clean_incoming_message(message);
log_database_add_incoming(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
log_database_add_incoming(message);
chat_log_otr_msg_in(message); chat_log_otr_msg_in(message);
otr_free_message(message->plain); otr_free_message(message->plain);
@ -592,8 +592,8 @@ static void
_sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit) _sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
{ {
_clean_incoming_message(message); _clean_incoming_message(message);
log_database_add_incoming(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
log_database_add_incoming(message);
if (logit) { if (logit) {
chat_log_omemo_msg_in(message); chat_log_omemo_msg_in(message);
} }
@ -608,8 +608,8 @@ _sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, ProfMessage *messa
message->enc = PROF_MSG_ENC_NONE; message->enc = PROF_MSG_ENC_NONE;
message->plain = strdup(message->body); message->plain = strdup(message->body);
_clean_incoming_message(message); _clean_incoming_message(message);
log_database_add_incoming(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
log_database_add_incoming(message);
if (logit) { if (logit) {
chat_log_msg_in(message); chat_log_msg_in(message);
} }