summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorWouter Coekaerts <coekie@irssi.org>2005-09-10 01:36:06 +0000
committercoekie <coekie@dbcabf3a-b0e7-0310-adc4-f8d773084564>2005-09-10 01:36:06 +0000
commit4a8ebb150ac3dae18a45b872d78e63816ff754aa (patch)
treef20ac6682baa40e9d2830f84c49e893bdfc0dc5d /src/irc
parent54a2b99ba851e39ecb27cddab0255ed0739aac69 (diff)
downloadirssi-4a8ebb150ac3dae18a45b872d78e63816ff754aa.zip
- rename "whois not found" to "whois try whowas", because that's what needs to be done when the signal is sent (and it doesn't mean whois_not_found should be printed)
- rename "whois event noserver" to "whois event not found", because the signal means the nickname wasn't found (but it comes as a "no such server" because it was a /whois nick nick), whois_not_found should be printed, and so it makes sense to also use it for the next fix: - send "whois event not found" for 401, when auto_whowas is off, so the message is displayed correctly (Bug 295) - handle 402 the same with auto_whowas off as with on, (fixes /whois with not existing server specified, with auto_whowas off). - and since the auto_whowas on and off cases are similar now, merge them together, so they stay consistent. - pass every argument given to /whowas to the server, not just the first (count). Fixes remote whowas (Bug 256) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3988 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-commands.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c
index 0af623a1..278a3d4d 100644
--- a/src/irc/core/irc-commands.c
+++ b/src/irc/core/irc-commands.c
@@ -415,32 +415,21 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
else {
g_string_sprintf(tmpstr, "WHOIS %s %s", qserver, query);
if (g_strcasecmp(qserver, query) == 0)
- event_402 = "whois event noserver";
+ event_402 = "whois event not found";
}
query = get_redirect_nicklist(query, &free_nick);
str = g_strconcat(qserver, " ", query, NULL);
- if (settings_get_bool("auto_whowas")) {
- /* do automatic /WHOWAS if any of the nicks wasn't found */
- server_redirect_event(server, "whois", 1, str, TRUE,
- NULL,
- "event 318", "whois end",
- "event 402", event_402,
- "event 301", "whois away", /* 301 can come as a reply to /MSG, /WHOIS or /WHOWAS */
- "event 313", "whois oper",
- "event 401", "whois not found",
- "event 311", "whois event",
- "", "whois default event", NULL);
- } else {
- server_redirect_event(server, "whois", 1, str, TRUE,
- NULL,
- "event 318", "whois end",
- "event 301", "whois away", /* 301 can come as a reply to /MSG, /WHOIS or /WHOWAS */
- "event 313", "whois oper",
- "event 311", "whois event",
- "", "whois default event", NULL);
- }
+ server_redirect_event(server, "whois", 1, str, TRUE,
+ NULL,
+ "event 318", "whois end",
+ "event 402", event_402,
+ "event 301", "whois away", /* 301 can come as a reply to /MSG, /WHOIS or /WHOWAS */
+ "event 313", "whois oper",
+ "event 401", (settings_get_bool("auto_whowas") ? "whois try whowas" : "whois event not found"),
+ "event 311", "whois event",
+ "", "whois default event", NULL);
g_free(str);
server->whois_found = FALSE;
@@ -457,7 +446,7 @@ static void event_whois(IRC_SERVER_REC *server, const char *data,
signal_emit("event 311", 4, server, data, nick, addr);
}
-static void sig_whois_not_found(IRC_SERVER_REC *server, const char *data)
+static void sig_whois_try_whowas(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick;
@@ -489,16 +478,16 @@ static void event_whowas(IRC_SERVER_REC *server, const char *data,
signal_emit("event 314", 4, server, data, nick, addr);
}
-/* SYNTAX: WHOWAS [<nicks> [<count>]] */
+/* SYNTAX: WHOWAS [<nicks> [<count> [server]]] */
static void cmd_whowas(const char *data, IRC_SERVER_REC *server)
{
- char *nicks, *count, *nicks_redir;
+ char *nicks, *rest, *nicks_redir;
void *free_arg;
int free_nick;
CMD_IRC_SERVER(server);
- if (!cmd_get_params(data, &free_arg, 2, &nicks, &count))
+ if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &nicks, &rest))
return;
if (*nicks == '\0') nicks = server->nick;
@@ -509,8 +498,8 @@ static void cmd_whowas(const char *data, IRC_SERVER_REC *server)
if (free_nick) g_free(nicks_redir);
server->whowas_found = FALSE;
- irc_send_cmdv(server, *count == '\0' ? "WHOWAS %s" :
- "WHOWAS %s %s", nicks, count);
+ irc_send_cmdv(server, *rest == '\0' ? "WHOWAS %s" :
+ "WHOWAS %s %s", nicks, rest);
cmd_params_free(free_arg);
}
@@ -1076,7 +1065,7 @@ void irc_commands_init(void)
signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
- signal_add("whois not found", (SIGNAL_FUNC) sig_whois_not_found);
+ signal_add("whois try whowas", (SIGNAL_FUNC) sig_whois_try_whowas);
signal_add("whois event", (SIGNAL_FUNC) event_whois);
signal_add("whois end", (SIGNAL_FUNC) event_end_of_whois);
signal_add("whowas event", (SIGNAL_FUNC) event_whowas);
@@ -1147,7 +1136,7 @@ void irc_commands_deinit(void)
signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
- signal_remove("whois not found", (SIGNAL_FUNC) sig_whois_not_found);
+ signal_remove("whois try whowas", (SIGNAL_FUNC) sig_whois_try_whowas);
signal_remove("whois event", (SIGNAL_FUNC) event_whois);
signal_remove("whois end", (SIGNAL_FUNC) event_end_of_whois);
signal_remove("whowas event", (SIGNAL_FUNC) event_whowas);