summaryrefslogtreecommitdiff
path: root/src/fe-common/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-21 18:32:15 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-21 18:32:15 +0000
commit4a35a41c85d6fea8668553d135f7947f26313254 (patch)
treea26d33e8ea2ed36be6ed500e3dfbb8565fa7212f /src/fe-common/irc
parentdb4e159870ab950ade8426db61a5af856b4326ac (diff)
downloadirssi-4a35a41c85d6fea8668553d135f7947f26313254.zip
Support for several unrealircd WHOIS replies, patch by Mark Glines
<paranoid@deathsdoor.com> git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1275 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c74
-rw-r--r--src/fe-common/irc/module-formats.c5
-rw-r--r--src/fe-common/irc/module-formats.h5
3 files changed, 81 insertions, 3 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index a4c18c54..9252e601 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -345,12 +345,19 @@ static void event_whois_server(IRC_SERVER_REC *server, const char *data)
static void event_whois_oper(IRC_SERVER_REC *server, const char *data)
{
- char *params, *nick;
+ char *params, *nick, *type;
g_return_if_fail(data != NULL);
- params = event_get_params(data, 2, NULL, &nick);
- printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_OPER, nick);
+ params = event_get_params(data, 3, NULL, &nick, &type);
+ if (strlen(type) > 5) {
+ type += 5;
+ if (*type == ' ') type++;
+ }
+
+ printformat(server, nick, MSGLEVEL_CRAP,
+ *type == '\0' ? IRCTXT_WHOIS_OPER :
+ IRCTXT_WHOIS_OPER_TYPE, nick, type);
g_free(params);
}
@@ -365,6 +372,59 @@ static void event_whois_registered(IRC_SERVER_REC *server, const char *data)
g_free(params);
}
+static void event_whois_help(IRC_SERVER_REC *server, const char *data)
+{
+ char *params, *nick;
+
+ g_return_if_fail(data != NULL);
+
+ params = event_get_params(data, 2, NULL, &nick);
+ printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_HELP, nick);
+ g_free(params);
+}
+
+static void event_whois_modes(IRC_SERVER_REC *server, const char *data)
+{
+ char *params, *nick, *modes;
+
+ g_return_if_fail(data != NULL);
+
+ params = event_get_params(data, 6, NULL, &nick,
+ NULL, NULL, NULL, &modes);
+
+ printformat(server, nick, MSGLEVEL_CRAP,
+ IRCTXT_WHOIS_MODES, nick, modes);
+ g_free(params);
+}
+
+static void event_whois_realhost(IRC_SERVER_REC *server, const char *data)
+{
+ char *params, *nick, *str, *from;
+
+ g_return_if_fail(data != NULL);
+
+ params = event_get_params(data, 3, NULL, &nick, &str);
+
+ from = strstr(str, "from ");
+ if (from == NULL) from = str; else from += 5;
+
+ printformat(server, nick, MSGLEVEL_CRAP,
+ IRCTXT_WHOIS_REALHOST, nick, from);
+ g_free(params);
+}
+
+static void event_whois_special(IRC_SERVER_REC *server, const char *data)
+{
+ char *params, *nick, *str;
+
+ g_return_if_fail(data != NULL);
+
+ params = event_get_params(data, 3, NULL, &nick, &str);
+ printformat(server, nick, MSGLEVEL_CRAP,
+ IRCTXT_WHOIS_SPECIAL, nick, str);
+ g_free(params);
+}
+
static void event_whowas(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick, *user, *host, *realname;
@@ -639,6 +699,10 @@ void fe_events_numeric_init(void)
signal_add("event 312", (SIGNAL_FUNC) event_whois_server);
signal_add("event 313", (SIGNAL_FUNC) event_whois_oper);
signal_add("event 307", (SIGNAL_FUNC) event_whois_registered);
+ signal_add("event 310", (SIGNAL_FUNC) event_whois_help);
+ signal_add("event 379", (SIGNAL_FUNC) event_whois_modes);
+ signal_add("event 378", (SIGNAL_FUNC) event_whois_realhost);
+ signal_add("event 320", (SIGNAL_FUNC) event_whois_special);
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);
@@ -703,6 +767,10 @@ void fe_events_numeric_deinit(void)
signal_remove("event 312", (SIGNAL_FUNC) event_whois_server);
signal_remove("event 313", (SIGNAL_FUNC) event_whois_oper);
signal_remove("event 307", (SIGNAL_FUNC) event_whois_registered);
+ signal_remove("event 310", (SIGNAL_FUNC) event_whois_help);
+ signal_remove("event 379", (SIGNAL_FUNC) event_whois_modes);
+ signal_remove("event 378", (SIGNAL_FUNC) event_whois_realhost);
+ signal_remove("event 320", (SIGNAL_FUNC) event_whois_special);
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);
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index ead4b193..faae5de2 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -100,9 +100,14 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "whois_idle_signon", " idle : $1 days $2 hours $3 mins $4 secs {comment signon: $5}", 6, { 0, 1, 1, 1, 1, 0 } },
{ "whois_server", " server : $1 {comment $2}", 3, { 0, 0, 0 } },
{ "whois_oper", " : {hilight IRC operator}", 1, { 0 } },
+ { "whois_oper_type", " : {hilight $1}", 2, { 0, 0 } },
{ "whois_registered", " : has registered this nick", 1, { 0 } },
+ { "whois_help", " : is available for help", 1, { 0 } },
+ { "whois_modes", " modes : $1", 2, { 0, 0 } },
+ { "whois_realhost", " hostname : $1", 2, { 0, 0 } },
{ "whois_channels", " channels : $1", 2, { 0, 0 } },
{ "whois_away", " away : $1", 2, { 0, 0 } },
+ { "whois_special", " : $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 } },
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index 5ca2673a..fc33dba1 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -75,9 +75,14 @@ enum {
IRCTXT_WHOIS_IDLE_SIGNON,
IRCTXT_WHOIS_SERVER,
IRCTXT_WHOIS_OPER,
+ IRCTXT_WHOIS_OPER_TYPE,
IRCTXT_WHOIS_REGISTERED,
+ IRCTXT_WHOIS_HELP,
+ IRCTXT_WHOIS_MODES,
+ IRCTXT_WHOIS_REALHOST,
IRCTXT_WHOIS_CHANNELS,
IRCTXT_WHOIS_AWAY,
+ IRCTXT_WHOIS_SPECIAL,
IRCTXT_END_OF_WHOIS,
IRCTXT_END_OF_WHOWAS,
IRCTXT_WHOIS_NOT_FOUND,