about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-10-28 23:36:42 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-10-28 23:36:42 +0100
commit8c8c18c6fddec89cbaa83abfcac29a97ef98c294 (patch)
treef6e45d73f08a6227e526dc350604b4473e80ad8d /src/event
parentf186eb94da785f1eec33056837201c99e7e4f0d2 (diff)
downloadprofani-tty-8c8c18c6fddec89cbaa83abfcac29a97ef98c294.tar.gz
Actually log MUC PM messages
If I'm not mistaken MUC PMs have not been logged at all if there was no
other client sending carbons.
This should add MUC PM logging functionality.

We still need to make sure carbons log to the same file.

Regards https://github.com/profanity-im/profanity/issues/1214
Diffstat (limited to 'src/event')
-rw-r--r--src/event/client_events.c24
-rw-r--r--src/event/server_events.c3
2 files changed, 16 insertions, 11 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index c3037392..21640150 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -151,7 +151,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
         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);
+            chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
             chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
             free(id);
         }
@@ -171,7 +171,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
     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);
+        chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
         chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
         free(id);
     }
@@ -194,7 +194,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
         free(id);
     } else {
         char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
-        chat_log_msg_out(chatwin->barejid, plugin_msg);
+        chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
         chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
         free(id);
     }
@@ -217,7 +217,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
         free(id);
     } else {
         char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
-        chat_log_msg_out(chatwin->barejid, plugin_msg);
+        chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
         chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
         free(id);
     }
@@ -242,7 +242,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
         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);
+            chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
             chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
             free(id);
         }
@@ -271,7 +271,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
         free(id);
     } else {
         char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
-        chat_log_msg_out(chatwin->barejid, plugin_msg);
+        chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
         chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
         free(id);
     }
@@ -289,19 +289,19 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
 #ifdef HAVE_OMEMO
     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);
+        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);
-        chat_log_pgp_msg_out(chatwin->barejid, plugin_msg);
+        chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
         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);
+            chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
             chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
             free(id);
         }
@@ -319,7 +319,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
 #ifndef HAVE_LIBGPGME
 #ifndef HAVE_OMEMO
     char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
-    chat_log_msg_out(chatwin->barejid, plugin_msg);
+    chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
     chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
     free(id);
 
@@ -378,11 +378,15 @@ cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg, const char *
         privwin_message_left_room(privwin);
     } else {
         char *plugin_msg = plugins_pre_priv_message_send(privwin->fulljid, msg);
+        Jid *jidp = jid_create(privwin->fulljid);
 
         message_send_private(privwin->fulljid, plugin_msg, oob_url);
+        chat_log_msg_out(jidp->barejid, plugin_msg, jidp->resourcepart);
         privwin_outgoing_msg(privwin, plugin_msg);
 
         plugins_post_priv_message_send(privwin->fulljid, plugin_msg);
+
         free(plugin_msg);
+        jid_destroy(jidp);
     }
 }
diff --git a/src/event/server_events.c b/src/event/server_events.c
index cdbd5ad5..95e51f15 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -398,6 +398,7 @@ sv_ev_incoming_private_message(ProfMessage *message)
         privatewin = (ProfPrivateWin*)window;
     }
     privwin_incoming_msg(privatewin, message);
+    chat_log_msg_in(message);
 
     plugins_post_priv_message_display(message->jid->fulljid, message->plain);
 
@@ -436,7 +437,7 @@ sv_ev_outgoing_carbon(ProfMessage *message)
     chat_state_active(chatwin->state);
 
     if (message->plain) {
-        chat_log_msg_out(message->jid->barejid, message->plain);
+        chat_log_msg_out(message->jid->barejid, message->plain, NULL);
     }
 
 #ifdef HAVE_LIBGPGME