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 /libpurple/idle.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 'libpurple/idle.c')
-rw-r--r-- | libpurple/idle.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libpurple/idle.c b/libpurple/idle.c index a9beeecb1a..b999f2cdba 100644 --- a/libpurple/idle.c +++ b/libpurple/idle.c @@ -61,6 +61,8 @@ set_account_idle(PurpleAccount *account, int time_idle) { PurpleContactInfo *info = PURPLE_CONTACT_INFO(account); PurplePresence *presence; + GDateTime *idle_since = NULL; + GDateTime *now = NULL; presence = purple_account_get_presence(account); @@ -72,7 +74,14 @@ set_account_idle(PurpleAccount *account, int time_idle) purple_debug_info("idle", "Setting %s idle %d seconds\n", purple_contact_info_get_username(info), time_idle); - purple_presence_set_idle(presence, TRUE, time(NULL) - time_idle); + + now = g_date_time_new_now_local(); + idle_since = g_date_time_add_seconds(now, -1 * time_idle); + g_date_time_unref(now); + + purple_presence_set_idle(presence, TRUE, idle_since); + g_date_time_unref(idle_since); + idled_accts = g_list_prepend(idled_accts, account); } |