diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c index fe3fcfd3..acce8c20 100644 --- a/src/fe-common/irc/fe-events.c +++ b/src/fe-common/irc/fe-events.c @@ -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; @@ -455,6 +467,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("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("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("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end); } diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index ebbdf59b..12d21219 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -412,7 +412,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { GHashTable *optlist; - char *qserver, *query; + char *qserver, *query, *event_402; void *free_arg; 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) cmd_param_error(CMDERR_NOT_GOOD_IDEA); + event_402 = "event 402"; if (*qserver == '\0') g_string_sprintf(tmpstr, "WHOIS %s", query); - else + else { g_string_sprintf(tmpstr, "WHOIS %s %s", qserver, query); + if (g_strcasecmp(qserver, query) == 0) + event_402 = "whois event noserver"; + } server->whois_found = FALSE; 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, "event 318", "event 318", 1, - "event 402", "event 402", -1, + "event 402", event_402, -1, "event 311", "whois event", 1, "event 401", "whois not found", 1, NULL); if (free_nick) g_free(query);