diff options
author | Timo Sirainen <cras@irssi.org> | 2000-06-10 21:40:00 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-06-10 21:40:00 +0000 |
commit | 15d49dbd8533881572715ab4be37befbe669c510 (patch) | |
tree | 089f41cf538bd80bc19aa00b680c22539737a894 /src/fe-common/irc | |
parent | bdb70fe464b1be056ac9f8ff92611861a9dc2562 (diff) | |
download | irssi-15d49dbd8533881572715ab4be37befbe669c510.zip |
/WHOIS automatically sends a /WHOWAS query if nick wasn't in IRC.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@315 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r-- | src/fe-common/irc/fe-events-numeric.c | 38 | ||||
-rw-r--r-- | src/fe-common/irc/fe-events.c | 18 | ||||
-rw-r--r-- | src/fe-common/irc/module-formats.c | 3 | ||||
-rw-r--r-- | src/fe-common/irc/module-formats.h | 3 |
4 files changed, 56 insertions, 6 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 246bdef9..3d66652c 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -425,6 +425,17 @@ static void event_whois_oper(gchar *data, IRC_SERVER_REC *server) g_free(params); } +static void event_whowas(const char *data, IRC_SERVER_REC *server) +{ + char *params, *nick, *user, *host, *realname; + + g_return_if_fail(data != NULL); + + params = event_get_params(data, 6, NULL, &nick, &user, &host, NULL, &realname); + printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHOWAS, nick, user, host, realname); + g_free(params); +} + static void event_whois_channels(gchar *data, IRC_SERVER_REC *server) { gchar *params, *nick, *chans; @@ -473,15 +484,26 @@ static void event_whois_away(gchar *data, IRC_SERVER_REC *server) g_free(params); } -static void event_end_of_whois(gchar *data, IRC_SERVER_REC *server) +static void event_end_of_whois(const char *data, IRC_SERVER_REC *server) { - gchar *params, *nick; + char *params, *nick; - g_return_if_fail(data != NULL); + g_return_if_fail(data != NULL); - params = event_get_params(data, 2, NULL, &nick); - printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_END_OF_WHOIS, nick); - g_free(params); + params = event_get_params(data, 2, NULL, &nick); + if (server->whois_found) printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_END_OF_WHOIS, nick); + g_free(params); +} + +static void event_end_of_whowas(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_END_OF_WHOWAS, nick); + g_free(params); } static void event_target_unavailable(gchar *data, IRC_SERVER_REC *server) @@ -646,8 +668,10 @@ void fe_events_numeric_init(void) signal_add("event 301", (SIGNAL_FUNC) event_whois_away); signal_add("event 312", (SIGNAL_FUNC) event_whois_server); signal_add("event 313", (SIGNAL_FUNC) event_whois_oper); + signal_add("event 314", (SIGNAL_FUNC) event_whowas); signal_add("event 317", (SIGNAL_FUNC) event_whois_idle); signal_add("event 318", (SIGNAL_FUNC) event_end_of_whois); + signal_add("event 369", (SIGNAL_FUNC) event_end_of_whowas); signal_add("event 319", (SIGNAL_FUNC) event_whois_channels); signal_add("event 302", (SIGNAL_FUNC) event_userhost); signal_add("event 341", (SIGNAL_FUNC) event_sent_invite); @@ -698,8 +722,10 @@ void fe_events_numeric_deinit(void) signal_remove("event 301", (SIGNAL_FUNC) event_whois_away); signal_remove("event 312", (SIGNAL_FUNC) event_whois_server); signal_remove("event 313", (SIGNAL_FUNC) event_whois_oper); + signal_remove("event 314", (SIGNAL_FUNC) event_whowas); signal_remove("event 317", (SIGNAL_FUNC) event_whois_idle); signal_remove("event 318", (SIGNAL_FUNC) event_end_of_whois); + signal_remove("event 369", (SIGNAL_FUNC) event_end_of_whowas); signal_remove("event 319", (SIGNAL_FUNC) event_whois_channels); signal_remove("event 302", (SIGNAL_FUNC) event_userhost); signal_remove("event 341", (SIGNAL_FUNC) event_sent_invite); diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c index ab893e15..b25e06f1 100644 --- a/src/fe-common/irc/fe-events.c +++ b/src/fe-common/irc/fe-events.c @@ -564,6 +564,22 @@ static void event_ban_type_changed(gchar *bantype) } } +static void sig_whowas_event_end(const char *data, IRC_SERVER_REC *server, const char *sender, const char *addr) +{ + char *params, *nick; + + g_return_if_fail(data != NULL); + + if (server->whowas_found) { + signal_emit("event 369", 4, data, server, sender, addr); + return; + } + + params = event_get_params(data, 2, NULL, &nick); + printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHOIS_NOT_FOUND, nick); + g_free(params); +} + static void sig_server_lag_disconnected(IRC_SERVER_REC *server) { g_return_if_fail(server != NULL); @@ -646,6 +662,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("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end); signal_add("server lag disconnect", (SIGNAL_FUNC) sig_server_lag_disconnected); signal_add("server reconnect remove", (SIGNAL_FUNC) sig_server_reconnect_removed); @@ -678,6 +695,7 @@ 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("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end); signal_remove("server lag disconnect", (SIGNAL_FUNC) sig_server_lag_disconnected); signal_remove("server reconnect remove", (SIGNAL_FUNC) sig_server_reconnect_removed); diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index 244ec7f1..447ce8fe 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -122,6 +122,7 @@ FORMAT_REC fecommon_irc_formats[] = { { NULL, "Who queries", 0 }, { "whois", "%_$0%_ %K[%n$1@$2%K]%n%: ircname : $3", 4, { 0, 0, 0, 0 } }, + { "whowas", "%_$0%_ %K[%n$1@$2%K]%n%: ircname : $3", 4, { 0, 0, 0, 0 } }, { "whois_idle", " idle : $1 hours $2 mins $3 secs", 4, { 0, 1, 1, 1 } }, { "whois_idle_signon", " idle : $1 hours $2 mins $3 secs %K[%nsignon: $4%K]", 5, { 0, 1, 1, 1, 0 } }, { "whois_server", " server : $1 %K[%n$2%K]", 3, { 0, 0, 0 } }, @@ -129,6 +130,8 @@ FORMAT_REC fecommon_irc_formats[] = { { "whois_channels", " channels : $1", 2, { 0, 0 } }, { "whois_away", " away : $1", 2, { 0, 0 } }, { "end_of_whois", "End of WHOIS", 1, { 0 } }, + { "end_of_whowas", "End of WHOWAS", 1, { 0 } }, + { "whois_not_found", "There is no such nick $0", 1, { 0 } }, { "who", "$[-10]0 %|%_$[!9]1%_ $[!3]2 $[!2]3 $4@$5 %K(%W$6%K)", 7, { 0, 0, 0, 0, 0, 0, 0 } }, { "end_of_who", "End of /WHO list", 1, { 0 } }, diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h index e5fc2def..1450b7cf 100644 --- a/src/fe-common/irc/module-formats.h +++ b/src/fe-common/irc/module-formats.h @@ -97,6 +97,7 @@ enum { IRCTXT_FILL_5, IRCTXT_WHOIS, + IRCTXT_WHOWAS, IRCTXT_WHOIS_IDLE, IRCTXT_WHOIS_IDLE_SIGNON, IRCTXT_WHOIS_SERVER, @@ -104,6 +105,8 @@ enum { IRCTXT_WHOIS_CHANNELS, IRCTXT_WHOIS_AWAY, IRCTXT_END_OF_WHOIS, + IRCTXT_END_OF_WHOWAS, + IRCTXT_WHOIS_NOT_FOUND, IRCTXT_WHO, IRCTXT_END_OF_WHO, |