summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-10-14 16:02:35 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-10-14 16:02:35 +0000
commitbd19c4a7d76e9ca884a461b13e5471af80e84d44 (patch)
treea702a9b694f4fe66873840155c64ddea6fcc3df6 /src
parent76a6b9a93157ff7b132bdf212f74be8ff8f3b481 (diff)
downloadirssi-bd19c4a7d76e9ca884a461b13e5471af80e84d44.zip
"/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
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-events.c16
-rw-r--r--src/irc/core/irc-commands.c10
2 files changed, 22 insertions, 4 deletions
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);