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); + /* real 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) { + /* :... from */ + params = event_get_params(data, 3, NULL, &nick, &hostname); - from = strstr(str, "from "); - if (from == NULL) from = str; else from += 5; + from = strstr(hostname, "from "); + if (from != NULL) hostname = from+5; + } printformat(server, nick, MSGLEVEL_CRAP, - IRCTXT_WHOIS_REALHOST, nick, from); + 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); + + params = event_get_params(data, 4, NULL, &txt_usermodes, + &nick, &usermode); + + printformat(server, nick, MSGLEVEL_CRAP, + 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,