diff --git a/src/fe-common/irc/notifylist/fe-notifylist.c b/src/fe-common/irc/notifylist/fe-notifylist.c index e96cc6d9..c13e5c8a 100644 --- a/src/fe-common/irc/notifylist/fe-notifylist.c +++ b/src/fe-common/irc/notifylist/fe-notifylist.c @@ -144,7 +144,7 @@ static void notifylist_print(NOTIFYLIST_REC *rec) if (rec->idle_check_time <= 0) idle[0] = '\0'; else - g_snprintf(idle, sizeof(idle), "-idle %d", rec->idle_check_time); + g_snprintf(idle, sizeof(idle), "-idle %d", rec->idle_check_time/60); ircnets = rec->ircnets == NULL ? NULL : g_strjoinv(",", rec->ircnets); diff --git a/src/irc/notifylist/module.h b/src/irc/notifylist/module.h index ac0eadac..43110540 100644 --- a/src/irc/notifylist/module.h +++ b/src/irc/notifylist/module.h @@ -7,7 +7,7 @@ typedef struct { char *nick; char *user, *host, *realname, *awaymsg; - time_t idle_time; + int idle_time; int host_ok:1; /* host matches the one in notifylist = this is the right person*/ int away_ok:1; /* not away, or we don't care about it */ diff --git a/src/irc/notifylist/notify-whois.c b/src/irc/notifylist/notify-whois.c index c8191b57..5a9500cc 100644 --- a/src/irc/notifylist/notify-whois.c +++ b/src/irc/notifylist/notify-whois.c @@ -78,16 +78,15 @@ static void event_whois_idle(const char *data, IRC_SERVER_REC *server) g_return_if_fail(data != NULL); params = event_get_params(data, 3, NULL, &nick, &secstr); - secs = atoi(secstr); + secs = atol(secstr); notify = notifylist_find(nick, server->connrec->ircnet); nickrec = notify_nick_find(server, nick); if (notify != NULL && nickrec != NULL) { - time_t now = time(NULL); - nickrec->idle_changed = secs < now-nickrec->idle_time && - now-nickrec->idle_time > notify->idle_check_time; + nickrec->idle_changed = secs < nickrec->idle_time && + nickrec->idle_time > notify->idle_check_time; - nickrec->idle_time = now-secs; + nickrec->idle_time = secs; } g_free(params); @@ -120,9 +119,7 @@ static void event_whois_end(const char *data, IRC_SERVER_REC *server) GSList *tmp; const char *event; int away_ok; - time_t now; - now = time(NULL); mserver = MODULE_DATA(server); for (tmp = mserver->notify_users; tmp != NULL; tmp = tmp->next) { rec = tmp->data; @@ -138,7 +135,7 @@ static void event_whois_end(const char *data, IRC_SERVER_REC *server) event = NULL; if (!rec->join_announced) { rec->join_announced = TRUE; - rec->idle_time = now; + rec->idle_time = 0; if (away_ok) event = "notifylist joined"; } else if (notify->away_check && rec->away_ok == rec->away) event = "notifylist away changed"; @@ -151,7 +148,7 @@ static void event_whois_end(const char *data, IRC_SERVER_REC *server) rec->realname, rec->awaymsg); } rec->idle_ok = notify->idle_check_time <= 0 || - now-rec->idle_time <= notify->idle_check_time; + rec->idle_time <= notify->idle_check_time; rec->idle_changed = FALSE; rec->away_ok = away_ok; } diff --git a/src/irc/notifylist/notifylist.c b/src/irc/notifylist/notifylist.c index 6b46ff3d..de19ed0c 100644 --- a/src/irc/notifylist/notifylist.c +++ b/src/irc/notifylist/notifylist.c @@ -231,8 +231,8 @@ static void notifylist_idle_reset(IRC_SERVER_REC *server, const char *nick) rec = notify_nick_find(server, nick); if (notify != NULL && rec != NULL && notify->idle_check_time > 0 && - time(NULL)-rec->idle_time > notify->idle_check_time) { - rec->idle_time = time(NULL); + rec->idle_time > notify->idle_check_time) { + rec->idle_time = 0; signal_emit("notifylist unidle", 6, server, rec->nick, rec->user, rec->host, @@ -289,7 +289,7 @@ static void notifylist_check_join(IRC_SERVER_REC *server, const char *nick, if (away != -1) rec->away = away; rec->host_ok = TRUE; rec->join_announced = TRUE; - rec->idle_time = time(NULL); + rec->idle_time = 0; signal_emit("notifylist joined", 6, server, rec->nick, rec->user, rec->host, realname, NULL);