summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-19 23:04:58 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-19 23:04:58 +0000
commita9428129a55afe562bed60e80cfc78ccdc1c52fe (patch)
tree1a73d0305af5f7d2683cf6b87057fec409435d2b /src/fe-common
parent32f26d0ff5e07faedb3b7fe44fec61ab7b3ec041 (diff)
downloadirssi-a9428129a55afe562bed60e80cfc78ccdc1c52fe.zip
378 event (whois realhost) data is different between irc servers, so added
support for another server. Also added support for 377 event (whois usermode). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2107 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c33
-rw-r--r--src/fe-common/irc/module-formats.c1
-rw-r--r--src/fe-common/irc/module-formats.h1
3 files changed, 30 insertions, 5 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index d219b9a7..1c0746cf 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -436,17 +436,38 @@ static void event_whois_modes(IRC_SERVER_REC *server, const char *data)
static void event_whois_realhost(IRC_SERVER_REC *server, const char *data)
{
- char *params, *nick, *str, *from;
+ char *params, *nick, *txt_real, *txt_hostname, *hostname, *from;
g_return_if_fail(data != NULL);
- params = event_get_params(data, 3, NULL, &nick, &str);
+ /* <yournick> real hostname <nick> <hostname> */
+ params = event_get_params(data, 5, NULL, &nick, &txt_real,
+ &txt_hostname, &hostname);
+ if (strcmp(txt_real, "real") != 0 ||
+ strcmp(txt_hostname, "hostname") != 0) {
+ /* <yournick> <nick> :... from <hostname> */
+ params = event_get_params(data, 3, NULL, &nick, &hostname);
+
+ from = strstr(hostname, "from ");
+ if (from != NULL) hostname = from+5;
+ }
+
+ printformat(server, nick, MSGLEVEL_CRAP,
+ IRCTXT_WHOIS_REALHOST, nick, hostname);
+ g_free(params);
+}
+
+static void event_whois_usermode(IRC_SERVER_REC *server, const char *data)
+{
+ char *params, *txt_usermodes, *nick, *usermode;
+
+ g_return_if_fail(data != NULL);
- from = strstr(str, "from ");
- if (from == NULL) from = str; else from += 5;
+ params = event_get_params(data, 4, NULL, &txt_usermodes,
+ &nick, &usermode);
printformat(server, nick, MSGLEVEL_CRAP,
- IRCTXT_WHOIS_REALHOST, nick, from);
+ IRCTXT_WHOIS_USERMODE, nick, usermode);
g_free(params);
}
@@ -757,6 +778,7 @@ void fe_events_numeric_init(void)
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 377", (SIGNAL_FUNC) event_whois_usermode);
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);
@@ -832,6 +854,7 @@ void fe_events_numeric_deinit(void)
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 377", (SIGNAL_FUNC) event_whois_usermode);
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);
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index d96838da..9685afc5 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -103,6 +103,7 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "whois_help", "{whois is available for help}", 1, { 0 } },
{ "whois_modes", " {whois modes $1}", 2, { 0, 0 } },
{ "whois_realhost", "{whois hostname $1}", 2, { 0, 0 } },
+ { "whois_usermode", "{whois usermode $1}", 2, { 0, 0 } },
{ "whois_channels", "{whois channels %|$1}", 2, { 0, 0 } },
{ "whois_away", "{whois away %|$1}", 2, { 0, 0 } },
{ "whois_special", "{whois %|{hilight $1}}", 2, { 0, 0 } },
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index 508efb51..0b6e0015 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -78,6 +78,7 @@ enum {
IRCTXT_WHOIS_HELP,
IRCTXT_WHOIS_MODES,
IRCTXT_WHOIS_REALHOST,
+ IRCTXT_WHOIS_USERMODE,
IRCTXT_WHOIS_CHANNELS,
IRCTXT_WHOIS_AWAY,
IRCTXT_WHOIS_SPECIAL,