about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-08 12:21:07 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-04-08 12:21:07 +0200
commit444ce95aaee57590d3b051abb943ad5faf0c1edd (patch)
treef11c92a54878132de13e25e6cd4948285c69ca8f /src/event
parent2c46a56e3ca3bd7bde97acca5ce486495d404339 (diff)
downloadprofani-tty-444ce95aaee57590d3b051abb943ad5faf0c1edd.tar.gz
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
Diffstat (limited to 'src/event')
-rw-r--r--src/event/server_events.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index b63af3b6..7a09aaa6 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -401,8 +401,8 @@ sv_ev_incoming_private_message(ProfMessage *message)
     }
 
     _clean_incoming_message(message);
-    log_database_add_incoming(message);
     privwin_incoming_msg(privatewin, message);
+    log_database_add_incoming(message);
     chat_log_msg_in(message);
 
     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) {
         message->enc = PROF_MSG_ENC_PGP;
         _clean_incoming_message(message);
-        log_database_add_incoming(message);
         chatwin_incoming_msg(chatwin, message, new_win);
+        log_database_add_incoming(message);
         if (logit) {
             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->plain = strdup(message->body);
         _clean_incoming_message(message);
-        log_database_add_incoming(message);
         chatwin_incoming_msg(chatwin, message, new_win);
+        log_database_add_incoming(message);
         chat_log_msg_in(message);
         chatwin->pgp_recv = FALSE;
     }
@@ -576,8 +576,8 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
         }
 
         _clean_incoming_message(message);
-        log_database_add_incoming(message);
         chatwin_incoming_msg(chatwin, message, new_win);
+        log_database_add_incoming(message);
 
         chat_log_otr_msg_in(message);
         otr_free_message(message->plain);
@@ -592,8 +592,8 @@ static void
 _sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
 {
     _clean_incoming_message(message);
-    log_database_add_incoming(message);
     chatwin_incoming_msg(chatwin, message, new_win);
+    log_database_add_incoming(message);
     if (logit) {
         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->plain = strdup(message->body);
         _clean_incoming_message(message);
-        log_database_add_incoming(message);
         chatwin_incoming_msg(chatwin, message, new_win);
+        log_database_add_incoming(message);
         if (logit) {
             chat_log_msg_in(message);
         }