1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

- 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
This commit is contained in:
Wouter Coekaerts 2005-09-10 01:36:06 +00:00 committed by coekie
parent 54a2b99ba8
commit 4a8ebb150a
2 changed files with 21 additions and 32 deletions

View File

@ -386,7 +386,7 @@ static void event_ban_type_changed(void *ban_typep)
}
}
static void sig_whois_event_no_server(IRC_SERVER_REC *server, const char *data)
static void sig_whois_event_not_found(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick;
@ -451,7 +451,7 @@ void fe_events_init(void)
signal_add("event connected", (SIGNAL_FUNC) event_connected);
signal_add("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois);
signal_add("ban type changed", (SIGNAL_FUNC) event_ban_type_changed);
signal_add("whois event noserver", (SIGNAL_FUNC) sig_whois_event_no_server);
signal_add("whois event not found", (SIGNAL_FUNC) sig_whois_event_not_found);
signal_add("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end);
}
@ -480,6 +480,6 @@ void fe_events_deinit(void)
signal_remove("event connected", (SIGNAL_FUNC) event_connected);
signal_remove("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois);
signal_remove("ban type changed", (SIGNAL_FUNC) event_ban_type_changed);
signal_remove("whois event noserver", (SIGNAL_FUNC) sig_whois_event_no_server);
signal_remove("whois event not found", (SIGNAL_FUNC) sig_whois_event_not_found);
signal_remove("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end);
}

View File

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