diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index ddd4311e..7eb2fff1 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -71,8 +72,12 @@ static void sig_message_irc_op_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target) { - char *nickmode, *optarget, *prefix; + CHANNEL_REC *chanrec; + char *nickmode, *optarget, *prefix, *color; const char *cleantarget; + int for_me, level; + HILIGHT_REC *hilight; + TEXT_DEST_REC dest; /* only skip here so the difference can be stored in prefix */ cleantarget = fe_channel_skip_prefix(IRC_SERVER(server), target); @@ -86,10 +91,34 @@ static void sig_message_irc_op_public(SERVER_REC *server, const char *msg, optarget = g_strconcat(prefix, cleantarget, NULL); - printformat_module("fe-common/core", server, cleantarget, - MSGLEVEL_PUBLIC, - TXT_PUBMSG_CHANNEL, - nick, optarget, msg, nickmode); + chanrec = channel_find(server, target); + + /* Check for hilights */ + for_me = !settings_get_bool("hilight_nick_matches") ? FALSE : + !settings_get_bool("hilight_nick_matches_everywhere") ? + nick_match_msg(chanrec, msg, server->nick) : + nick_match_msg_everywhere(chanrec, msg, server->nick); + hilight = for_me ? NULL : + hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg); + color = (hilight == NULL) ? NULL : hilight_get_color(hilight); + + level = MSGLEVEL_PUBLIC; + if (for_me) + level |= MSGLEVEL_HILIGHT; + + if (color != NULL) { + format_create_dest(&dest, server, cleantarget, level, NULL); + dest.address = address; + dest.nick = nick; + hilight_update_text_dest(&dest,hilight); + printformat_module_dest("fe-common/core", &dest, + TXT_PUBMSG_HILIGHT_CHANNEL, + color, nick, optarget, msg, nickmode); + } else { + printformat_module("fe-common/core", server, cleantarget, level, + for_me ? TXT_PUBMSG_ME_CHANNEL : TXT_PUBMSG_CHANNEL, + nick, optarget, msg, nickmode); + } g_free(nickmode); g_free(optarget); g_free(prefix);