diff options
author | Gary Kramlich <grim@reaperworld.com> | 2023-02-20 09:50:04 -0600 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2023-02-20 09:50:04 -0600 |
commit | 3c025b4738a3a50cd55e4d08c4fcd046cdd38a61 (patch) | |
tree | d7292fad4f2919db0db4868d5f63f11a85da7c22 /finch/gntblist.c | |
parent | a0955b17df3c051f2d38929b252917345f30c5f2 (diff) | |
download | pidgin-3c025b4738a3a50cd55e4d08c4fcd046cdd38a61.tar.gz |
Convert idle_time in PurplePresence to GDateTime
Testing Done:
Ran the unit tests and checked a few things in the UI. Noticed that the status time in the buddy list has been broken for some time as well.
Bugs closed: PIDGIN-17759
Reviewed at https://reviews.imfreedom.org/r/2235/
Diffstat (limited to 'finch/gntblist.c')
-rw-r--r-- | finch/gntblist.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/finch/gntblist.c b/finch/gntblist.c index 45579369fb..019ad54428 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -1581,9 +1581,18 @@ tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) if (purple_prefs_get_bool("/finch/blist/idletime")) { PurplePresence *pre = purple_buddy_get_presence(buddy); if (purple_presence_is_idle(pre)) { - time_t idle = purple_presence_get_idle_time(pre); - if (idle > 0) { - char *st = purple_str_seconds_to_string(time(NULL) - idle); + GDateTime *idle = purple_presence_get_idle_time(pre); + + if(idle != NULL) { + GDateTime *now = NULL; + GTimeSpan since = 0; + char *st = NULL; + + now = g_date_time_new_now_local(); + since = g_date_time_difference(now, idle); + g_date_time_unref(now); + + st = purple_str_seconds_to_string(since / G_TIME_SPAN_SECOND); purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), st); g_free(st); } |