kenorb-contrib / tg

`telegram-cli` for Telegram IM
https://github.com/telegramdesktop/tdesktop
GNU General Public License v2.0
382 stars 52 forks source link

Wrong timestamp for online notification #41

Open asemarafa opened 3 years ago

asemarafa commented 3 years ago

The issue is reported in the main repo https://github.com/vysheng/tg/issues/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) {
ic-scm commented 3 years ago

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.