1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/NOTIFY -idle fixes.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@515 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-23 11:55:16 +00:00 committed by cras
parent 1a655f3575
commit e322876342
4 changed files with 11 additions and 14 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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;
}

View File

@ -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);