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

"/whois x x" - if x isn't found irssi now prints "there's no such nick x"

instead of complaining about unknown server x.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@755 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-14 16:02:35 +00:00 committed by cras
parent 76a6b9a931
commit bd19c4a7d7
2 changed files with 22 additions and 4 deletions

View File

@ -391,7 +391,19 @@ static void event_ban_type_changed(const char *bantype)
} }
} }
static void sig_whowas_event_end(const char *data, IRC_SERVER_REC *server, const char *sender, const char *addr) static void sig_whois_event_no_server(const char *data, IRC_SERVER_REC *server)
{
char *params, *nick;
g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &nick);
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHOIS_NOT_FOUND, nick);
g_free(params);
}
static void sig_whowas_event_end(const char *data, IRC_SERVER_REC *server,
const char *sender, const char *addr)
{ {
char *params, *nick; char *params, *nick;
@ -455,6 +467,7 @@ void fe_events_init(void)
signal_add("event connected", (SIGNAL_FUNC) event_connected); signal_add("event connected", (SIGNAL_FUNC) event_connected);
signal_add("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois); signal_add("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois);
signal_add("ban type changed", (SIGNAL_FUNC) event_ban_type_changed); 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("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end); signal_add("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end);
} }
@ -483,5 +496,6 @@ void fe_events_deinit(void)
signal_remove("event connected", (SIGNAL_FUNC) event_connected); signal_remove("event connected", (SIGNAL_FUNC) event_connected);
signal_remove("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois); signal_remove("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois);
signal_remove("ban type changed", (SIGNAL_FUNC) event_ban_type_changed); 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("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end); signal_remove("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end);
} }

View File

@ -412,7 +412,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
WI_ITEM_REC *item) WI_ITEM_REC *item)
{ {
GHashTable *optlist; GHashTable *optlist;
char *qserver, *query; char *qserver, *query, *event_402;
void *free_arg; void *free_arg;
int free_nick; int free_nick;
@ -437,10 +437,14 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
g_hash_table_lookup(optlist, "yes") == NULL) g_hash_table_lookup(optlist, "yes") == NULL)
cmd_param_error(CMDERR_NOT_GOOD_IDEA); cmd_param_error(CMDERR_NOT_GOOD_IDEA);
event_402 = "event 402";
if (*qserver == '\0') if (*qserver == '\0')
g_string_sprintf(tmpstr, "WHOIS %s", query); g_string_sprintf(tmpstr, "WHOIS %s", query);
else else {
g_string_sprintf(tmpstr, "WHOIS %s %s", qserver, query); g_string_sprintf(tmpstr, "WHOIS %s %s", qserver, query);
if (g_strcasecmp(qserver, query) == 0)
event_402 = "whois event noserver";
}
server->whois_found = FALSE; server->whois_found = FALSE;
irc_send_cmd_split(server, tmpstr->str, 2, server->max_whois_in_cmd); irc_send_cmd_split(server, tmpstr->str, 2, server->max_whois_in_cmd);
@ -450,7 +454,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
server_redirect_event((SERVER_REC *) server, query, 2, server_redirect_event((SERVER_REC *) server, query, 2,
"event 318", "event 318", 1, "event 318", "event 318", 1,
"event 402", "event 402", -1, "event 402", event_402, -1,
"event 311", "whois event", 1, "event 311", "whois event", 1,
"event 401", "whois not found", 1, NULL); "event 401", "whois not found", 1, NULL);
if (free_nick) g_free(query); if (free_nick) g_free(query);