about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-03-19 12:10:54 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-04-06 10:50:20 +0200
commit8045a32c4a123d541c9a44d64a8ff35dca27474e (patch)
treee93e6dba4eb1c75a1cde6ff953d6bd6334f1a111 /src/event
parenta7163b24f3822989173cfca8ad7bfc84193cc839 (diff)
downloadprofani-tty-8045a32c4a123d541c9a44d64a8ff35dca27474e.tar.gz
database: log incoming messages
First trial. Not covering all cases yet.
Diffstat (limited to 'src/event')
-rw-r--r--src/event/server_events.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index ea4277b2..6c7d0430 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -42,6 +42,7 @@
 
 #include "profanity.h"
 #include "log.h"
+#include "database.h"
 #include "config/preferences.h"
 #include "config/tlscerts.h"
 #include "config/account.h"
@@ -324,6 +325,7 @@ sv_ev_room_message(ProfMessage *message)
     GList *triggers = prefs_message_get_triggers(message->plain);
 
     _clean_incoming_message(message);
+    log_database_add(message);
     mucwin_incoming_msg(mucwin, message, mentions, triggers, TRUE);
 
     g_slist_free(mentions);
@@ -397,6 +399,7 @@ sv_ev_incoming_private_message(ProfMessage *message)
     }
 
     _clean_incoming_message(message);
+    log_database_add(message);
     privwin_incoming_msg(privatewin, message);
     chat_log_msg_in(message);
 
@@ -420,6 +423,7 @@ sv_ev_delayed_private_message(ProfMessage *message)
     }
 
     _clean_incoming_message(message);
+    log_database_add(message);
     privwin_incoming_msg(privatewin, message);
     chat_log_msg_in(message);
 
@@ -532,6 +536,7 @@ _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(message);
         chatwin_incoming_msg(chatwin, message, new_win);
         if (logit) {
             chat_log_pgp_msg_in(message);
@@ -547,6 +552,7 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
         message->enc = PROF_MSG_ENC_PLAIN;
         message->plain = strdup(message->body);
         _clean_incoming_message(message);
+        log_database_add(message);
         chatwin_incoming_msg(chatwin, message, new_win);
         chat_log_msg_in(message);
         chatwin->pgp_recv = FALSE;
@@ -569,6 +575,7 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
         }
 
         _clean_incoming_message(message);
+        log_database_add(message);
         chatwin_incoming_msg(chatwin, message, new_win);
 
         chat_log_otr_msg_in(message);
@@ -584,6 +591,7 @@ static void
 _sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
 {
     _clean_incoming_message(message);
+    log_database_add(message);
     chatwin_incoming_msg(chatwin, message, new_win);
     if (logit) {
         chat_log_omemo_msg_in(message);
@@ -599,6 +607,7 @@ _sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, ProfMessage *messa
         message->enc = PROF_MSG_ENC_PLAIN;
         message->plain = strdup(message->body);
         _clean_incoming_message(message);
+        log_database_add(message);
         chatwin_incoming_msg(chatwin, message, new_win);
         if (logit) {
             chat_log_msg_in(message);