about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-01-24 21:30:35 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-01-24 21:30:35 +0100
commitef00b10c90aef8b75415fae558789d21bb975d75 (patch)
tree84723ca2b02111401c8008dc2c8a43878662ad4d
parent663aa09cce6fb2d536a81620cd7bc93686c3ddc2 (diff)
downloadprofani-tty-ef00b10c90aef8b75415fae558789d21bb975d75.tar.gz
Save first delay tag as timestamp
So far we got the first delay with a from that comes from the server.
This way we know it's MUC history.

Now we take the first time stamp we actually find. Which is likely the
one being added first. And should contain the correct time to display.

It would be nicer to actually compare the dates though.

Regards https://github.com/profanity-im/profanity/issues/1254
-rw-r--r--src/xmpp/message.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 18182e0c..7f73b9e2 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -838,6 +838,15 @@ _handle_groupchat(xmpp_stanza_t *const stanza)
         message->timestamp = stanza_get_delay_from(stanza, jid->domainpart);
     }
 
+    // Above we check whether the timestamps come from the server. So we know it
+    // is MUC history.
+    // Now we actually save the first timestamp we can find, since this is likely
+    // the first one being added. So the time should actually be right one to display.
+    // TODO: properly compare the dates
+    if (message->timestamp) {
+        message->timestamp = stanza_get_delay(stanza);
+    }
+
     if (message->timestamp) {
         sv_ev_room_history(message);
     } else {