about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-12-08 12:26:36 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-12-08 12:26:36 +0100
commit3e26364579d49aae70fa54addbd271b3aee3d968 (patch)
treeb8699fbcce5540e4b41ba8d782e425b7a1fcf191 /src
parentf023d56b02eec67ea357a85d7f8ec325f87622e3 (diff)
downloadprofani-tty-3e26364579d49aae70fa54addbd271b3aee3d968.tar.gz
Fix chatlogs for outgoing carbons
Doesn't make sense to log if plain is not set in all cases.

Regards https://github.com/profanity-im/profanity/issues/1439
Diffstat (limited to 'src')
-rw-r--r--src/event/server_events.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 27f142eb..3e51d969 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -448,16 +448,6 @@ sv_ev_outgoing_carbon(ProfMessage* message)
 
     chat_state_active(chatwin->state);
 
-    if (message->plain) {
-        if (message->type == PROF_MSG_TYPE_MUCPM) {
-            // MUC PM, should have resource (nick) in filename
-            chat_log_msg_out(message->to_jid->barejid, message->plain, message->from_jid->resourcepart);
-        } else {
-            chat_log_msg_out(message->to_jid->barejid, message->plain, NULL);
-        }
-        log_database_add_incoming(message);
-    }
-
     if (message->enc == PROF_MSG_ENC_OMEMO) {
         chatwin_outgoing_carbon(chatwin, message);
     } else if (message->encrypted) {
@@ -481,6 +471,16 @@ sv_ev_outgoing_carbon(ProfMessage* message)
         message->plain = strdup(message->body);
         chatwin_outgoing_carbon(chatwin, message);
     }
+
+    if (message->plain) {
+        if (message->type == PROF_MSG_TYPE_MUCPM) {
+            // MUC PM, should have resource (nick) in filename
+            chat_log_msg_out(message->to_jid->barejid, message->plain, message->from_jid->resourcepart);
+        } else {
+            chat_log_msg_out(message->to_jid->barejid, message->plain, NULL);
+        }
+        log_database_add_incoming(message);
+    }
     return;
 }