diff options
| -rw-r--r-- | src/irc.c | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -514,6 +514,10 @@ static void invalid_msg(char type) { } #endif +static char cmd_is(const char *cmd) { + return streq_i(msg_cmd, cmd); +} + void select_screen(void) { char s; if(!msg_dest) { @@ -528,7 +532,7 @@ void select_screen(void) { } else { s = scr_getbyname(msg_src); if(!s) { - if(streq_i(msg_cmd, "PRIVMSG")) { /* or maybe NOTICE? */ + if(cmd_is("PRIVMSG")) { /* or maybe NOTICE? */ strncpy(last_pm_nick, msg_src, 32); comp_add_pm_nick(last_pm_nick); s = SCR_PRIV; @@ -546,26 +550,26 @@ static void dispatch_msg(void) { select_screen(); new_scr_status = SCR_OTHER; - if(streq_i(msg_cmd, "PRIVMSG")) { + if(cmd_is("PRIVMSG")) { new_scr_status = SCR_ACTIVE; do_privmsg(); - } else if(streq_i(msg_cmd, "NOTICE")) { + } else if(cmd_is("NOTICE")) { do_notice(); - } else if(streq_i(msg_cmd, "JOIN")) { + } else if(cmd_is("JOIN")) { do_join(); - } else if(streq_i(msg_cmd, "NICK")) { + } else if(cmd_is("NICK")) { do_nick(); - } else if(streq_i(msg_cmd, "QUIT")) { + } else if(cmd_is("QUIT")) { do_quit(); - } else if(streq_i(msg_cmd, "PART")) { + } else if(cmd_is("PART")) { do_part(); - } else if(streq_i(msg_cmd, "TOPIC")) { + } else if(cmd_is("TOPIC")) { do_topic(); - } else if(streq_i(msg_cmd, "KICK")) { + } else if(cmd_is("KICK")) { do_kick(); - } else if(streq_i(msg_cmd, "MODE")) { + } else if(cmd_is("MODE")) { do_mode(); - } else if(streq_i(msg_cmd, "PONG")) { + } else if(cmd_is("PONG")) { if(*msg_text == 'A') { return; /* do not set screen status */ } else { |
