about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-03-19 13:38:17 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-04-06 10:50:20 +0200
commitd1d0ad8d1a8e28690aa8723566dd64c1ccdcf9d6 (patch)
tree15a68f958a4ac7b1af64afee6c64509e5684ac38 /src/xmpp
parent8045a32c4a123d541c9a44d64a8ff35dca27474e (diff)
downloadprofani-tty-d1d0ad8d1a8e28690aa8723566dd64c1ccdcf9d6.tar.gz
Add timestamp for incoming messages if none is set
Timestamps are only set if a message is delayed.
If none is set let's set it upon recaival so we don't have to set it
when it gets displayed.

This means we will also have it for logs etc in the ProfMessage.
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/message.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index d9159e81..d116b8da 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -1009,6 +1009,8 @@ _handle_muc_private_message(xmpp_stanza_t *const stanza)
     if (message->timestamp) {
         sv_ev_delayed_private_message(message);
     } else {
+        message->timestamp = g_date_time_new_now_local();
+
         sv_ev_incoming_private_message(message);
     }
 
@@ -1199,6 +1201,10 @@ _handle_chat(xmpp_stanza_t *const stanza)
     }
 
     message->timestamp = stanza_get_delay(stanza);
+    if (!message->timestamp) {
+        message->timestamp = g_date_time_new_now_local();
+    }
+
     if (body) {
         message->body = xmpp_stanza_get_text(body);
     }