diff options
author | Jilles Tjoelker <jilles@irssi.org> | 2007-10-31 22:58:44 +0000 |
---|---|---|
committer | jilles <jilles@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2007-10-31 22:58:44 +0000 |
commit | 78dad04c7b21342c9b6dddc7ea9f1b34f61e6984 (patch) | |
tree | 4432b0b216434973eaa0a24a991daa9e8e74c816 /src/irc/notifylist | |
parent | d9782fab84a66a04eb42bb8804236a860b799574 (diff) | |
download | irssi-78dad04c7b21342c9b6dddc7ea9f1b34f61e6984.zip |
Remove /notify -idle, it can only work with not-nice automated remote whois.
(causes infrequent "server load too heavy" etc)
If people really want this, they should write a script.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4632 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/notifylist')
-rw-r--r-- | src/irc/notifylist/module.h | 3 | ||||
-rw-r--r-- | src/irc/notifylist/notify-commands.c | 21 | ||||
-rw-r--r-- | src/irc/notifylist/notify-ison.c | 6 | ||||
-rw-r--r-- | src/irc/notifylist/notify-setup.c | 6 | ||||
-rw-r--r-- | src/irc/notifylist/notify-whois.c | 33 | ||||
-rw-r--r-- | src/irc/notifylist/notifylist.c | 25 | ||||
-rw-r--r-- | src/irc/notifylist/notifylist.h | 5 |
7 files changed, 10 insertions, 89 deletions
diff --git a/src/irc/notifylist/module.h b/src/irc/notifylist/module.h index d88058e4..c7239a88 100644 --- a/src/irc/notifylist/module.h +++ b/src/irc/notifylist/module.h @@ -6,15 +6,12 @@ typedef struct { char *nick; char *user, *host, *realname, *awaymsg; - int idle_time; unsigned int host_ok:1; /* host matches the one in notifylist = this is the right person*/ unsigned int away_ok:1; /* not away, or we don't care about it */ - unsigned int idle_ok:1; /* idle time is low enough, or we don't care about it */ unsigned int away:1; /* nick is away */ unsigned int join_announced:1; /* join to IRC has been announced */ - unsigned int idle_changed:1; /* idle time is lower than in last check */ time_t last_whois; } NOTIFY_NICK_REC; diff --git a/src/irc/notifylist/notify-commands.c b/src/irc/notifylist/notify-commands.c index b8fdc4a6..67076106 100644 --- a/src/irc/notifylist/notify-commands.c +++ b/src/irc/notifylist/notify-commands.c @@ -26,13 +26,13 @@ #include "notifylist.h" -/* SYNTAX: NOTIFY [-away] [-idle [<time>]] <mask> [<ircnets>] */ +/* SYNTAX: NOTIFY [-away] <mask> [<ircnets>] */ static void cmd_notify(gchar *data) { GHashTable *optlist; - char *mask, *ircnets, *idletime; + char *mask, *ircnets; void *free_arg; - int away_check, idle_check_time; + int away_check; g_return_if_fail(data != NULL); @@ -41,19 +41,9 @@ static void cmd_notify(gchar *data) return; if (*mask == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - idletime = g_hash_table_lookup(optlist, "idle"); - if (idletime == NULL) - idle_check_time = 0; - else if (*idletime == '\0') - idle_check_time = settings_get_time("notify_idle_time"); - else { - if (!parse_time_interval(idletime, &idle_check_time)) - cmd_param_error(CMDERR_INVALID_TIME); - } - away_check = g_hash_table_lookup(optlist, "away") != NULL; notifylist_remove(mask); - notifylist_add(mask, ircnets, away_check, idle_check_time/1000); + notifylist_add(mask, ircnets, away_check); cmd_params_free(free_arg); } @@ -77,11 +67,10 @@ static void cmd_unnotify(const char *data) void notifylist_commands_init(void) { - settings_add_time("misc", "notify_idle_time", "1hour"); command_bind("notify", NULL, (SIGNAL_FUNC) cmd_notify); command_bind("unnotify", NULL, (SIGNAL_FUNC) cmd_unnotify); - command_set_options("notify", "-idle away"); + command_set_options("notify", "away"); } void notifylist_commands_deinit(void) diff --git a/src/irc/notifylist/notify-ison.c b/src/irc/notifylist/notify-ison.c index 24dd0d05..bedfc10f 100644 --- a/src/irc/notifylist/notify-ison.c +++ b/src/irc/notifylist/notify-ison.c @@ -181,7 +181,6 @@ static void whois_send(IRC_SERVER_REC *server, const char *nicks, "event 318", "notifylist event whois end", "event 311", "notifylist event whois", "event 301", "notifylist event whois away", - "event 317", "notifylist event whois idle", "", "event empty", NULL); g_free(str); @@ -247,8 +246,7 @@ static void ison_check_joins(IRC_SERVER_REC *server) char *nick = tmp->data; notify = notifylist_find(nick, server->connrec->chatnet); - send_whois = notify != NULL && - (notify->away_check || notify->idle_check_time > 0); + send_whois = notify != NULL && notify->away_check; rec = notify_nick_find(server, nick); if (rec != NULL) { @@ -261,7 +259,7 @@ static void ison_check_joins(IRC_SERVER_REC *server) } if (send_whois) { - /* we need away message or idle time - + /* we need away message - send the WHOIS reply to the nick's server */ rec->last_whois = now; whois_send_server(server, nick); diff --git a/src/irc/notifylist/notify-setup.c b/src/irc/notifylist/notify-setup.c index 92a1fc27..d6f91361 100644 --- a/src/irc/notifylist/notify-setup.c +++ b/src/irc/notifylist/notify-setup.c @@ -37,11 +37,6 @@ void notifylist_add_config(NOTIFYLIST_REC *rec) else iconfig_node_set_str(node, "away_check", NULL); - if (rec->idle_check_time > 0) - iconfig_node_set_int(node, "idle_check_time", rec->idle_check_time/60); - else - iconfig_node_set_str(node, "idle_check_time", NULL); - iconfig_node_set_str(node, "ircnets", NULL); if (rec->ircnets != NULL && *rec->ircnets != NULL) { node = config_node_section(node, "ircnets", NODE_TYPE_LIST); @@ -77,7 +72,6 @@ void notifylist_read_config(void) rec->mask = g_strdup(node->key); rec->away_check = config_node_get_bool(node, "away_check", FALSE); - rec->idle_check_time = config_node_get_int(node, "idle_check_time", 0)*60; node = config_node_section(node, "ircnets", -1); if (node != NULL) rec->ircnets = config_node_get_list(node); diff --git a/src/irc/notifylist/notify-whois.c b/src/irc/notifylist/notify-whois.c index b1577577..2d0736b5 100644 --- a/src/irc/notifylist/notify-whois.c +++ b/src/irc/notifylist/notify-whois.c @@ -63,35 +63,10 @@ static void event_whois(IRC_SERVER_REC *server, const char *data) nickrec->away = FALSE; nickrec->host_ok = TRUE; - nickrec->idle_ok = TRUE; } g_free(params); } -static void event_whois_idle(IRC_SERVER_REC *server, const char *data) -{ - NOTIFY_NICK_REC *nickrec; - NOTIFYLIST_REC *notify; - char *params, *nick, *secstr; - long secs; - - g_return_if_fail(data != NULL); - - params = event_get_params(data, 3, NULL, &nick, &secstr); - secs = atol(secstr); - - notify = notifylist_find(nick, server->connrec->chatnet); - nickrec = notify_nick_find(server, nick); - if (notify != NULL && nickrec != NULL) { - nickrec->idle_changed = secs < nickrec->idle_time && - nickrec->idle_time > notify->idle_check_time; - - nickrec->idle_time = secs; - } - - g_free(params); -} - static void event_whois_away(IRC_SERVER_REC *server, const char *data) { NOTIFY_NICK_REC *nickrec; @@ -135,12 +110,9 @@ static void event_whois_end(IRC_SERVER_REC *server, const char *data) event = NULL; if (!rec->join_announced) { rec->join_announced = TRUE; - rec->idle_time = 0; if (away_ok) event = "notifylist joined"; } else if (notify->away_check && rec->away_ok == rec->away) event = "notifylist away changed"; - else if (notify->idle_check_time > 0 && rec->idle_changed) - event = "notifylist unidle"; if (event != NULL) { signal_emit(event, 6, server, rec->nick, @@ -149,9 +121,6 @@ static void event_whois_end(IRC_SERVER_REC *server, const char *data) rec->realname != NULL ? rec->realname : "??", rec->awaymsg); } - rec->idle_ok = notify->idle_check_time <= 0 || - rec->idle_time <= notify->idle_check_time; - rec->idle_changed = FALSE; rec->away_ok = away_ok; } } @@ -168,7 +137,6 @@ void notifylist_whois_init(void) signal_add("notifylist event whois", (SIGNAL_FUNC) event_whois); signal_add("notifylist event whois away", (SIGNAL_FUNC) event_whois_away); - signal_add("notifylist event whois idle", (SIGNAL_FUNC) event_whois_idle); signal_add("notifylist event whois end", (SIGNAL_FUNC) event_whois_end); expando_create("D", expando_lastnotify, "notifylist event whois", EXPANDO_ARG_SERVER, NULL); @@ -180,7 +148,6 @@ void notifylist_whois_deinit(void) signal_remove("notifylist event whois", (SIGNAL_FUNC) event_whois); signal_remove("notifylist event whois away", (SIGNAL_FUNC) event_whois_away); - signal_remove("notifylist event whois idle", (SIGNAL_FUNC) event_whois_idle); signal_remove("notifylist event whois end", (SIGNAL_FUNC) event_whois_end); expando_destroy("D", expando_lastnotify); } diff --git a/src/irc/notifylist/notifylist.c b/src/irc/notifylist/notifylist.c index b9481aeb..76b158e5 100644 --- a/src/irc/notifylist/notifylist.c +++ b/src/irc/notifylist/notifylist.c @@ -35,7 +35,7 @@ GSList *notifies; NOTIFYLIST_REC *notifylist_add(const char *mask, const char *ircnets, - int away_check, int idle_check_time) + int away_check) { NOTIFYLIST_REC *rec; @@ -46,7 +46,6 @@ NOTIFYLIST_REC *notifylist_add(const char *mask, const char *ircnets, rec->ircnets = ircnets == NULL || *ircnets == '\0' ? NULL : g_strsplit(ircnets, " ", -1); rec->away_check = away_check; - rec->idle_check_time = idle_check_time; notifylist_add_config(rec); @@ -138,7 +137,7 @@ int notifylist_ison_server(IRC_SERVER_REC *server, const char *nick) g_return_val_if_fail(IS_IRC_SERVER(server), FALSE); rec = notify_nick_find(server, nick); - return rec != NULL && rec->host_ok && rec->away_ok && rec->idle_ok; + return rec != NULL && rec->host_ok && rec->away_ok; } static IRC_SERVER_REC *notifylist_ison_serverlist(const char *nick, const char *taglist) @@ -237,24 +236,6 @@ void notifylist_left(IRC_SERVER_REC *server, NOTIFY_NICK_REC *rec) notify_nick_destroy(rec); } -static void notifylist_idle_reset(IRC_SERVER_REC *server, const char *nick) -{ - NOTIFY_NICK_REC *rec; - NOTIFYLIST_REC *notify; - - notify = notifylist_find(nick, server->connrec->chatnet); - rec = notify_nick_find(server, nick); - - if (notify != NULL && rec != NULL && notify->idle_check_time > 0 && - rec->idle_time > notify->idle_check_time) { - rec->idle_time = 0; - signal_emit("notifylist unidle", 6, - server, rec->nick, - rec->user, rec->host, - rec->realname, rec->awaymsg); - } -} - static void event_quit(IRC_SERVER_REC *server, const char *data, const char *nick) { @@ -308,7 +289,6 @@ 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 = 0; signal_emit("notifylist joined", 6, server, rec->nick, rec->user, rec->host, realname, NULL); @@ -320,7 +300,6 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data, { if (nick != NULL) { notifylist_check_join(server, nick, address, "", -1); - notifylist_idle_reset(server, nick); } } diff --git a/src/irc/notifylist/notifylist.h b/src/irc/notifylist/notifylist.h index 86a30bf4..1094a105 100644 --- a/src/irc/notifylist/notifylist.h +++ b/src/irc/notifylist/notifylist.h @@ -7,9 +7,6 @@ typedef struct { /* notify when AWAY status changes (uses /USERHOST) */ unsigned int away_check:1; - /* notify when idle time is reset and it was bigger than this - (uses /WHOIS and PRIVMSG events) */ - int idle_check_time; } NOTIFYLIST_REC; extern GSList *notifies; @@ -18,7 +15,7 @@ void notifylist_init(void); void notifylist_deinit(void); NOTIFYLIST_REC *notifylist_add(const char *mask, const char *ircnets, - int away_check, int idle_check_time); + int away_check); void notifylist_remove(const char *mask); IRC_SERVER_REC *notifylist_ison(const char *nick, const char *serverlist); |