diff options
author | Timo Sirainen <cras@irssi.org> | 2000-07-23 11:55:16 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-07-23 11:55:16 +0000 |
commit | e322876342fc604b398f5a37e27c2b0b7477f344 (patch) | |
tree | 57fdf69e0e6b7a9dc5366ea1a2bfbb5a4403901b /src/irc/notifylist | |
parent | 1a655f357598c9d9f3d2ddbe61a10803ffc73d5b (diff) | |
download | irssi-e322876342fc604b398f5a37e27c2b0b7477f344.zip |
/NOTIFY -idle fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@515 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/notifylist')
-rw-r--r-- | src/irc/notifylist/module.h | 2 | ||||
-rw-r--r-- | src/irc/notifylist/notify-whois.c | 15 | ||||
-rw-r--r-- | src/irc/notifylist/notifylist.c | 6 |
3 files changed, 10 insertions, 13 deletions
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); |