kenorb-contrib/tg

Wrong timestamp for online notification

asemarafa opened this issue · 1 comments

The issue is reported in the main repo
vysheng#614

The notification for "user is online" has a timestamp that is ahead by 5 minutes

I created a lazy patch to fix it for my build since i didnt have the time to dig deeper why the S->when is populated incorrectly when S->online is true

--- interface.c.orig    2021-05-09 14:06:17.928110162 +0200
+++ interface.c 2021-05-09 13:53:56.123997492 +0200
@@ -2740,7 +2740,7 @@
   assert(!enable_json); //calling functions print_user_info_gw() and user_status_upd() already check.
   if (S->online > 0) {
     mprintf (ev, "online (was online ");
-    print_date_full (ev, S->when);
+    print_date_full (ev, S->when - 300);
     mprintf (ev, ")");
   } else {
     if (S->online == 0) {

The online timestamp that is 5 minutes ahead is a normal thing sent by the Telegram server, as far as I know Telegram's online statuses simply work by setting the last seen time ahead of the current time.