From 6534919868501fbe52cc0cfcf1d3172329513cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 19 Sep 2024 08:35:56 +0200 Subject: [PATCH] irc: decode IRC color codes only when displaying messages Before parsing IRC messages, they were almost all changed to convert IRC color codes to WeeChat color codes, which caused some bugs when storing data like account and real names (stored with WeeChat color codes instead of IRC colors). Now the messages are parsed as-is, then the colors are converted only when strings are displayed in a buffer by `weechat_printf()`. --- CHANGELOG.md | 1 + src/plugins/irc/irc-channel.c | 2 +- src/plugins/irc/irc-color.c | 39 + src/plugins/irc/irc-color.h | 7 + src/plugins/irc/irc-ctcp.c | 20 +- src/plugins/irc/irc-input.c | 8 +- src/plugins/irc/irc-protocol.c | 909 +++++++++---------- src/plugins/irc/irc-protocol.h | 4 +- src/plugins/irc/irc.c | 2 + tests/unit/plugins/irc/test-irc-protocol.cpp | 748 +++++++-------- 10 files changed, 885 insertions(+), 855 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 871ff7a7c..6ee25791b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Fixed - core, plugins: fix integer overflow in loops ([#2178](https://github.com/weechat/weechat/issues/2178)) +- irc: decode IRC colors only when displaying messages in buffer, store nick info with IRC colors (host, account, real name) - irc: do not strip trailing spaces from incoming IRC messages - relay/api: fix empty nicklist in remote buffers after connection or reconnection - lua: fix compilation on Fedora with Lua < 5.2.0 ([#2173](https://github.com/weechat/weechat/issues/2173), [#2174](https://github.com/weechat/weechat/issues/2174)) diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 0444b075f..f58999e17 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -1593,7 +1593,7 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server, (nick) ? nick->name : nickname, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - (nick && nick->host) ? nick->host : "", + (nick && nick->host) ? IRC_COLOR_MSG(nick->host) : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_MESSAGE_JOIN); } diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c index c4d263165..50dc75367 100644 --- a/src/plugins/irc/irc-color.c +++ b/src/plugins/irc/irc-color.c @@ -81,6 +81,8 @@ char irc_color_term2irc[IRC_COLOR_TERM2IRC_NUM_COLORS] = 0, /* 15 0 (white) */ }; regex_t *irc_color_regex_ansi = NULL; +int irc_color_index_string_decoded = 0; +char *irc_color_string_decoded[32]; /* @@ -484,6 +486,26 @@ irc_color_decode (const char *string, int keep_colors) return weechat_string_dyn_free (out, 0); } +/* + * Replaces IRC colors by WeeChat colors and returns a pointer to an allocated + * string that doesn't need to be freed by the caller. + * + * If keep_colors == 0: removes any color/style in message otherwise keeps + * colors. + */ + +const char * +irc_color_decode_const (const char *string, int keep_colors) +{ + irc_color_index_string_decoded = (irc_color_index_string_decoded + 1) % 32; + free (irc_color_string_decoded[irc_color_index_string_decoded]); + irc_color_string_decoded[irc_color_index_string_decoded] = irc_color_decode ( + string, keep_colors); + if (!irc_color_string_decoded[irc_color_index_string_decoded]) + irc_color_string_decoded[irc_color_index_string_decoded] = strdup (""); + return (const char *)irc_color_string_decoded[irc_color_index_string_decoded]; +} + /* * Replaces color codes in command line by IRC color codes. * @@ -1053,6 +1075,17 @@ irc_color_weechat_add_to_infolist (struct t_infolist *infolist) return 1; } +/* + * Initializes IRC colors. + */ + +void +irc_color_init () +{ + irc_color_index_string_decoded = 0; + memset (irc_color_string_decoded, 0, sizeof (irc_color_string_decoded)); +} + /* * Ends IRC colors. */ @@ -1060,10 +1093,16 @@ irc_color_weechat_add_to_infolist (struct t_infolist *infolist) void irc_color_end () { + int i; + if (irc_color_regex_ansi) { regfree (irc_color_regex_ansi); free (irc_color_regex_ansi); irc_color_regex_ansi = NULL; } + for (i = 0; i < 32; i++) + { + free (irc_color_string_decoded[i]); + } } diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h index b236355ac..bad584e45 100644 --- a/src/plugins/irc/irc-color.h +++ b/src/plugins/irc/irc-color.h @@ -104,6 +104,11 @@ #define IRC_COLOR_ITEM_TLS_VERSION_DEPRECATED weechat_color(weechat_config_string(irc_config_color_item_tls_version_deprecated)) #define IRC_COLOR_ITEM_TLS_VERSION_INSECURE weechat_color(weechat_config_string(irc_config_color_item_tls_version_insecure)) +#define IRC_COLOR_MSG(__string) \ + irc_color_decode_const ( \ + __string, \ + weechat_config_boolean (irc_config_network_colors_receive)) + struct t_irc_color_ansi_state { char keep_colors; @@ -113,6 +118,7 @@ struct t_irc_color_ansi_state }; extern char *irc_color_decode (const char *string, int keep_colors); +extern const char *irc_color_decode_const (const char *string, int keep_colors); extern char *irc_color_encode (const char *string, int keep_colors); extern char *irc_color_decode_ansi (const char *string, int keep_colors); extern char *irc_color_modifier_cb (const void *pointer, void *data, @@ -121,6 +127,7 @@ extern char *irc_color_modifier_cb (const void *pointer, void *data, const char *string); extern char *irc_color_for_tags (const char *color); extern int irc_color_weechat_add_to_infolist (struct t_infolist *infolist); +extern void irc_color_init (); extern void irc_color_end (); #endif /* WEECHAT_PLUGIN_IRC_COLOR_H */ diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 9d5968f43..0d1b54eb4 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -238,8 +238,8 @@ irc_ctcp_display_request (struct t_irc_protocol_ctxt *ctxt, IRC_COLOR_CHAT_CHANNEL, ctcp, IRC_COLOR_RESET, - (arguments) ? " " : "", - (arguments) ? arguments : "", + (arguments && arguments[0]) ? " " : "", + (arguments && arguments[0]) ? arguments : "", (reply && !reply[0]) ? _(" (blocked)") : ""); } @@ -327,7 +327,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_protocol_ctxt *ctxt, ptr_args + 1, IRC_COLOR_RESET, " ", - pos_args); + IRC_COLOR_MSG(pos_args)); } } else @@ -382,7 +382,7 @@ irc_ctcp_display_reply_to_nick_internal (struct t_irc_protocol_ctxt *ctxt, type, (args && args[0]) ? IRC_COLOR_RESET : "", (args && args[0]) ? " " : "", - (args) ? args : ""); + (args && args[0]) ? IRC_COLOR_MSG(args) : ""); } /* @@ -1481,7 +1481,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt, ctxt->nick, (pos_args) ? IRC_COLOR_RESET : "", (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + (pos_args) ? IRC_COLOR_MSG(pos_args) : ""); } else { @@ -1502,7 +1502,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt, ctxt->nick, (pos_args) ? IRC_COLOR_RESET : "", (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + (pos_args) ? IRC_COLOR_MSG(pos_args) : ""); } free (nick_color); } @@ -1545,7 +1545,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt, ctxt->nick, (pos_args) ? IRC_COLOR_RESET : "", (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + (pos_args) ? IRC_COLOR_MSG(pos_args) : ""); (void) weechat_hook_signal_send ("irc_pv", WEECHAT_HOOK_SIGNAL_STRING, (void *)ctxt->irc_message); @@ -1558,7 +1558,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt, reply = irc_ctcp_get_reply (ctxt->server, ptr_args + 1); irc_ctcp_display_request (ctxt, channel, ptr_args + 1, - pos_args, reply); + IRC_COLOR_MSG(pos_args), reply); if (!reply || reply[0]) { if (reply) @@ -1588,7 +1588,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt, if (reply) { irc_ctcp_display_request (ctxt, channel, - ptr_args + 1, pos_args, + ptr_args + 1, IRC_COLOR_MSG(pos_args), reply); if (reply[0]) @@ -1621,7 +1621,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt, ptr_args + 1, (pos_args) ? IRC_COLOR_RESET : "", (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + (pos_args) ? IRC_COLOR_MSG(pos_args) : ""); } } } diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index ccec96f72..d651107d6 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -193,7 +193,7 @@ irc_input_user_message_display (struct t_irc_server *server, server->nick, (ptr_text && ptr_text[0]) ? IRC_COLOR_RESET : "", (ptr_text && ptr_text[0]) ? " " : "", - (ptr_text && ptr_text[0]) ? ptr_text : ""); + IRC_COLOR_MSG(ptr_text)); } else { @@ -209,7 +209,7 @@ irc_input_user_message_display (struct t_irc_server *server, server->nick, IRC_COLOR_RESET, (ptr_text && ptr_text[0]) ? " " : "", - (ptr_text && ptr_text[0]) ? ptr_text : ""); + IRC_COLOR_MSG(ptr_text)); } } else if (ctcp_type) @@ -229,7 +229,7 @@ irc_input_user_message_display (struct t_irc_server *server, ctcp_type, IRC_COLOR_RESET, (ptr_text && ptr_text[0]) ? " " : "", - (ptr_text && ptr_text[0]) ? ptr_text : ""); + IRC_COLOR_MSG(ptr_text)); } else if (display_target) { @@ -256,7 +256,7 @@ irc_input_user_message_display (struct t_irc_server *server, IRC_COLOR_CHAT_CHANNEL : irc_nick_color_for_msg (server, 0, NULL, target), target, IRC_COLOR_RESET, - (ptr_text) ? ptr_text : ""); + IRC_COLOR_MSG(ptr_text)); } else { diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index e181c5fab..1d4b657d9 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -351,7 +351,7 @@ irc_protocol_nick_address (struct t_irc_server *server, nickname, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - address, + IRC_COLOR_MSG(address), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET); } @@ -426,10 +426,10 @@ irc_protocol_print_error_warning_msg (struct t_irc_protocol_ctxt *ctxt, (ptr_command) ? " " : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (str_context) ? str_context : "", + (str_context) ? IRC_COLOR_MSG(str_context) : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - ctxt->params[ctxt->num_params - 1]); + IRC_COLOR_MSG(ctxt->params[ctxt->num_params - 1])); free (str_context); } @@ -464,7 +464,7 @@ IRC_PROTOCOL_CALLBACK(account) snprintf (str_account, sizeof (str_account), "%s%s", irc_nick_color_for_msg (ctxt->server, 1, NULL, pos_account), - pos_account); + IRC_COLOR_MSG(pos_account)); } cap_account_notify = weechat_hashtable_has_key (ctxt->server->cap_list, @@ -1382,7 +1382,7 @@ IRC_PROTOCOL_CALLBACK(cap) IRC_PROTOCOL_CALLBACK(chghost) { - int length, smart_filter; + int smart_filter; char *str_host, str_tags[512]; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; @@ -1391,20 +1391,10 @@ IRC_PROTOCOL_CALLBACK(chghost) IRC_PROTOCOL_MIN_PARAMS(2); IRC_PROTOCOL_CHECK_NICK; - length = strlen (ctxt->params[0]) + 1 + strlen (ctxt->params[1]) + 1; - str_host = malloc (length); - if (!str_host) - { - weechat_printf ( - ctxt->server->buffer, - _("%s%s: not enough memory for \"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "chghost"); - return WEECHAT_RC_OK; - } - snprintf (str_host, length, "%s@%s", ctxt->params[0], ctxt->params[1]); + weechat_asprintf (&str_host, "%s@%s", ctxt->params[0], ctxt->params[1]); if (ctxt->nick_is_me) - irc_server_set_host (ctxt->server, str_host); + irc_server_set_host (ctxt->server, (str_host) ? str_host : "?"); for (ptr_channel = ctxt->server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) @@ -1417,7 +1407,8 @@ IRC_PROTOCOL_CALLBACK(chghost) ptr_channel->name, ctxt->nick) == 0)) { snprintf (str_tags, sizeof (str_tags), - "new_host_%s", str_host); + "new_host_%s", + (str_host) ? str_host : "?"); weechat_printf_datetime_tags ( irc_msgbuffer_get_target_buffer ( ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer), @@ -1430,11 +1421,11 @@ IRC_PROTOCOL_CALLBACK(chghost) ctxt->nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - (ctxt->address) ? ctxt->address : "", + (ctxt->address) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_MESSAGE_CHGHOST, IRC_COLOR_CHAT_HOST, - str_host); + (str_host) ? IRC_COLOR_MSG(str_host) : "?"); } break; case IRC_CHANNEL_TYPE_CHANNEL: @@ -1452,7 +1443,7 @@ IRC_PROTOCOL_CALLBACK(chghost) && !ptr_nick_speaking); snprintf (str_tags, sizeof (str_tags), "new_host_%s%s%s", - str_host, + (str_host) ? str_host : "?", (smart_filter) ? "," : "", (smart_filter) ? "irc_smart_filter" : ""); weechat_printf_datetime_tags ( @@ -1467,13 +1458,13 @@ IRC_PROTOCOL_CALLBACK(chghost) ctxt->nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - (ctxt->address) ? ctxt->address : "", + (ctxt->address) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_MESSAGE_CHGHOST, IRC_COLOR_CHAT_HOST, - str_host); + (str_host) ? IRC_COLOR_MSG(str_host) : "?"); } - irc_nick_set_host (ptr_nick, str_host); + irc_nick_set_host (ptr_nick, (str_host) ? str_host : "?"); } break; } @@ -1506,7 +1497,7 @@ IRC_PROTOCOL_CALLBACK(error) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("error"), - str_error); + IRC_COLOR_MSG(str_error)); if (str_error && (strncmp (str_error, "Closing Link", 12) == 0)) irc_server_disconnect (ctxt->server, !ctxt->server->is_connected, 1); @@ -1608,7 +1599,7 @@ IRC_PROTOCOL_CALLBACK(generic_error) "%s%s%s", weechat_prefix ("network"), str_target, - str_error); + IRC_COLOR_MSG(str_error)); free (str_error); @@ -1667,7 +1658,7 @@ IRC_PROTOCOL_CALLBACK(invite) _("%sYou have been invited to %s%s%s by %s%s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->nick), ctxt->nick, @@ -1688,10 +1679,10 @@ IRC_PROTOCOL_CALLBACK(invite) ctxt->nick, IRC_COLOR_RESET, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[0]), - ctxt->params[0], + ctxt->params[0], /* nick */ IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET); } @@ -1737,7 +1728,7 @@ IRC_PROTOCOL_CALLBACK(join) "%s [%s%s%s]", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - pos_account, + IRC_COLOR_MSG(pos_account), IRC_COLOR_CHAT_DELIMITERS); } @@ -1749,7 +1740,7 @@ IRC_PROTOCOL_CALLBACK(join) "%s (%s%s%s)", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - pos_realname, + IRC_COLOR_MSG(pos_realname), IRC_COLOR_CHAT_DELIMITERS); } @@ -1802,9 +1793,15 @@ IRC_PROTOCOL_CALLBACK(join) } /* add nick in channel */ - ptr_nick = irc_nick_new (ctxt->server, ptr_channel, ctxt->nick, ctxt->address, NULL, 0, - (pos_account) ? pos_account : NULL, - (pos_realname) ? pos_realname : NULL); + ptr_nick = irc_nick_new ( + ctxt->server, + ptr_channel, + ctxt->nick, + ctxt->address, + NULL, /* prefixes */ + 0, /* away */ + (pos_account) ? pos_account : NULL, + (pos_realname) ? pos_realname : NULL); /* rename the nick if it was in list with a different case */ irc_channel_nick_speaking_rename_if_present (ctxt->server, ptr_channel, ctxt->nick); @@ -1844,12 +1841,12 @@ IRC_PROTOCOL_CALLBACK(join) IRC_COLOR_CHAT_DELIMITERS, (display_host) ? " (" : "", IRC_COLOR_CHAT_HOST, - (display_host) ? ctxt->address : "", + (display_host) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, (display_host) ? ")" : "", IRC_COLOR_MESSAGE_JOIN, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[0], + ctxt->params[0], /* channel */ IRC_COLOR_MESSAGE_JOIN); /* @@ -1940,11 +1937,11 @@ IRC_PROTOCOL_CALLBACK(kick) ctxt->nick, IRC_COLOR_MESSAGE_KICK, irc_nick_color_for_msg (ctxt->server, 1, ptr_nick_kicked, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_MESSAGE_KICK, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_REASON_KICK, - pos_comment, + IRC_COLOR_MSG(pos_comment), IRC_COLOR_CHAT_DELIMITERS); } else @@ -1961,7 +1958,7 @@ IRC_PROTOCOL_CALLBACK(kick) ctxt->nick, IRC_COLOR_MESSAGE_KICK, irc_nick_color_for_msg (ctxt->server, 1, ptr_nick_kicked, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_MESSAGE_KICK); } @@ -2064,7 +2061,7 @@ IRC_PROTOCOL_CALLBACK(kill) IRC_COLOR_MESSAGE_KICK, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_REASON_KICK, - pos_comment, + IRC_COLOR_MSG(pos_comment), IRC_COLOR_CHAT_DELIMITERS); } else @@ -2136,9 +2133,9 @@ IRC_PROTOCOL_CALLBACK(knock_reply) "%s%s%s%s: %s", weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, - str_message); + IRC_COLOR_MSG(str_message)); free (str_message); @@ -2194,7 +2191,7 @@ IRC_PROTOCOL_CALLBACK(mode) (ptr_channel) ? ptr_channel->name : ctxt->params[0], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - ctxt->params[1], + ctxt->params[1], /* mode */ (modes_args && modes_args[0]) ? " " : "", (modes_args && modes_args[0]) ? modes_args : "", IRC_COLOR_CHAT_DELIMITERS, @@ -2214,7 +2211,7 @@ IRC_PROTOCOL_CALLBACK(mode) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - ctxt->params[1], + ctxt->params[1], /* mode */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->nick), @@ -2643,9 +2640,9 @@ IRC_PROTOCOL_CALLBACK(notice) IRC_COLOR_RESET, (is_channel_orig) ? " -> " : "", (is_channel_orig) ? IRC_COLOR_CHAT_CHANNEL : "", - (is_channel_orig) ? ctxt->params[0] : "", + (is_channel_orig) ? ctxt->params[0] : "", /* channel */ (is_channel_orig) ? IRC_COLOR_RESET : "", - pos_args); + IRC_COLOR_MSG(pos_args)); } else { @@ -2712,7 +2709,7 @@ IRC_PROTOCOL_CALLBACK(notice) irc_nick_color_for_msg (ctxt->server, 0, NULL, ctxt->nick), ctxt->nick, IRC_COLOR_RESET, - pos_args); + IRC_COLOR_MSG(pos_args)); if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) && ptr_channel->has_quit_server) { @@ -2746,7 +2743,7 @@ IRC_PROTOCOL_CALLBACK(notice) irc_nick_color_for_msg (ctxt->server, 0, NULL, pos_target), pos_target, IRC_COLOR_RESET, - pos_args); + IRC_COLOR_MSG(pos_args)); } else { @@ -2754,8 +2751,8 @@ IRC_PROTOCOL_CALLBACK(notice) irc_config_look_display_host_notice); nick_address = irc_protocol_nick_address ( ctxt->server, - 0, - NULL, + 0, /* server_message */ + NULL, /* nick */ ctxt->nick, (display_host) ? ctxt->address : NULL); weechat_printf_datetime_tags ( @@ -2769,7 +2766,7 @@ IRC_PROTOCOL_CALLBACK(notice) weechat_prefix ("network"), nick_address, (nick_address[0]) ? ": " : "", - pos_args); + IRC_COLOR_MSG(pos_args)); } } } @@ -2845,7 +2842,7 @@ IRC_PROTOCOL_CALLBACK(part) IRC_COLOR_CHAT_DELIMITERS, (display_host) ? " (" : "", IRC_COLOR_CHAT_HOST, - (display_host) ? ctxt->address : "", + (display_host) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, (display_host) ? ")" : "", IRC_COLOR_MESSAGE_QUIT, @@ -2854,7 +2851,7 @@ IRC_PROTOCOL_CALLBACK(part) IRC_COLOR_MESSAGE_QUIT, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_REASON_QUIT, - str_comment, + IRC_COLOR_MSG(str_comment), IRC_COLOR_CHAT_DELIMITERS); } else @@ -2879,7 +2876,7 @@ IRC_PROTOCOL_CALLBACK(part) IRC_COLOR_CHAT_DELIMITERS, (display_host) ? " (" : "", IRC_COLOR_CHAT_HOST, - (display_host) ? ctxt->address : "", + (display_host) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, (display_host) ? ")" : "", IRC_COLOR_MESSAGE_QUIT, @@ -3004,7 +3001,7 @@ IRC_PROTOCOL_CALLBACK(pong) irc_protocol_tags (ctxt, NULL), "PONG%s%s", (str_params) ? ": " : "", - (str_params) ? str_params : ""); + (str_params) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); } @@ -3119,7 +3116,9 @@ IRC_PROTOCOL_CALLBACK(privmsg) if (ctxt->nick_is_me) { irc_protocol_privmsg_display_ctcp_send ( - ctxt, ctxt->params[0], msg_args); + ctxt, + ctxt->params[0], /* channel */ + msg_args); } else { @@ -3161,9 +3160,9 @@ IRC_PROTOCOL_CALLBACK(privmsg) IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[0], + ctxt->params[0], /* channel */ IRC_COLOR_RESET, - msg_args); + IRC_COLOR_MSG(msg_args)); } else { @@ -3197,7 +3196,7 @@ IRC_PROTOCOL_CALLBACK(privmsg) irc_nick_as_prefix (ctxt->server, ptr_nick, (ptr_nick) ? NULL : ctxt->nick, NULL), - msg_args); + IRC_COLOR_MSG(msg_args)); } irc_channel_nick_speaking_add ( @@ -3347,7 +3346,7 @@ IRC_PROTOCOL_CALLBACK(privmsg) (ctxt->nick_is_me) ? IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, ctxt->nick)), - (msg_args2) ? msg_args2 : msg_args); + IRC_COLOR_MSG((msg_args2) ? msg_args2 : msg_args)); } free (msg_args2); @@ -3441,13 +3440,13 @@ IRC_PROTOCOL_CALLBACK(quit) IRC_COLOR_CHAT_DELIMITERS, (display_host) ? " (" : "", IRC_COLOR_CHAT_HOST, - (display_host) ? ctxt->address : "", + (display_host) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, (display_host) ? ")" : "", IRC_COLOR_MESSAGE_QUIT, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_REASON_QUIT, - str_quit_msg, + IRC_COLOR_MSG(str_quit_msg), IRC_COLOR_CHAT_DELIMITERS); } else @@ -3474,7 +3473,7 @@ IRC_PROTOCOL_CALLBACK(quit) IRC_COLOR_CHAT_DELIMITERS, (display_host) ? " (" : "", IRC_COLOR_CHAT_HOST, - (display_host) ? ctxt->address : "", + (display_host) ? IRC_COLOR_MSG(ctxt->address) : "", IRC_COLOR_CHAT_DELIMITERS, (display_host) ? ")" : "", IRC_COLOR_MESSAGE_QUIT); @@ -3509,7 +3508,7 @@ IRC_PROTOCOL_CALLBACK(setname) struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; struct t_irc_channel_speaking *ptr_nick_speaking; - char *str_realname, *realname_color; + char *str_realname; IRC_PROTOCOL_MIN_PARAMS(1); IRC_PROTOCOL_CHECK_NICK; @@ -3518,10 +3517,6 @@ IRC_PROTOCOL_CALLBACK(setname) if (!str_realname) return WEECHAT_RC_ERROR; - realname_color = irc_color_decode ( - str_realname, - weechat_config_boolean (irc_config_network_colors_receive)); - setname_enabled = (weechat_hashtable_has_key (ctxt->server->cap_list, "setname")); for (ptr_channel = ctxt->server->channels; ptr_channel; @@ -3548,7 +3543,7 @@ IRC_PROTOCOL_CALLBACK(setname) IRC_COLOR_MESSAGE_SETNAME, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (realname_color) ? realname_color : "", + IRC_COLOR_MSG(str_realname), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET); } @@ -3582,7 +3577,7 @@ IRC_PROTOCOL_CALLBACK(setname) IRC_COLOR_MESSAGE_SETNAME, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (realname_color) ? realname_color : "", + IRC_COLOR_MSG(str_realname), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET); } @@ -3608,13 +3603,11 @@ IRC_PROTOCOL_CALLBACK(setname) IRC_COLOR_MESSAGE_SETNAME, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (realname_color) ? realname_color : "", + IRC_COLOR_MSG(str_realname), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET); } - free (realname_color); - free (str_realname); return WEECHAT_RC_OK; @@ -3710,15 +3703,15 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason) str_params = irc_protocol_string_params (ctxt->params, arg_text, ctxt->num_params - 1); weechat_printf_datetime_tags ( - irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL), - ctxt->date, - ctxt->date_usec, - irc_protocol_tags (ctxt, NULL), - "%s%s%s%s", - weechat_prefix ("network"), - pos_mode, - (str_params && str_params[0]) ? ": " : "", - (str_params && str_params[0]) ? str_params : ""); + irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL), + ctxt->date, + ctxt->date_usec, + irc_protocol_tags (ctxt, NULL), + "%s%s%s%s", + weechat_prefix ("network"), + pos_mode, + (str_params && str_params[0]) ? ": " : "", + (str_params && str_params[0]) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); @@ -3751,7 +3744,7 @@ IRC_PROTOCOL_CALLBACK(numeric) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("network"), - str_params); + IRC_COLOR_MSG(str_params)); free (str_params); } @@ -3767,7 +3760,7 @@ IRC_PROTOCOL_CALLBACK(numeric) IRC_PROTOCOL_CALLBACK(topic) { - char *str_topic, *old_topic_color, *topic_color; + char *str_topic; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; struct t_gui_buffer *ptr_buffer; @@ -3799,15 +3792,9 @@ IRC_PROTOCOL_CALLBACK(topic) if (str_topic && str_topic[0]) { - topic_color = irc_color_decode ( - str_topic, - weechat_config_boolean (irc_config_network_colors_receive)); if (weechat_config_boolean (irc_config_look_display_old_topic) && ptr_channel && ptr_channel->topic && ptr_channel->topic[0]) { - old_topic_color = irc_color_decode ( - ptr_channel->topic, - weechat_config_boolean (irc_config_network_colors_receive)); weechat_printf_datetime_tags ( irc_msgbuffer_get_target_buffer ( ctxt->server, NULL, ctxt->command, NULL, ptr_buffer), @@ -3821,15 +3808,14 @@ IRC_PROTOCOL_CALLBACK(topic) ctxt->nick, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[0], + ctxt->params[0], /* channel */ IRC_COLOR_RESET, IRC_COLOR_TOPIC_OLD, - (old_topic_color) ? old_topic_color : ptr_channel->topic, + IRC_COLOR_MSG(ptr_channel->topic), IRC_COLOR_RESET, IRC_COLOR_TOPIC_NEW, - (topic_color) ? topic_color : str_topic, + IRC_COLOR_MSG(str_topic), IRC_COLOR_RESET); - free (old_topic_color); } else { @@ -3845,22 +3831,18 @@ IRC_PROTOCOL_CALLBACK(topic) ctxt->nick, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[0], + ctxt->params[0], /* channel */ IRC_COLOR_RESET, IRC_COLOR_TOPIC_NEW, - (topic_color) ? topic_color : str_topic, + IRC_COLOR_MSG(str_topic), IRC_COLOR_RESET); } - free (topic_color); } else { if (weechat_config_boolean (irc_config_look_display_old_topic) && ptr_channel && ptr_channel->topic && ptr_channel->topic[0]) { - old_topic_color = irc_color_decode ( - ptr_channel->topic, - weechat_config_boolean (irc_config_network_colors_receive)); weechat_printf_datetime_tags ( irc_msgbuffer_get_target_buffer ( ctxt->server, NULL, ctxt->command, NULL, ptr_buffer), @@ -3874,12 +3856,11 @@ IRC_PROTOCOL_CALLBACK(topic) ctxt->nick, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[0], + ctxt->params[0], /* channel */ IRC_COLOR_RESET, IRC_COLOR_TOPIC_OLD, - (old_topic_color) ? old_topic_color : ptr_channel->topic, + IRC_COLOR_MSG(ptr_channel->topic), IRC_COLOR_RESET); - free (old_topic_color); } else { @@ -3895,7 +3876,7 @@ IRC_PROTOCOL_CALLBACK(topic) ctxt->nick, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[0], + ctxt->params[0], /* channel */ IRC_COLOR_RESET); } } @@ -3932,8 +3913,8 @@ IRC_PROTOCOL_CALLBACK(wallops) display_host = weechat_config_boolean (irc_config_look_display_host_wallops); nick_address = irc_protocol_nick_address ( ctxt->server, - 0, - NULL, + 0, /* server_message */ + NULL, /* nick */ ctxt->nick, (display_host) ? ctxt->address : NULL); @@ -3947,7 +3928,7 @@ IRC_PROTOCOL_CALLBACK(wallops) _("%sWallops from %s: %s"), weechat_prefix ("network"), (nick_address[0]) ? nick_address : "?", - str_message); + IRC_COLOR_MSG(str_message)); free (str_message); @@ -4208,9 +4189,9 @@ IRC_PROTOCOL_CALLBACK(008) _("%sServer notice mask for %s%s%s: %s"), weechat_prefix ("network"), irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[0]), - ctxt->params[0], + ctxt->params[0], /* nick */ IRC_COLOR_RESET, - str_params); + IRC_COLOR_MSG(str_params)); free (str_params); @@ -4240,7 +4221,7 @@ IRC_PROTOCOL_CALLBACK(221) _("%sUser mode for %s%s%s is %s[%s%s%s]"), weechat_prefix ("network"), irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[0]), - ctxt->params[0], + ctxt->params[0], /* nick */ IRC_COLOR_RESET, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, @@ -4298,10 +4279,10 @@ IRC_PROTOCOL_CALLBACK(301) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_away_msg); + IRC_COLOR_MSG(str_away_msg)); if (ptr_channel) { free (ptr_channel->away_message); @@ -4368,7 +4349,7 @@ IRC_PROTOCOL_CALLBACK(305) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("network"), - str_away_msg); + IRC_COLOR_MSG(str_away_msg)); free (str_away_msg); } @@ -4404,7 +4385,7 @@ IRC_PROTOCOL_CALLBACK(306) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("network"), - str_away_msg); + IRC_COLOR_MSG(str_away_msg)); free (str_away_msg); } @@ -4451,12 +4432,12 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_params, + IRC_COLOR_MSG(str_params), (extra_param) ? " (" : "", - (extra_param) ? ctxt->params[2] : "", + (extra_param) ? IRC_COLOR_MSG(ctxt->params[2]) : "", (extra_param) ? ")" : ""); free (str_params); } @@ -4498,10 +4479,10 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_params); + IRC_COLOR_MSG(str_params)); free (str_params); } else @@ -4546,14 +4527,14 @@ IRC_PROTOCOL_CALLBACK(311) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[2], - ctxt->params[3], + IRC_COLOR_MSG(ctxt->params[2]), /* user */ + IRC_COLOR_MSG(ctxt->params[3]), /* host */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_realname); + IRC_COLOR_MSG(str_realname)); free (str_realname); } @@ -4590,13 +4571,13 @@ IRC_PROTOCOL_CALLBACK(312) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - ctxt->params[2], + ctxt->params[2], /* server */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_server, + IRC_COLOR_MSG(str_server), IRC_COLOR_CHAT_DELIMITERS); free (str_server); } @@ -4634,14 +4615,14 @@ IRC_PROTOCOL_CALLBACK(314) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[2], - ctxt->params[3], + IRC_COLOR_MSG(ctxt->params[2]), /* user */ + IRC_COLOR_MSG(ctxt->params[3]), /* host */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_realname); + IRC_COLOR_MSG(str_realname)); free (str_realname); } @@ -4680,10 +4661,10 @@ IRC_PROTOCOL_CALLBACK(315) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_text); + IRC_COLOR_MSG(str_text)); free (str_text); } @@ -4728,7 +4709,7 @@ IRC_PROTOCOL_CALLBACK(317) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, @@ -4762,7 +4743,7 @@ IRC_PROTOCOL_CALLBACK(317) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, @@ -4807,9 +4788,9 @@ IRC_PROTOCOL_CALLBACK(321) irc_protocol_tags (ctxt, NULL), "%s%s%s%s", weechat_prefix ("network"), - ctxt->params[1], + ctxt->params[1], /* "Channel" */ (str_params && str_params[0]) ? " " : "", - (str_params && str_params[0]) ? str_params : ""); + (str_params && str_params[0]) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); @@ -4842,14 +4823,14 @@ IRC_PROTOCOL_CALLBACK(322) "%s%s%s%s(%s%s%s)%s%s%s", weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - ctxt->params[2], + ctxt->params[2], /* number of users */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_topic && str_topic[0]) ? ": " : "", - (str_topic && str_topic[0]) ? str_topic : ""); + (str_topic && str_topic[0]) ? IRC_COLOR_MSG(str_topic) : ""); free (str_topic); } @@ -4878,7 +4859,7 @@ IRC_PROTOCOL_CALLBACK(323) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("network"), - str_params); + IRC_COLOR_MSG(str_params)); free (str_params); @@ -4928,7 +4909,7 @@ IRC_PROTOCOL_CALLBACK(324) _("%sMode %s%s %s[%s%s%s]"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_modes) ? str_modes : "", @@ -4981,14 +4962,14 @@ IRC_PROTOCOL_CALLBACK(327) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[2], - ctxt->params[3], + IRC_COLOR_MSG(ctxt->params[2]), /* host */ + IRC_COLOR_MSG(ctxt->params[3]), /* ip */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_realname, + IRC_COLOR_MSG(str_realname), IRC_COLOR_CHAT_DELIMITERS); } else @@ -5002,11 +4983,11 @@ IRC_PROTOCOL_CALLBACK(327) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[2], - ctxt->params[3]); + IRC_COLOR_MSG(ctxt->params[2]), /* host */ + IRC_COLOR_MSG(ctxt->params[3])); /* ip */ } free (str_realname); @@ -5042,9 +5023,9 @@ IRC_PROTOCOL_CALLBACK(328) _("%sURL for %s%s%s: %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, - str_url); + IRC_COLOR_MSG(str_url)); free (str_url); } @@ -5097,7 +5078,7 @@ IRC_PROTOCOL_CALLBACK(329) _("%sChannel %s%s%s created on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, weechat_util_get_time_string (&datetime)); } @@ -5139,12 +5120,12 @@ IRC_PROTOCOL_CALLBACK(330_343) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick1 */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_text, + IRC_COLOR_MSG(str_text), irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[2]), - ctxt->params[2]); + ctxt->params[2]); /* nick2 */ free (str_text); } else @@ -5163,10 +5144,10 @@ IRC_PROTOCOL_CALLBACK(330_343) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick/channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_text); + IRC_COLOR_MSG(str_text)); free (str_text); } @@ -5198,7 +5179,7 @@ IRC_PROTOCOL_CALLBACK(331) _("%sNo topic set for channel %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1]); + ctxt->params[1]); /* channel */ return WEECHAT_RC_OK; } @@ -5212,7 +5193,7 @@ IRC_PROTOCOL_CALLBACK(331) IRC_PROTOCOL_CALLBACK(332) { - char *str_topic, *topic_no_color, *topic_color; + char *str_topic, *topic_no_color; struct t_irc_channel *ptr_channel; struct t_gui_buffer *ptr_buffer; @@ -5238,14 +5219,6 @@ IRC_PROTOCOL_CALLBACK(332) else ptr_buffer = ctxt->server->buffer; - topic_color = NULL; - if (str_topic) - { - topic_color = irc_color_decode ( - str_topic, - (weechat_config_boolean (irc_config_network_colors_receive)) ? 1 : 0); - } - if (!ptr_channel || (weechat_hashtable_has_key (ptr_channel->join_msg_received, ctxt->command)) || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, ctxt->command)) @@ -5259,15 +5232,13 @@ IRC_PROTOCOL_CALLBACK(332) _("%sTopic for %s%s%s is \"%s%s%s\""), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, IRC_COLOR_TOPIC_CURRENT, - (topic_color) ? topic_color : ((str_topic) ? str_topic : ""), + IRC_COLOR_MSG(str_topic), IRC_COLOR_RESET); } - free (topic_color); - if (ptr_channel) weechat_hashtable_set (ptr_channel->join_msg_received, ctxt->command, "1"); @@ -5328,7 +5299,7 @@ IRC_PROTOCOL_CALLBACK(333) IRC_COLOR_CHAT_DELIMITERS, (topic_address && topic_address[0]) ? " (" : "", IRC_COLOR_CHAT_HOST, - (topic_address) ? topic_address : "", + IRC_COLOR_MSG(topic_address), IRC_COLOR_CHAT_DELIMITERS, (topic_address && topic_address[0]) ? ")" : "", IRC_COLOR_RESET, @@ -5363,14 +5334,14 @@ IRC_PROTOCOL_CALLBACK(333) _("%sTopic for %s%s%s set by %s%s%s%s%s%s%s%s%s on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, irc_nick_color_for_msg (ctxt->server, 1, ptr_nick, topic_nick), topic_nick, IRC_COLOR_CHAT_DELIMITERS, (topic_address && topic_address[0]) ? " (" : "", IRC_COLOR_CHAT_HOST, - (topic_address) ? topic_address : "", + IRC_COLOR_MSG(topic_address), IRC_COLOR_CHAT_DELIMITERS, (topic_address && topic_address[0]) ? ")" : "", IRC_COLOR_RESET, @@ -5388,7 +5359,7 @@ IRC_PROTOCOL_CALLBACK(333) _("%sTopic for %s%s%s set on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, weechat_util_get_time_string (&datetime)); } @@ -5433,12 +5404,12 @@ IRC_PROTOCOL_CALLBACK(338) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - str_text, + IRC_COLOR_MSG(str_text), IRC_COLOR_CHAT_HOST, - ctxt->params[2]); + IRC_COLOR_MSG(ctxt->params[2])); /* host */ free (str_text); } @@ -5469,13 +5440,13 @@ IRC_PROTOCOL_CALLBACK(341) _("%s%s%s%s has invited %s%s%s to %s%s%s"), weechat_prefix ("network"), irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[0]), - ctxt->params[0], + ctxt->params[0], /* mynick */ IRC_COLOR_RESET, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[2], + ctxt->params[2], /* channel */ IRC_COLOR_RESET); return WEECHAT_RC_OK; @@ -5509,7 +5480,7 @@ IRC_PROTOCOL_CALLBACK(344) _("%sChannel reop %s%s%s: %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, IRC_COLOR_CHAT_HOST, str_host); @@ -5547,9 +5518,9 @@ IRC_PROTOCOL_CALLBACK(345) "%s%s%s%s: %s", weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, - str_params); + IRC_COLOR_MSG(str_params)); free (str_params); @@ -5602,7 +5573,10 @@ IRC_PROTOCOL_CALLBACK(346) if (ctxt->num_params >= 4) { nick_address = irc_protocol_nick_address ( - ctxt->server, 1, NULL, irc_message_get_nick_from_host (ctxt->params[3]), + ctxt->server, + 1, /* server_message */ + NULL, /* nick */ + irc_message_get_nick_from_host (ctxt->params[3]), irc_message_get_address_from_host (ctxt->params[3])); if (ctxt->num_params >= 5) { @@ -5620,11 +5594,11 @@ IRC_PROTOCOL_CALLBACK(346) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + IRC_COLOR_MSG(ctxt->params[2]), /* host */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?", weechat_util_get_time_string (&datetime)); @@ -5643,11 +5617,11 @@ IRC_PROTOCOL_CALLBACK(346) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + IRC_COLOR_MSG(ctxt->params[2]), /* host */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?"); } @@ -5666,11 +5640,11 @@ IRC_PROTOCOL_CALLBACK(346) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + IRC_COLOR_MSG(ctxt->params[2]), /* host */ IRC_COLOR_RESET); } @@ -5722,11 +5696,11 @@ IRC_PROTOCOL_CALLBACK(347) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_params) ? " " : "", - (str_params) ? str_params : ""); + (str_params) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); @@ -5778,7 +5752,10 @@ IRC_PROTOCOL_CALLBACK(348) if (ctxt->num_params >= 4) { nick_address = irc_protocol_nick_address ( - ctxt->server, 1, NULL, irc_message_get_nick_from_host (ctxt->params[3]), + ctxt->server, + 1, /* server_message */ + NULL, /* nick */ + irc_message_get_nick_from_host (ctxt->params[3]), irc_message_get_address_from_host (ctxt->params[3])); if (ctxt->num_params >= 5) { @@ -5796,12 +5773,12 @@ IRC_PROTOCOL_CALLBACK(348) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_RESET, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + IRC_COLOR_MSG(ctxt->params[2]), /* host */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?", weechat_util_get_time_string (&datetime)); @@ -5820,12 +5797,12 @@ IRC_PROTOCOL_CALLBACK(348) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_RESET, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + IRC_COLOR_MSG(ctxt->params[2]), /* host */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?"); } @@ -5844,12 +5821,12 @@ IRC_PROTOCOL_CALLBACK(348) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_RESET, IRC_COLOR_CHAT_HOST, - ctxt->params[2]); + IRC_COLOR_MSG(ctxt->params[2])); /* host */ } return WEECHAT_RC_OK; @@ -5900,11 +5877,11 @@ IRC_PROTOCOL_CALLBACK(349) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_params) ? " " : "", - (str_params) ? str_params : ""); + (str_params) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); @@ -5955,11 +5932,11 @@ IRC_PROTOCOL_CALLBACK(350) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[1]), - ctxt->params[1], + ctxt->params[1], /* nick */ IRC_COLOR_CHAT_DELIMITERS, str_host, IRC_COLOR_RESET, - str_params); + IRC_COLOR_MSG(str_params)); free (str_params); } @@ -5981,7 +5958,7 @@ IRC_PROTOCOL_CALLBACK(350) IRC_PROTOCOL_CALLBACK(351) { - char *str_params; + char *str_comments; struct t_gui_buffer *ptr_buffer; IRC_PROTOCOL_MIN_PARAMS(3); @@ -5989,33 +5966,23 @@ IRC_PROTOCOL_CALLBACK(351) ptr_buffer = irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL); - if (ctxt->num_params > 3) - { - str_params = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1); - weechat_printf_datetime_tags ( - ptr_buffer, - ctxt->date, - ctxt->date_usec, - irc_protocol_tags (ctxt, NULL), - "%s%s %s (%s)", - weechat_prefix ("network"), - ctxt->params[1], - ctxt->params[2], - str_params); - free (str_params); - } - else - { - weechat_printf_datetime_tags ( - ptr_buffer, - ctxt->date, - ctxt->date_usec, - irc_protocol_tags (ctxt, NULL), - "%s%s %s", - weechat_prefix ("network"), - ctxt->params[1], - ctxt->params[2]); - } + str_comments = (ctxt->num_params > 3) ? + irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1) : NULL; + + weechat_printf_datetime_tags ( + ptr_buffer, + ctxt->date, + ctxt->date_usec, + irc_protocol_tags (ctxt, NULL), + "%s%s %s%s%s%s", + weechat_prefix ("network"), + ctxt->params[1], /* version */ + ctxt->params[2], /* server */ + (str_comments && str_comments[0]) ? " (" : "", + IRC_COLOR_MSG(str_comments), + (str_comments && str_comments[0]) ? ")" : ""); + + free (str_comments); return WEECHAT_RC_OK; } @@ -6107,23 +6074,23 @@ IRC_PROTOCOL_CALLBACK(352) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[5]), - ctxt->params[5], + ctxt->params[5], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[2], - ctxt->params[3], + IRC_COLOR_MSG(ctxt->params[2]), /* user */ + IRC_COLOR_MSG(ctxt->params[3]), /* host */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (ctxt->num_params >= 7) ? ctxt->params[6] : "", + (ctxt->num_params >= 7) ? ctxt->params[6] : "", /* status */ (ctxt->num_params >= 7) ? " " : "", (str_hopcount) ? str_hopcount : "", (str_hopcount) ? " " : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (str_realname) ? str_realname : "", + (str_realname) ? IRC_COLOR_MSG(str_realname) : "", IRC_COLOR_CHAT_DELIMITERS); } @@ -6328,11 +6295,11 @@ IRC_PROTOCOL_CALLBACK(354) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_params && str_params[0]) ? " " : "", - (str_params && str_params[0]) ? str_params : ""); + (str_params && str_params[0]) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); } return WEECHAT_RC_OK; @@ -6397,24 +6364,24 @@ IRC_PROTOCOL_CALLBACK(354) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, irc_nick_color_for_msg (ctxt->server, 1, NULL, ctxt->params[5]), - ctxt->params[5], + ctxt->params[5], /* nick */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[8], + IRC_COLOR_MSG(ctxt->params[8]), /* account */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - ctxt->params[2], - ctxt->params[3], + IRC_COLOR_MSG(ctxt->params[2]), /* user */ + IRC_COLOR_MSG(ctxt->params[3]), /* host */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - ctxt->params[6], - ctxt->params[7], + ctxt->params[6], /* status */ + ctxt->params[7], /* hopcount */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (ctxt->num_params >= 10) ? ctxt->params[9] : "", + (ctxt->num_params >= 10) ? IRC_COLOR_MSG(ctxt->params[9]) : "", IRC_COLOR_CHAT_DELIMITERS); } @@ -6756,7 +6723,7 @@ IRC_PROTOCOL_CALLBACK(366) "%s%s%s%s: %s", weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_RESET, str_params); free (str_params); @@ -6817,7 +6784,10 @@ IRC_PROTOCOL_CALLBACK(367) if (ctxt->num_params >= 4) { nick_address = irc_protocol_nick_address ( - ctxt->server, 1, NULL, irc_message_get_nick_from_host (ctxt->params[3]), + ctxt->server, + 1, /* server_message */ + NULL, /* nick */ + irc_message_get_nick_from_host (ctxt->params[3]), irc_message_get_address_from_host (ctxt->params[3])); if (ctxt->num_params >= 5) { @@ -6838,11 +6808,11 @@ IRC_PROTOCOL_CALLBACK(367) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + ctxt->params[2], /* banmask */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?", weechat_util_get_time_string (&datetime)); @@ -6861,11 +6831,11 @@ IRC_PROTOCOL_CALLBACK(367) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + ctxt->params[2], /* banmask */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?"); } @@ -6884,11 +6854,11 @@ IRC_PROTOCOL_CALLBACK(367) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[2], + ctxt->params[2], /* banmask */ IRC_COLOR_RESET); } @@ -6943,11 +6913,11 @@ IRC_PROTOCOL_CALLBACK(368) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_params) ? " " : "", - (str_params) ? str_params : ""); + (str_params) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); @@ -7160,9 +7130,9 @@ IRC_PROTOCOL_CALLBACK(438) irc_protocol_tags (ctxt, NULL), "%s%s (%s => %s)", weechat_prefix ("network"), - str_params, - ctxt->params[0], - ctxt->params[1]); + IRC_COLOR_MSG(str_params), + ctxt->params[0], /* mynick */ + ctxt->params[1]); /* newnick */ free (str_params); } else @@ -7174,8 +7144,8 @@ IRC_PROTOCOL_CALLBACK(438) irc_protocol_tags (ctxt, NULL), "%s%s %s", weechat_prefix ("network"), - ctxt->params[0], - ctxt->params[1]); + ctxt->params[0], /* mynick */ + ctxt->params[1]); /* newnick */ } return WEECHAT_RC_OK; @@ -7312,7 +7282,12 @@ IRC_PROTOCOL_CALLBACK(710) nick = irc_message_get_nick_from_host (ctxt->params[2]); address = irc_message_get_address_from_host (ctxt->params[2]); - nick_address = irc_protocol_nick_address (ctxt->server, 1, NULL, nick, address); + nick_address = irc_protocol_nick_address ( + ctxt->server, + 1, /* server_message */ + NULL, /* nick */ + nick, + address); snprintf (str_tags, sizeof (str_tags), "notify_message,nick_%s%s%s", @@ -7332,7 +7307,7 @@ IRC_PROTOCOL_CALLBACK(710) weechat_prefix ("network"), (nick_address[0]) ? nick_address : "?", (str_message && str_message[0]) ? - str_message : _("has asked for an invite")); + IRC_COLOR_MSG(str_message) : _("has asked for an invite")); free (str_message); @@ -7384,7 +7359,10 @@ IRC_PROTOCOL_CALLBACK(728) if (ctxt->num_params >= 5) { nick_address = irc_protocol_nick_address ( - ctxt->server, 1, NULL, irc_message_get_nick_from_host (ctxt->params[4]), + ctxt->server, + 1, /* server_message */ + NULL, /* nick */ + irc_message_get_nick_from_host (ctxt->params[4]), irc_message_get_address_from_host (ctxt->params[4])); if (ctxt->num_params >= 6) { @@ -7405,11 +7383,11 @@ IRC_PROTOCOL_CALLBACK(728) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[3], + ctxt->params[3], /* quietmask */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?", weechat_util_get_time_string (&datetime)); @@ -7428,11 +7406,11 @@ IRC_PROTOCOL_CALLBACK(728) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[3], + ctxt->params[3], /* quietmask */ IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?"); } @@ -7451,11 +7429,11 @@ IRC_PROTOCOL_CALLBACK(728) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - ctxt->params[3], + ctxt->params[3], /* quietmask */ IRC_COLOR_RESET); } @@ -7510,11 +7488,11 @@ IRC_PROTOCOL_CALLBACK(729) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - ctxt->params[1], + ctxt->params[1], /* channel */ IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, (str_params) ? " " : "", - (str_params) ? str_params : ""); + (str_params) ? IRC_COLOR_MSG(str_params) : ""); free (str_params); @@ -7743,8 +7721,8 @@ IRC_PROTOCOL_CALLBACK(734) irc_protocol_tags (ctxt, NULL), "%s%s (%s)", weechat_prefix ("error"), - (str_params) ? str_params : "", - ctxt->params[1]); + (str_params) ? IRC_COLOR_MSG(str_params) : "", + ctxt->params[1]); /* limit */ free (str_params); @@ -7779,7 +7757,7 @@ IRC_PROTOCOL_CALLBACK(900) irc_protocol_tags (ctxt, NULL), "%s%s %s(%s%s%s)", weechat_prefix ("network"), - str_params, + IRC_COLOR_MSG(str_params), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, pos_nick_host, @@ -7794,7 +7772,7 @@ IRC_PROTOCOL_CALLBACK(900) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("network"), - str_params); + IRC_COLOR_MSG(str_params)); } irc_server_free_sasl_data (ctxt->server); @@ -7822,7 +7800,7 @@ IRC_PROTOCOL_CALLBACK(901) irc_protocol_tags (ctxt, NULL), "%s%s", weechat_prefix ("network"), - ctxt->params[2]); + IRC_COLOR_MSG(ctxt->params[2])); return WEECHAT_RC_OK; } @@ -7915,198 +7893,196 @@ irc_protocol_recv_command (struct t_irc_server *server, const char *msg_channel, int ignore_batch_tag) { - int i, cmd_found, return_code, decode_color, ignored; - char *message_colors_decoded, *pos_space, *tags; + int i, cmd_found, return_code, ignored; + char *pos_space, *tags; struct t_irc_channel *ptr_channel; t_irc_recv_func *cmd_recv_func; const char *ptr_msg_after_tags, *ptr_batch_ref, *ptr_tag_time; const char *nick1, *address1, *host1; - char *address, *host, *host_no_color; + char *host, *host_no_color; struct t_irc_protocol_ctxt ctxt; struct timeval tv; struct t_irc_protocol_msg irc_protocol_messages[] = { - /* format: "command", decode_color, func_cb */ - IRCB(account, 1, account), /* account (cap "account-notify") */ - IRCB(authenticate, 1, authenticate), /* authenticate */ - IRCB(away, 1, away), /* away (cap "away-notify") */ - IRCB(batch, 1, batch), /* batch (cap "batch") */ - IRCB(cap, 1, cap), /* client capability */ - IRCB(chghost, 1, chghost), /* user/host change (cap "chghost")*/ - IRCB(error, 1, error), /* error received from server */ - IRCB(fail, 1, fail), /* error received from server */ - IRCB(invite, 1, invite), /* invite a nick on a channel */ - IRCB(join, 1, join), /* join a channel */ - IRCB(kick, 1, kick), /* kick a user */ - IRCB(kill, 1, kill), /* close client-server connection */ - IRCB(mode, 1, mode), /* change channel or user mode */ - IRCB(nick, 1, nick), /* change current nickname */ - IRCB(note, 1, note), /* note received from server */ - IRCB(notice, 1, notice), /* send notice message to user */ - IRCB(part, 1, part), /* leave a channel */ - IRCB(ping, 1, ping), /* ping server */ - IRCB(pong, 1, pong), /* answer to a ping message */ - IRCB(privmsg, 1, privmsg), /* message received */ - IRCB(quit, 1, quit), /* close all connections and quit */ - IRCB(setname, 0, setname), /* set realname */ - IRCB(tagmsg, 0, tagmsg), /* tag message */ - IRCB(topic, 0, topic), /* get/set channel topic */ - IRCB(wallops, 1, wallops), /* wallops */ - IRCB(warn, 1, warn), /* warning received from server */ - IRCB(001, 1, 001), /* a server message */ - IRCB(005, 1, 005), /* a server message */ - IRCB(008, 1, 008), /* server notice mask */ - IRCB(221, 1, 221), /* user mode string */ - IRCB(223, 1, whois_nick_msg), /* whois (charset is) */ - IRCB(264, 1, whois_nick_msg), /* whois (encrypted connection) */ - IRCB(275, 1, whois_nick_msg), /* whois (secure connection) */ - IRCB(276, 1, whois_nick_msg), /* whois (client cert. fingerprint)*/ - IRCB(301, 1, 301), /* away message */ - IRCB(303, 1, 303), /* ison */ - IRCB(305, 1, 305), /* unaway */ - IRCB(306, 1, 306), /* now away */ - IRCB(307, 1, whois_nick_msg), /* whois (registered nick) */ - IRCB(310, 1, whois_nick_msg), /* whois (help mode) */ - IRCB(311, 1, 311), /* whois (user) */ - IRCB(312, 1, 312), /* whois (server) */ - IRCB(313, 1, whois_nick_msg), /* whois (operator) */ - IRCB(314, 1, 314), /* whowas */ - IRCB(315, 1, 315), /* end of /who list */ - IRCB(317, 1, 317), /* whois (idle) */ - IRCB(318, 1, whois_nick_msg), /* whois (end) */ - IRCB(319, 1, whois_nick_msg), /* whois (channels) */ - IRCB(320, 1, whois_nick_msg), /* whois (identified user) */ - IRCB(321, 1, 321), /* /list start */ - IRCB(322, 1, 322), /* channel (for /list) */ - IRCB(323, 1, 323), /* end of /list */ - IRCB(324, 1, 324), /* channel mode */ - IRCB(326, 1, whois_nick_msg), /* whois (has oper privs) */ - IRCB(327, 1, 327), /* whois (host) */ - IRCB(328, 1, 328), /* channel URL */ - IRCB(329, 1, 329), /* channel creation date */ - IRCB(330, 1, 330_343), /* is logged in as */ - IRCB(331, 1, 331), /* no topic for channel */ - IRCB(332, 0, 332), /* topic of channel */ - IRCB(333, 1, 333), /* topic info (nick/date) */ - IRCB(335, 1, whois_nick_msg), /* whois (is a bot on) */ - IRCB(337, 1, whois_nick_msg), /* whois (is hiding idle time) */ - IRCB(338, 1, 338), /* whois (host) */ - IRCB(341, 1, 341), /* inviting */ - IRCB(343, 1, 330_343), /* is opered as */ - IRCB(344, 1, 344), /* channel reop / whois (geo info) */ - IRCB(345, 1, 345), /* end of channel reop list */ - IRCB(346, 1, 346), /* invite list */ - IRCB(347, 1, 347), /* end of invite list */ - IRCB(348, 1, 348), /* channel exception list */ - IRCB(349, 1, 349), /* end of channel exception list */ - IRCB(350, 1, 350), /* whois (gateway) */ - IRCB(351, 1, 351), /* server version */ - IRCB(352, 1, 352), /* who */ - IRCB(353, 1, 353), /* list of nicks on channel */ - IRCB(354, 1, 354), /* whox */ - IRCB(366, 1, 366), /* end of /names list */ - IRCB(367, 1, 367), /* banlist */ - IRCB(368, 1, 368), /* end of banlist */ - IRCB(369, 1, whowas_nick_msg), /* whowas (end) */ - IRCB(378, 1, whois_nick_msg), /* whois (connecting from) */ - IRCB(379, 1, whois_nick_msg), /* whois (using modes) */ - IRCB(401, 1, generic_error), /* no such nick/channel */ - IRCB(402, 1, generic_error), /* no such server */ - IRCB(403, 1, generic_error), /* no such channel */ - IRCB(404, 1, generic_error), /* cannot send to channel */ - IRCB(405, 1, generic_error), /* too many channels */ - IRCB(406, 1, generic_error), /* was no such nick */ - IRCB(407, 1, generic_error), /* too many targets */ - IRCB(409, 1, generic_error), /* no origin */ - IRCB(410, 1, generic_error), /* no services */ - IRCB(411, 1, generic_error), /* no recipient */ - IRCB(412, 1, generic_error), /* no text to send */ - IRCB(413, 1, generic_error), /* no toplevel */ - IRCB(414, 1, generic_error), /* wilcard in toplevel domain */ - IRCB(415, 1, generic_error), /* cannot send message to channel */ - IRCB(421, 1, generic_error), /* unknown command */ - IRCB(422, 1, generic_error), /* MOTD is missing */ - IRCB(423, 1, generic_error), /* no administrative info */ - IRCB(424, 1, generic_error), /* file error */ - IRCB(431, 1, generic_error), /* no nickname given */ - IRCB(432, 1, 432), /* erroneous nickname */ - IRCB(433, 1, 433), /* nickname already in use */ - IRCB(436, 1, generic_error), /* nickname collision */ - IRCB(437, 1, 437), /* nick/channel unavailable */ - IRCB(438, 1, 438), /* not auth. to change nickname */ - IRCB(441, 1, generic_error), /* user not in channel */ - IRCB(442, 1, generic_error), /* not on channel */ - IRCB(443, 1, generic_error), /* user already on channel */ - IRCB(444, 1, generic_error), /* user not logged in */ - IRCB(445, 1, generic_error), /* SUMMON has been disabled */ - IRCB(446, 1, generic_error), /* USERS has been disabled */ - IRCB(451, 1, generic_error), /* you are not registered */ - IRCB(461, 1, generic_error), /* not enough parameters */ - IRCB(462, 1, generic_error), /* you may not reregister */ - IRCB(463, 1, generic_error), /* host not privileged */ - IRCB(464, 1, generic_error), /* password incorrect */ - IRCB(465, 1, generic_error), /* banned from this server */ - IRCB(467, 1, generic_error), /* channel key already set */ - IRCB(470, 1, 470), /* forwarding to another channel */ - IRCB(471, 1, generic_error), /* channel is already full */ - IRCB(472, 1, generic_error), /* unknown mode char to me */ - IRCB(473, 1, generic_error), /* cannot join (invite only) */ - IRCB(474, 1, generic_error), /* cannot join (banned) */ - IRCB(475, 1, generic_error), /* cannot join (bad key) */ - IRCB(476, 1, generic_error), /* bad channel mask */ - IRCB(477, 1, generic_error), /* channel doesn't support modes */ - IRCB(481, 1, generic_error), /* you're not an IRC operator */ - IRCB(482, 1, generic_error), /* you're not channel operator */ - IRCB(483, 1, generic_error), /* you can't kill a server! */ - IRCB(484, 1, generic_error), /* your connection is restricted! */ - IRCB(485, 1, generic_error), /* not the original channel oper. */ - IRCB(487, 1, generic_error), /* network split */ - IRCB(491, 1, generic_error), /* no O-lines for your host */ - IRCB(501, 1, generic_error), /* unknown mode flag */ - IRCB(502, 1, generic_error), /* can't chg mode for other users */ - IRCB(524, 1, generic_error), /* HELP/HELPOP (help not found) */ - IRCB(569, 1, whois_nick_msg), /* whois (connecting from) */ - IRCB(671, 1, whois_nick_msg), /* whois (secure connection) */ - IRCB(704, 1, generic_error), /* start of HELP/HELPOP */ - IRCB(705, 1, generic_error), /* body of HELP/HELPOP */ - IRCB(706, 1, generic_error), /* end of HELP/HELPOP */ - IRCB(710, 1, 710), /* knock: has asked for an invite */ - IRCB(711, 1, knock_reply), /* knock: has been delivered */ - IRCB(712, 1, knock_reply), /* knock: too many knocks */ - IRCB(713, 1, knock_reply), /* knock: channel is open */ - IRCB(714, 1, knock_reply), /* knock: already on that channel */ - IRCB(716, 1, generic_error), /* nick is in +g mode */ - IRCB(717, 1, generic_error), /* nick has been informed of msg */ - IRCB(728, 1, 728), /* quietlist */ - IRCB(729, 1, 729), /* end of quietlist */ - IRCB(730, 1, 730), /* monitored nicks online */ - IRCB(731, 1, 731), /* monitored nicks offline */ - IRCB(732, 1, 732), /* list of monitored nicks */ - IRCB(733, 1, 733), /* end of monitor list */ - IRCB(734, 1, 734), /* monitor list is full */ - IRCB(742, 1, generic_error), /* mode cannot be set */ - IRCB(900, 1, 900), /* logged in as (SASL) */ - IRCB(901, 1, 901), /* you are now logged out */ - IRCB(902, 1, sasl_end_fail), /* SASL auth failed (acc. locked) */ - IRCB(903, 1, sasl_end_ok), /* SASL auth successful */ - IRCB(904, 1, sasl_end_fail), /* SASL auth failed */ - IRCB(905, 1, sasl_end_fail), /* SASL message too long */ - IRCB(906, 1, sasl_end_fail), /* SASL authentication aborted */ - IRCB(907, 1, sasl_end_ok), /* already completed SASL auth */ - IRCB(936, 1, generic_error), /* censored word */ - IRCB(973, 1, server_mode_reason), /* whois (secure conn.) */ - IRCB(974, 1, server_mode_reason), /* whois (secure conn.) */ - IRCB(975, 1, server_mode_reason), /* whois (secure conn.) */ - { NULL, 0, NULL }, + /* IRCB(command, function_callback) */ + IRCB(account, account), /* account (cap "account-notify") */ + IRCB(authenticate, authenticate), /* authenticate */ + IRCB(away, away), /* away (cap "away-notify") */ + IRCB(batch, batch), /* batch (cap "batch") */ + IRCB(cap, cap), /* client capability */ + IRCB(chghost, chghost), /* user/host change (cap "chghost")*/ + IRCB(error, error), /* error received from server */ + IRCB(fail, fail), /* error received from server */ + IRCB(invite, invite), /* invite a nick on a channel */ + IRCB(join, join), /* join a channel */ + IRCB(kick, kick), /* kick a user */ + IRCB(kill, kill), /* close client-server connection */ + IRCB(mode, mode), /* change channel or user mode */ + IRCB(nick, nick), /* change current nickname */ + IRCB(note, note), /* note received from server */ + IRCB(notice, notice), /* send notice message to user */ + IRCB(part, part), /* leave a channel */ + IRCB(ping, ping), /* ping server */ + IRCB(pong, pong), /* answer to a ping message */ + IRCB(privmsg, privmsg), /* message received */ + IRCB(quit, quit), /* close all connections and quit */ + IRCB(setname, setname), /* set realname */ + IRCB(tagmsg, tagmsg), /* tag message */ + IRCB(topic, topic), /* get/set channel topic */ + IRCB(wallops, wallops), /* wallops */ + IRCB(warn, warn), /* warning received from server */ + IRCB(001, 001), /* a server message */ + IRCB(005, 005), /* a server message */ + IRCB(008, 008), /* server notice mask */ + IRCB(221, 221), /* user mode string */ + IRCB(223, whois_nick_msg), /* whois (charset is) */ + IRCB(264, whois_nick_msg), /* whois (encrypted connection) */ + IRCB(275, whois_nick_msg), /* whois (secure connection) */ + IRCB(276, whois_nick_msg), /* whois (client cert. fingerprint)*/ + IRCB(301, 301), /* away message */ + IRCB(303, 303), /* ison */ + IRCB(305, 305), /* unaway */ + IRCB(306, 306), /* now away */ + IRCB(307, whois_nick_msg), /* whois (registered nick) */ + IRCB(310, whois_nick_msg), /* whois (help mode) */ + IRCB(311, 311), /* whois (user) */ + IRCB(312, 312), /* whois (server) */ + IRCB(313, whois_nick_msg), /* whois (operator) */ + IRCB(314, 314), /* whowas */ + IRCB(315, 315), /* end of /who list */ + IRCB(317, 317), /* whois (idle) */ + IRCB(318, whois_nick_msg), /* whois (end) */ + IRCB(319, whois_nick_msg), /* whois (channels) */ + IRCB(320, whois_nick_msg), /* whois (identified user) */ + IRCB(321, 321), /* /list start */ + IRCB(322, 322), /* channel (for /list) */ + IRCB(323, 323), /* end of /list */ + IRCB(324, 324), /* channel mode */ + IRCB(326, whois_nick_msg), /* whois (has oper privs) */ + IRCB(327, 327), /* whois (host) */ + IRCB(328, 328), /* channel URL */ + IRCB(329, 329), /* channel creation date */ + IRCB(330, 330_343), /* is logged in as */ + IRCB(331, 331), /* no topic for channel */ + IRCB(332, 332), /* topic of channel */ + IRCB(333, 333), /* topic info (nick/date) */ + IRCB(335, whois_nick_msg), /* whois (is a bot on) */ + IRCB(337, whois_nick_msg), /* whois (is hiding idle time) */ + IRCB(338, 338), /* whois (host) */ + IRCB(341, 341), /* inviting */ + IRCB(343, 330_343), /* is opered as */ + IRCB(344, 344), /* channel reop / whois (geo info) */ + IRCB(345, 345), /* end of channel reop list */ + IRCB(346, 346), /* invite list */ + IRCB(347, 347), /* end of invite list */ + IRCB(348, 348), /* channel exception list */ + IRCB(349, 349), /* end of channel exception list */ + IRCB(350, 350), /* whois (gateway) */ + IRCB(351, 351), /* server version */ + IRCB(352, 352), /* who */ + IRCB(353, 353), /* list of nicks on channel */ + IRCB(354, 354), /* whox */ + IRCB(366, 366), /* end of /names list */ + IRCB(367, 367), /* banlist */ + IRCB(368, 368), /* end of banlist */ + IRCB(369, whowas_nick_msg), /* whowas (end) */ + IRCB(378, whois_nick_msg), /* whois (connecting from) */ + IRCB(379, whois_nick_msg), /* whois (using modes) */ + IRCB(401, generic_error), /* no such nick/channel */ + IRCB(402, generic_error), /* no such server */ + IRCB(403, generic_error), /* no such channel */ + IRCB(404, generic_error), /* cannot send to channel */ + IRCB(405, generic_error), /* too many channels */ + IRCB(406, generic_error), /* was no such nick */ + IRCB(407, generic_error), /* too many targets */ + IRCB(409, generic_error), /* no origin */ + IRCB(410, generic_error), /* no services */ + IRCB(411, generic_error), /* no recipient */ + IRCB(412, generic_error), /* no text to send */ + IRCB(413, generic_error), /* no toplevel */ + IRCB(414, generic_error), /* wilcard in toplevel domain */ + IRCB(415, generic_error), /* cannot send message to channel */ + IRCB(421, generic_error), /* unknown command */ + IRCB(422, generic_error), /* MOTD is missing */ + IRCB(423, generic_error), /* no administrative info */ + IRCB(424, generic_error), /* file error */ + IRCB(431, generic_error), /* no nickname given */ + IRCB(432, 432), /* erroneous nickname */ + IRCB(433, 433), /* nickname already in use */ + IRCB(436, generic_error), /* nickname collision */ + IRCB(437, 437), /* nick/channel unavailable */ + IRCB(438, 438), /* not auth. to change nickname */ + IRCB(441, generic_error), /* user not in channel */ + IRCB(442, generic_error), /* not on channel */ + IRCB(443, generic_error), /* user already on channel */ + IRCB(444, generic_error), /* user not logged in */ + IRCB(445, generic_error), /* SUMMON has been disabled */ + IRCB(446, generic_error), /* USERS has been disabled */ + IRCB(451, generic_error), /* you are not registered */ + IRCB(461, generic_error), /* not enough parameters */ + IRCB(462, generic_error), /* you may not reregister */ + IRCB(463, generic_error), /* host not privileged */ + IRCB(464, generic_error), /* password incorrect */ + IRCB(465, generic_error), /* banned from this server */ + IRCB(467, generic_error), /* channel key already set */ + IRCB(470, 470), /* forwarding to another channel */ + IRCB(471, generic_error), /* channel is already full */ + IRCB(472, generic_error), /* unknown mode char to me */ + IRCB(473, generic_error), /* cannot join (invite only) */ + IRCB(474, generic_error), /* cannot join (banned) */ + IRCB(475, generic_error), /* cannot join (bad key) */ + IRCB(476, generic_error), /* bad channel mask */ + IRCB(477, generic_error), /* channel doesn't support modes */ + IRCB(481, generic_error), /* you're not an IRC operator */ + IRCB(482, generic_error), /* you're not channel operator */ + IRCB(483, generic_error), /* you can't kill a server! */ + IRCB(484, generic_error), /* your connection is restricted! */ + IRCB(485, generic_error), /* not the original channel oper. */ + IRCB(487, generic_error), /* network split */ + IRCB(491, generic_error), /* no O-lines for your host */ + IRCB(501, generic_error), /* unknown mode flag */ + IRCB(502, generic_error), /* can't chg mode for other users */ + IRCB(524, generic_error), /* HELP/HELPOP (help not found) */ + IRCB(569, whois_nick_msg), /* whois (connecting from) */ + IRCB(671, whois_nick_msg), /* whois (secure connection) */ + IRCB(704, generic_error), /* start of HELP/HELPOP */ + IRCB(705, generic_error), /* body of HELP/HELPOP */ + IRCB(706, generic_error), /* end of HELP/HELPOP */ + IRCB(710, 710), /* knock: has asked for an invite */ + IRCB(711, knock_reply), /* knock: has been delivered */ + IRCB(712, knock_reply), /* knock: too many knocks */ + IRCB(713, knock_reply), /* knock: channel is open */ + IRCB(714, knock_reply), /* knock: already on that channel */ + IRCB(716, generic_error), /* nick is in +g mode */ + IRCB(717, generic_error), /* nick has been informed of msg */ + IRCB(728, 728), /* quietlist */ + IRCB(729, 729), /* end of quietlist */ + IRCB(730, 730), /* monitored nicks online */ + IRCB(731, 731), /* monitored nicks offline */ + IRCB(732, 732), /* list of monitored nicks */ + IRCB(733, 733), /* end of monitor list */ + IRCB(734, 734), /* monitor list is full */ + IRCB(742, generic_error), /* mode cannot be set */ + IRCB(900, 900), /* logged in as (SASL) */ + IRCB(901, 901), /* you are now logged out */ + IRCB(902, sasl_end_fail), /* SASL auth failed (acc. locked) */ + IRCB(903, sasl_end_ok), /* SASL auth successful */ + IRCB(904, sasl_end_fail), /* SASL auth failed */ + IRCB(905, sasl_end_fail), /* SASL message too long */ + IRCB(906, sasl_end_fail), /* SASL authentication aborted */ + IRCB(907, sasl_end_ok), /* already completed SASL auth */ + IRCB(936, generic_error), /* censored word */ + IRCB(973, server_mode_reason), /* whois (secure conn.) */ + IRCB(974, server_mode_reason), /* whois (secure conn.) */ + IRCB(975, server_mode_reason), /* whois (secure conn.) */ + { NULL, NULL }, }; if (!msg_command) return; - address = NULL; host = NULL; host_no_color = NULL; - message_colors_decoded = NULL; ctxt.server = server; ctxt.date = 0; @@ -8191,12 +8167,7 @@ irc_protocol_recv_command (struct t_irc_server *server, } ctxt.nick = (nick1) ? strdup (nick1) : NULL; ctxt.nick_is_me = (irc_server_strcasecmp (server, ctxt.nick, server->nick) == 0); - address = (address1) ? strdup (address1) : NULL; - ctxt.address = (address) ? - irc_color_decode ( - address, - weechat_config_boolean (irc_config_network_colors_receive)) : - NULL; + ctxt.address = (address1) ? strdup (address1) : NULL; host = (host1) ? strdup (host1) : NULL; if (host) { @@ -8262,7 +8233,6 @@ irc_protocol_recv_command (struct t_irc_server *server, if (irc_protocol_is_numeric_command (msg_command)) { ctxt.command = (msg_command) ? strdup (msg_command) : NULL; - decode_color = 1; cmd_recv_func = irc_protocol_cb_numeric; } else @@ -8277,23 +8247,12 @@ irc_protocol_recv_command (struct t_irc_server *server, else { ctxt.command = strdup (irc_protocol_messages[cmd_found].name); - decode_color = irc_protocol_messages[cmd_found].decode_color; cmd_recv_func = irc_protocol_messages[cmd_found].recv_function; } if ((cmd_recv_func != NULL) && ptr_msg_after_tags) { - if (decode_color) - { - message_colors_decoded = irc_color_decode ( - ptr_msg_after_tags, - weechat_config_boolean (irc_config_network_colors_receive)); - } - else - { - message_colors_decoded = strdup (ptr_msg_after_tags); - } - ctxt.irc_message = strdup (message_colors_decoded); + ctxt.irc_message = strdup (ptr_msg_after_tags); irc_message_parse (server, ctxt.irc_message, @@ -8337,9 +8296,7 @@ irc_protocol_recv_command (struct t_irc_server *server, irc_message, NULL); end: - free (address); free (host); free (host_no_color); - free (message_colors_decoded); irc_protocol_ctxt_free_data (&ctxt); } diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h index 58dc6dd45..0deafe77e 100644 --- a/src/plugins/irc/irc-protocol.h +++ b/src/plugins/irc/irc-protocol.h @@ -27,9 +27,8 @@ irc_protocol_cb_##__command ( \ struct t_irc_protocol_ctxt *ctxt) -#define IRCB(__message, __decode_color, __func_cb) \ +#define IRCB(__message, __func_cb) \ { #__message, \ - __decode_color, \ &irc_protocol_cb_##__func_cb } #define IRC_PROTOCOL_MIN_PARAMS(__min_params) \ @@ -80,7 +79,6 @@ typedef int (t_irc_recv_func)(struct t_irc_protocol_ctxt *ctxt); struct t_irc_protocol_msg { char *name; /* IRC message name */ - int decode_color; /* decode color before calling function */ t_irc_recv_func *recv_function; /* function called when msg is received */ }; diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 89827b700..d5a723c09 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -196,6 +196,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) irc_signal_quit_received = 0; irc_signal_upgrade_received = 0; + irc_color_init (); + if (!irc_config_init ()) return WEECHAT_RC_ERROR; diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index d5a01ccfd..89fb531d5 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -700,47 +700,47 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) RECV(":bob!user@host PRIVMSG alice :hi Alice!"); /* message to channel (text in buffer) */ - server_input_data (buffer_chan, "msg chan 1"); - CHECK_SENT("PRIVMSG #test :msg chan 1"); + server_input_data (buffer_chan, "\002msg chan 1"); + CHECK_SENT("PRIVMSG #test :\002msg chan 1"); CHECK_CHAN("alice", "msg chan 1", "irc_privmsg,self_msg,notify_none,no_highlight,prefix_nick_white," "nick_alice,log1"); /* message to channel (with /msg ) */ - server_input_data (buffer_server, "/msg #test msg chan 2"); - CHECK_SENT("PRIVMSG #test :msg chan 2"); + server_input_data (buffer_server, "/msg #test \002msg chan 2"); + CHECK_SENT("PRIVMSG #test :\002msg chan 2"); CHECK_CHAN("alice", "msg chan 2", "irc_privmsg,self_msg,notify_none,no_highlight,prefix_nick_white," "nick_alice,log1"); /* message to channel (with /msg ), channel not joined */ - server_input_data (buffer_server, "/msg #zzz msg chan not joined"); - CHECK_SENT("PRIVMSG #zzz :msg chan not joined"); + server_input_data (buffer_server, "/msg #zzz \002msg chan not joined"); + CHECK_SENT("PRIVMSG #zzz :\002msg chan not joined"); CHECK_SRV("--", "Msg(alice) -> #zzz: msg chan not joined", "irc_privmsg,self_msg,notify_none,no_highlight,nick_alice,log1"); /* STATUSMSG message to channel (with /msg @) */ - server_input_data (buffer_server, "/msg @#test msg chan ops"); - CHECK_SENT("PRIVMSG @#test :msg chan ops"); + server_input_data (buffer_server, "/msg @#test \002msg chan ops"); + CHECK_SENT("PRIVMSG @#test :\002msg chan ops"); CHECK_CHAN("--", "Msg(alice) -> @#test: msg chan ops", "irc_privmsg,self_msg,notify_none,no_highlight,nick_alice,log1"); /* STATUSMSG message to channel (with /msg @), channel not joined */ - server_input_data (buffer_server, "/msg @#zzz msg chan ops not joined"); - CHECK_SENT("PRIVMSG @#zzz :msg chan ops not joined"); + server_input_data (buffer_server, "/msg @#zzz \002msg chan ops not joined"); + CHECK_SENT("PRIVMSG @#zzz :\002msg chan ops not joined"); CHECK_SRV("--", "Msg(alice) -> @#zzz: msg chan ops not joined", "irc_privmsg,self_msg,notify_none,no_highlight,nick_alice,log1"); /* message to a nick (text in private buffer) */ - server_input_data (buffer_pv, "msg pv 1"); - CHECK_SENT("PRIVMSG bob :msg pv 1"); + server_input_data (buffer_pv, "\002msg pv 1"); + CHECK_SENT("PRIVMSG bob :\002msg pv 1"); CHECK_PV("bob", "alice", "msg pv 1", "irc_privmsg,self_msg,notify_none,no_highlight,prefix_nick_white," "nick_alice,log1"); /* message to a nick (with /msg ) */ - server_input_data (buffer_server, "/msg bob msg pv 2"); - CHECK_SENT("PRIVMSG bob :msg pv 2"); + server_input_data (buffer_server, "/msg bob \002msg pv 2"); + CHECK_SENT("PRIVMSG bob :\002msg pv 2"); CHECK_PV("bob", "alice", "msg pv 2", "irc_privmsg,self_msg,notify_none,no_highlight,prefix_nick_white," "nick_alice,log1"); @@ -752,40 +752,40 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "irc_privmsg,self_msg,notify_none,no_highlight,nick_alice,log1"); /* message to a nick (with /query ) */ - server_input_data (buffer_server, "/query bob msg pv 3"); - CHECK_SENT("PRIVMSG bob :msg pv 3"); + server_input_data (buffer_server, "/query bob \002msg pv 3"); + CHECK_SENT("PRIVMSG bob :\002msg pv 3"); CHECK_PV("bob", "alice", "msg pv 3", "irc_privmsg,self_msg,notify_none,no_highlight,prefix_nick_white," "nick_alice,log1"); /* message to a nick (with /query ), private buffer does not exist */ - server_input_data (buffer_server, "/query bob_query msg pv 4"); - CHECK_SENT("PRIVMSG bob_query :msg pv 4"); + server_input_data (buffer_server, "/query bob_query \002msg pv 4"); + CHECK_SENT("PRIVMSG bob_query :\002msg pv 4"); CHECK_PV("bob_query", "alice", "msg pv 4", "irc_privmsg,self_msg,notify_none,no_highlight,prefix_nick_white," "nick_alice,log1"); /* notice to channel */ - server_input_data (buffer_server, "/notice #test notice chan"); - CHECK_SENT("NOTICE #test :notice chan"); + server_input_data (buffer_server, "/notice #test \002notice chan"); + CHECK_SENT("NOTICE #test :\002notice chan"); CHECK_CHAN("--", "Notice(alice) -> #test: notice chan", "irc_notice,self_msg,notify_none,no_highlight,nick_alice,log1"); /* STATUSMSG notice to channel */ - server_input_data (buffer_server, "/notice @#test notice chan ops"); - CHECK_SENT("NOTICE @#test :notice chan ops"); + server_input_data (buffer_server, "/notice @#test \002notice chan ops"); + CHECK_SENT("NOTICE @#test :\002notice chan ops"); CHECK_CHAN("--", "Notice(alice) -> @#test: notice chan ops", "irc_notice,self_msg,notify_none,no_highlight,nick_alice,log1"); /* notice to a nick */ - server_input_data (buffer_server, "/notice bob notice pv"); - CHECK_SENT("NOTICE bob :notice pv"); + server_input_data (buffer_server, "/notice bob \002notice pv"); + CHECK_SENT("NOTICE bob :\002notice pv"); CHECK_PV("bob", "--", "Notice(alice) -> bob: notice pv", "irc_notice,self_msg,notify_none,no_highlight,nick_alice,log1"); /* action on channel (with /me) */ - server_input_data (buffer_chan, "/me action chan 1"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 1\001"); + server_input_data (buffer_chan, "/me \002action chan 1"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 1\001"); CHECK_CHAN(" *", "alice action chan 1", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -798,8 +798,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* action on channel (with raw code: "\001ACTION") */ - server_input_data (buffer_chan, "\001ACTION is testing\001"); - CHECK_SENT("PRIVMSG #test :\001ACTION is testing\001"); + server_input_data (buffer_chan, "\001ACTION \002is testing\001"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002is testing\001"); CHECK_CHAN(" *", "alice is testing", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -812,15 +812,15 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* action on channel (with /action *) */ - server_input_data (buffer_chan, "/action * action chan 2"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 2\001"); + server_input_data (buffer_chan, "/action * \002action chan 2"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 2\001"); CHECK_CHAN(" *", "alice action chan 2", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); /* action on channel (with /action ) */ - server_input_data (buffer_server, "/action #test action chan 3"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 3\001"); + server_input_data (buffer_server, "/action #test \002action chan 3"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 3\001"); CHECK_CHAN(" *", "alice action chan 3", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -833,8 +833,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* STATUSMSG action on channel (with /action @) */ - server_input_data (buffer_server, "/action @#test action chan 4"); - CHECK_SENT("PRIVMSG @#test :\001ACTION action chan 4\001"); + server_input_data (buffer_server, "/action @#test \002action chan 4"); + CHECK_SENT("PRIVMSG @#test :\001ACTION \002action chan 4\001"); CHECK_CHAN("--", "Action -> @#test: alice action chan 4", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -847,8 +847,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* action on channel (with /ctcp action) */ - server_input_data (buffer_server, "/ctcp #test action action chan 5"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 5\001"); + server_input_data (buffer_server, "/ctcp #test action \002action chan 5"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 5\001"); CHECK_CHAN(" *", "alice action chan 5", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -861,29 +861,29 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* STATUSMSG action on channel (with /ctcp @ action) */ - server_input_data (buffer_server, "/ctcp @#test action action chan ops"); - CHECK_SENT("PRIVMSG @#test :\001ACTION action chan ops\001"); + server_input_data (buffer_server, "/ctcp @#test action \002action chan ops"); + CHECK_SENT("PRIVMSG @#test :\001ACTION \002action chan ops\001"); CHECK_CHAN("--", "Action -> @#test: alice action chan ops", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); /* action in private (with /me) */ - server_input_data (buffer_pv, "/me action pv 1"); - CHECK_SENT("PRIVMSG bob :\001ACTION action pv 1\001"); + server_input_data (buffer_pv, "/me \002action pv 1"); + CHECK_SENT("PRIVMSG bob :\001ACTION \002action pv 1\001"); CHECK_PV("bob", " *", "alice action pv 1", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); /* action in private (with /ctcp) */ - server_input_data (buffer_server, "/ctcp bob action action pv 2"); - CHECK_SENT("PRIVMSG bob :\001ACTION action pv 2\001"); + server_input_data (buffer_server, "/ctcp bob action \002action pv 2"); + CHECK_SENT("PRIVMSG bob :\001ACTION \002action pv 2\001"); CHECK_PV("bob", " *", "alice action pv 2", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); /* action in private (with /ctcp), without private buffer */ - server_input_data (buffer_server, "/ctcp bob2 action action pv 3"); - CHECK_SENT("PRIVMSG bob2 :\001ACTION action pv 3\001"); + server_input_data (buffer_server, "/ctcp bob2 action \002action pv 3"); + CHECK_SENT("PRIVMSG bob2 :\001ACTION \002action pv 3\001"); CHECK_SRV("--", "Action -> bob2: alice action pv 3", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -896,8 +896,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* unknown CTCP to channel */ - server_input_data (buffer_server, "/ctcp #test unknown1 some args"); - CHECK_SENT("PRIVMSG #test :\001UNKNOWN1 some args\001"); + server_input_data (buffer_server, "/ctcp #test unknown1 \002some args"); + CHECK_SENT("PRIVMSG #test :\001UNKNOWN1 \002some args\001"); CHECK_CHAN("--", "CTCP query to #test: UNKNOWN1 some args", "irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -917,8 +917,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage) "nick_alice,log1"); /* unknown CTCP to nick */ - server_input_data (buffer_server, "/ctcp bob unknown2 some args"); - CHECK_SENT("PRIVMSG bob :\001UNKNOWN2 some args\001"); + server_input_data (buffer_server, "/ctcp bob unknown2 \002some args"); + CHECK_SENT("PRIVMSG bob :\001UNKNOWN2 \002some args\001"); CHECK_PV("bob", "--", "CTCP query to bob: UNKNOWN2 some args", "irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight," "nick_alice,log1"); @@ -948,38 +948,38 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) RECV(":bob!user@host PRIVMSG alice :hi Alice!"); /* message to channel (text in buffer) */ - server_input_data (buffer_chan, "msg chan 1"); - CHECK_SENT("PRIVMSG #test :msg chan 1"); + server_input_data (buffer_chan, "\002msg chan 1"); + CHECK_SENT("PRIVMSG #test :\002msg chan 1"); CHECK_NO_MSG; /* message to channel (with /msg ) */ - server_input_data (buffer_server, "/msg #test msg chan 2"); - CHECK_SENT("PRIVMSG #test :msg chan 2"); + server_input_data (buffer_server, "/msg #test \002msg chan 2"); + CHECK_SENT("PRIVMSG #test :\002msg chan 2"); CHECK_NO_MSG; /* message to channel (with /msg ), channel not joined */ - server_input_data (buffer_server, "/msg #zzz msg chan not joined"); - CHECK_SENT("PRIVMSG #zzz :msg chan not joined"); + server_input_data (buffer_server, "/msg #zzz \002msg chan not joined"); + CHECK_SENT("PRIVMSG #zzz :\002msg chan not joined"); CHECK_NO_MSG; /* STATUSMSG message to channel (with /msg @) */ - server_input_data (buffer_server, "/msg @#test msg chan ops"); - CHECK_SENT("PRIVMSG @#test :msg chan ops"); + server_input_data (buffer_server, "/msg @#test \002msg chan ops"); + CHECK_SENT("PRIVMSG @#test :\002msg chan ops"); CHECK_NO_MSG; /* STATUSMSG message to channel (with /msg @), channel not joined */ - server_input_data (buffer_server, "/msg @#zzz msg chan ops not joined"); - CHECK_SENT("PRIVMSG @#zzz :msg chan ops not joined"); + server_input_data (buffer_server, "/msg @#zzz \002msg chan ops not joined"); + CHECK_SENT("PRIVMSG @#zzz :\002msg chan ops not joined"); CHECK_NO_MSG; /* message to a nick (text in private buffer) */ - server_input_data (buffer_pv, "msg pv 1"); - CHECK_SENT("PRIVMSG bob :msg pv 1"); + server_input_data (buffer_pv, "\002msg pv 1"); + CHECK_SENT("PRIVMSG bob :\002msg pv 1"); CHECK_NO_MSG; /* message to a nick (with /msg ) */ - server_input_data (buffer_server, "/msg bob msg pv 2"); - CHECK_SENT("PRIVMSG bob :msg pv 2"); + server_input_data (buffer_server, "/msg bob \002msg pv 2"); + CHECK_SENT("PRIVMSG bob :\002msg pv 2"); CHECK_NO_MSG; /* message to a nick (with /msg ), hidden password */ @@ -988,33 +988,33 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* message to a nick (with /query ) */ - server_input_data (buffer_server, "/query bob msg pv 3"); - CHECK_SENT("PRIVMSG bob :msg pv 3"); + server_input_data (buffer_server, "/query bob \002msg pv 3"); + CHECK_SENT("PRIVMSG bob :\002msg pv 3"); CHECK_NO_MSG; /* message to a nick (with /query ), private buffer does not exist */ - server_input_data (buffer_server, "/query bob_query msg pv 4"); - CHECK_SENT("PRIVMSG bob_query :msg pv 4"); + server_input_data (buffer_server, "/query bob_query \002msg pv 4"); + CHECK_SENT("PRIVMSG bob_query :\002msg pv 4"); CHECK_NO_MSG; /* notice to channel */ - server_input_data (buffer_server, "/notice #test notice chan"); - CHECK_SENT("NOTICE #test :notice chan"); + server_input_data (buffer_server, "/notice #test \002notice chan"); + CHECK_SENT("NOTICE #test :\002notice chan"); CHECK_NO_MSG; /* STATUSMSG notice to channel */ - server_input_data (buffer_server, "/notice @#test notice chan ops"); - CHECK_SENT("NOTICE @#test :notice chan ops"); + server_input_data (buffer_server, "/notice @#test \002notice chan ops"); + CHECK_SENT("NOTICE @#test :\002notice chan ops"); CHECK_NO_MSG; /* notice to a nick */ - server_input_data (buffer_server, "/notice bob notice pv"); - CHECK_SENT("NOTICE bob :notice pv"); + server_input_data (buffer_server, "/notice bob \002notice pv"); + CHECK_SENT("NOTICE bob :\002notice pv"); CHECK_NO_MSG; /* action on channel (with /me) */ - server_input_data (buffer_chan, "/me action chan 1"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 1\001"); + server_input_data (buffer_chan, "/me \002action chan 1"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 1\001"); CHECK_NO_MSG; /* action on channel (with /me), no message */ @@ -1023,8 +1023,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* action on channel (with raw code: "\001ACTION") */ - server_input_data (buffer_chan, "\001ACTION is testing\001"); - CHECK_SENT("PRIVMSG #test :\001ACTION is testing\001"); + server_input_data (buffer_chan, "\001ACTION \002is testing\001"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002is testing\001"); CHECK_NO_MSG; /* action on channel (with raw code: "\001ACTION"), no message */ @@ -1033,13 +1033,13 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* action on channel (with /action *) */ - server_input_data (buffer_chan, "/action * action chan 2"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 2\001"); + server_input_data (buffer_chan, "/action * \002action chan 2"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 2\001"); CHECK_NO_MSG; /* action on channel (with /action ) */ - server_input_data (buffer_server, "/action #test action chan 3"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 3\001"); + server_input_data (buffer_server, "/action #test \002action chan 3"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 3\001"); CHECK_NO_MSG; /* action on channel (with /action ), no message */ @@ -1048,8 +1048,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* STATUSMSG action on channel (with /action @) */ - server_input_data (buffer_server, "/action @#test action chan 4"); - CHECK_SENT("PRIVMSG @#test :\001ACTION action chan 4\001"); + server_input_data (buffer_server, "/action @#test \002action chan 4"); + CHECK_SENT("PRIVMSG @#test :\001ACTION \002action chan 4\001"); CHECK_NO_MSG; /* STATUSMSG action on channel (with /action @), no message */ @@ -1058,28 +1058,28 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* action on channel (with /ctcp action) */ - server_input_data (buffer_server, "/ctcp #test action action chan 5"); - CHECK_SENT("PRIVMSG #test :\001ACTION action chan 5\001"); + server_input_data (buffer_server, "/ctcp #test action \002action chan 5"); + CHECK_SENT("PRIVMSG #test :\001ACTION \002action chan 5\001"); CHECK_NO_MSG; /* STATUSMSG action on channel (with /ctcp @ action) */ - server_input_data (buffer_server, "/ctcp @#test action action chan ops"); - CHECK_SENT("PRIVMSG @#test :\001ACTION action chan ops\001"); + server_input_data (buffer_server, "/ctcp @#test action \002action chan ops"); + CHECK_SENT("PRIVMSG @#test :\001ACTION \002action chan ops\001"); CHECK_NO_MSG; /* action in private (with /me) */ - server_input_data (buffer_pv, "/me action pv 1"); - CHECK_SENT("PRIVMSG bob :\001ACTION action pv 1\001"); + server_input_data (buffer_pv, "/me \002action pv 1"); + CHECK_SENT("PRIVMSG bob :\001ACTION \002action pv 1\001"); CHECK_NO_MSG; /* action in private (with /ctcp) */ - server_input_data (buffer_server, "/ctcp bob action action pv 2"); - CHECK_SENT("PRIVMSG bob :\001ACTION action pv 2\001"); + server_input_data (buffer_server, "/ctcp bob action \002action pv 2"); + CHECK_SENT("PRIVMSG bob :\001ACTION \002action pv 2\001"); CHECK_NO_MSG; /* action in private (with /ctcp), without private buffer */ - server_input_data (buffer_server, "/ctcp bob2 action action pv 3"); - CHECK_SENT("PRIVMSG bob2 :\001ACTION action pv 3\001"); + server_input_data (buffer_server, "/ctcp bob2 action \002action pv 3"); + CHECK_SENT("PRIVMSG bob2 :\001ACTION \002action pv 3\001"); CHECK_NO_MSG; /* CTCP version to channel */ @@ -1088,8 +1088,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* unknown CTCP to channel */ - server_input_data (buffer_server, "/ctcp #test unknown1 some args"); - CHECK_SENT("PRIVMSG #test :\001UNKNOWN1 some args\001"); + server_input_data (buffer_server, "/ctcp #test unknown1 \002some args"); + CHECK_SENT("PRIVMSG #test :\001UNKNOWN1 \002some args\001"); CHECK_NO_MSG; /* CTCP version to nick */ @@ -1103,8 +1103,8 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage) CHECK_NO_MSG; /* unknown CTCP to nick */ - server_input_data (buffer_server, "/ctcp bob unknown2 some args"); - CHECK_SENT("PRIVMSG bob :\001UNKNOWN2 some args\001"); + server_input_data (buffer_server, "/ctcp bob unknown2 \002some args"); + CHECK_SENT("PRIVMSG bob :\001UNKNOWN2 \002some args\001"); CHECK_NO_MSG; hashtable_remove (ptr_server->cap_list, "echo-message"); @@ -1193,15 +1193,15 @@ TEST(IrcProtocolWithServer, recv_command_not_found) CHECK_SRV("=!=", "irc: command \"XYZ\" not found: \":alice!user@host XYZ\"", ""); - RECV(":alice!user@host XYZ abc def"); + RECV(":alice!user@host XYZ abc :\002def"); CHECK_SRV("=!=", - "irc: command \"XYZ\" not found: \":alice!user@host XYZ abc def\"", + "irc: command \"XYZ\" not found: \":alice!user@host XYZ abc :\002def\"", ""); RECV(":alice!user@host 099"); CHECK_ERROR_PARAMS("099", 0, 1); - RECV(":alice!user@host 099 abc def"); + RECV(":alice!user@host 099 abc :\002def"); CHECK_SRV("--", "abc def", "irc_099,irc_numeric,nick_alice,host_user@host,log3"); } @@ -1281,7 +1281,7 @@ TEST(IrcProtocolWithServer, account_without_account_notify_cap) "irc_account,nick_bob,host_user@host,log3"); STRCMP_EQUAL(NULL, ptr_nick->account); - RECV(":bob!user@host ACCOUNT :new_account"); + RECV(":bob!user@host ACCOUNT :\002new_account"); CHECK_CHAN("--", "bob has identified as new_account", "irc_account,irc_smart_filter,nick_bob,host_user@host,log3"); CHECK_PV("bob", "--", "bob has identified as new_account", @@ -1312,10 +1312,10 @@ TEST(IrcProtocolWithServer, account_with_account_notify_cap) "irc_account,nick_alice,host_user@host,log3"); STRCMP_EQUAL("new_account", ptr_nick->account); - RECV(":alice!user@host ACCOUNT : new account with spaces "); + RECV(":alice!user@host ACCOUNT : \002new account with spaces "); CHECK_CHAN("--", "alice has identified as new account with spaces ", "irc_account,nick_alice,host_user@host,log3"); - STRCMP_EQUAL(" new account with spaces ", ptr_nick->account); + STRCMP_EQUAL(" \002new account with spaces ", ptr_nick->account); RECV(":alice!user@host ACCOUNT *"); CHECK_CHAN("--", "alice has unidentified", @@ -1381,7 +1381,7 @@ TEST(IrcProtocolWithServer, away) CHECK_NO_MSG; LONGS_EQUAL(1, ptr_nick->away); - RECV(":alice!user@host AWAY : Holidays now! "); + RECV(":alice!user@host AWAY : \002Holidays now! "); CHECK_NO_MSG; LONGS_EQUAL(1, ptr_nick->away); @@ -1416,7 +1416,7 @@ TEST(IrcProtocolWithServer, batch_without_batch_cap) POINTERS_EQUAL(NULL, irc_batch_search (ptr_server, "ref")); /* new messages with batch reference */ - RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test : this is a test "); + RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test : \002this is a test "); CHECK_CHAN("bob", " this is a test ", "irc_privmsg,irc_tag_batch=ref,notify_message," "prefix_nick_248,nick_bob,host_user_b@host_b,log1"); @@ -1576,7 +1576,7 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap) LONGS_EQUAL(0, ptr_batch->messages_processed); /* new messages with batch reference */ - RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test : this is a test "); + RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test : \002this is a test "); RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :second test"); RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :third test"); CHECK_NO_MSG; @@ -1885,7 +1885,7 @@ TEST(IrcProtocolWithServer, chghost) SRV_INIT_JOIN2; - RECV(":bob!user@host PRIVMSG alice :hi Alice!"); + RECV(":bob!user_\00304red@host_\00304red PRIVMSG alice :hi Alice!"); ptr_nick = ptr_server->channels->nicks; ptr_nick2 = ptr_server->channels->last_nick; @@ -1921,17 +1921,17 @@ TEST(IrcProtocolWithServer, chghost) STRCMP_EQUAL("user3@host3", ptr_nick->host); /* another nick */ - RECV(":bob!user@host CHGHOST user_bob_2 host_bob_2"); + RECV(":bob!user_\00304red@host_\00304red CHGHOST user_\00302blue host_\00302blue"); CHECK_CHAN("--", - "bob (user@host) has changed host to user_bob_2@host_bob_2", - "irc_chghost,new_host_user_bob_2@host_bob_2,irc_smart_filter," - "nick_bob,host_user@host,log3"); - STRCMP_EQUAL("user_bob_2@host_bob_2", ptr_nick2->host); + "bob (user_red@host_red) has changed host to user_blue@host_blue", + "irc_chghost,new_host_user_\00302blue@host_\00302blue,irc_smart_filter," + "nick_bob,host_user_\00304red@host_\00304red,log3"); + STRCMP_EQUAL("user_\00302blue@host_\00302blue", ptr_nick2->host); CHECK_PV("bob", "--", - "bob (user@host) has changed host to user_bob_2@host_bob_2", - "irc_chghost,new_host_user_bob_2@host_bob_2,nick_bob," - "host_user@host,log3"); + "bob (user_red@host_red) has changed host to user_blue@host_blue", + "irc_chghost,new_host_user_\00302blue@host_\00302blue,nick_bob," + "host_user_\00304red@host_\00304red,log3"); } /* @@ -1949,7 +1949,7 @@ TEST(IrcProtocolWithServer, error) RECV("ERROR test"); CHECK_SRV("=!=", "test", "irc_error,log3"); - RECV("ERROR : Closing Link: irc.server.org (Bad Password) "); + RECV("ERROR : Closing Link: irc.server.org (\002Bad Password\002) "); CHECK_SRV("=!=", " Closing Link: irc.server.org (Bad Password) ", "irc_error,log3"); } @@ -1973,7 +1973,7 @@ TEST(IrcProtocolWithServer, fail) RECV(":server FAIL * TEST"); CHECK_SRV("=!=", "Failure: [] TEST", "irc_fail,nick_server,log3"); - RECV(":server FAIL * TEST : the message "); + RECV(":server FAIL * TEST : \002the message "); CHECK_SRV("=!=", "Failure: [TEST] the message ", "irc_fail,nick_server,log3"); RECV(":server FAIL * TEST TEST2"); CHECK_SRV("=!=", "Failure: [TEST] TEST2", "irc_fail,nick_server,log3"); @@ -2105,7 +2105,7 @@ TEST(IrcProtocolWithServer, join) STRCMP_EQUAL(" ", ptr_nick->realname); CHECK(ptr_nick->color); - RECV(":carol!user@host JOIN #test carol_account : Carol Name "); + RECV(":carol!user@host JOIN #test carol_account : \002Carol Name "); CHECK_CHAN("-->", "carol [carol_account] ( Carol Name ) (user@host) " "has joined #test", @@ -2121,7 +2121,7 @@ TEST(IrcProtocolWithServer, join) STRCMP_EQUAL(" ", ptr_nick->prefix); LONGS_EQUAL(0, ptr_nick->away); STRCMP_EQUAL("carol_account", ptr_nick->account); - STRCMP_EQUAL(" Carol Name ", ptr_nick->realname); + STRCMP_EQUAL(" \002Carol Name ", ptr_nick->realname); CHECK(ptr_nick->color); /* join with option irc.look.display_host_join set to off */ @@ -2182,7 +2182,7 @@ TEST(IrcProtocolWithServer, kick) STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name); /* channel not found */ - RECV(":alice!user@host KICK #xyz bob :the reason"); + RECV(":alice!user@host KICK #xyz bob :\002the reason"); CHECK_NO_MSG; /* kick without a reason */ @@ -2197,7 +2197,7 @@ TEST(IrcProtocolWithServer, kick) "irc_join,irc_smart_filter,nick_bob,host_user@host,log4"); /* with kick a reason */ - RECV(":alice!user@host KICK #test bob :no spam here! "); + RECV(":alice!user@host KICK #test bob :\002no spam here! "); CHECK_CHAN("<--", "alice has kicked bob (no spam here! )", "irc_kick,nick_alice,host_user@host,log3"); STRCMP_EQUAL("alice", ptr_channel->nicks->name); @@ -2208,7 +2208,7 @@ TEST(IrcProtocolWithServer, kick) "irc_join,irc_smart_filter,nick_bob,host_user@host,log4"); /* kick of self nick */ - RECV(":bob!user@host KICK #test alice :no spam here! "); + RECV(":bob!user@host KICK #test alice :\002no spam here! "); CHECK_CHAN("<--", "bob has kicked alice (no spam here! )", "irc_kick,nick_bob,host_user@host,log3"); POINTERS_EQUAL(NULL, ptr_channel->nicks); @@ -2257,7 +2257,7 @@ TEST(IrcProtocolWithServer, kill) "irc_join,irc_smart_filter,nick_bob,host_user@host,log4"); /* kill with a reason */ - RECV(":bob!user@host KILL alice :killed by admin "); + RECV(":bob!user@host KILL alice :\002killed by admin "); CHECK_CHAN("<--", "You were killed by bob (killed by admin )", "irc_kill,nick_bob,host_user@host,log3"); POINTERS_EQUAL(NULL, ptr_channel->nicks); @@ -2460,7 +2460,7 @@ TEST(IrcProtocolWithServer, note) RECV(":server NOTE * TEST"); CHECK_SRV("--", "Note: [] TEST", "irc_note,nick_server,log3"); - RECV(":server NOTE * TEST : the message "); + RECV(":server NOTE * TEST : \002the message "); CHECK_SRV("--", "Note: [TEST] the message ", "irc_note,nick_server,log3"); RECV(":server NOTE * TEST TEST2"); CHECK_SRV("--", "Note: [TEST] TEST2", "irc_note,nick_server,log3"); @@ -2511,7 +2511,7 @@ TEST(IrcProtocolWithServer, notice) CHECK_ERROR_PARSE("notice", ":bob!user@host NOTICE alice"); /* notice from server */ - RECV("NOTICE AUTH :*** Looking up your hostname... "); + RECV("NOTICE AUTH :\002*** Looking up your hostname... "); CHECK_SRV("--", "*** Looking up your hostname... ", "irc_notice,log1"); RECV(":server.address NOTICE AUTH :*** Looking up your hostname... "); CHECK_SRV("--", "server.address: *** Looking up your hostname... ", @@ -2521,7 +2521,7 @@ TEST(IrcProtocolWithServer, notice) "irc_notice,notify_private,nick_server.address,log1"); /* notice to channel/user */ - RECV(":server.address NOTICE #test :a notice "); + RECV(":server.address NOTICE #test :\002a notice "); CHECK_CHAN("--", "Notice(server.address) -> #test: a notice ", "irc_notice,notify_message,nick_server.address,log1"); RECV(":server.address NOTICE alice :a notice "); @@ -2534,9 +2534,17 @@ TEST(IrcProtocolWithServer, notice) CHECK_SRV("--", "bob (user@host): a notice ", "irc_notice,notify_private,nick_bob,host_user@host,log1"); + /* notice to channel/user with color in address */ + RECV(":bob!user_\00304red@host_\00304red NOTICE #test :a notice "); + CHECK_CHAN("--", "Notice(bob) -> #test: a notice ", + "irc_notice,notify_message,nick_bob,host_user_\00304red@host_\00304red,log1"); + RECV(":bob!user_\00304red@host_\00304red NOTICE alice :a notice "); + CHECK_SRV("--", "bob (user_red@host_red): a notice ", + "irc_notice,notify_private,nick_bob,host_user_\00304red@host_\00304red,log1"); + /* notice to channel/user with option irc.look.display_host_notice set to off */ config_file_option_set (irc_config_look_display_host_notice, "off", 1); - RECV(":server.address NOTICE #test :a notice "); + RECV(":server.address NOTICE #test :\002a notice "); CHECK_CHAN("--", "Notice(server.address) -> #test: a notice ", "irc_notice,notify_message,nick_server.address,log1"); RECV(":server.address NOTICE alice :a notice "); @@ -2554,13 +2562,13 @@ TEST(IrcProtocolWithServer, notice) * notice to channel/user from self nick * (case of bouncer or if echo-message capability is enabled) */ - RECV(":alice!user@host NOTICE #test :a notice "); + RECV(":alice!user@host NOTICE #test :\002a notice "); CHECK_CHAN("--", "Notice(alice) -> #test: a notice ", "irc_notice,self_msg,notify_none,no_highlight,nick_alice," "host_user@host,log1"); /* notice to ops of channel */ - RECV(":server.address NOTICE @#test :a notice "); + RECV(":server.address NOTICE @#test :\002a notice "); CHECK_CHAN("--", "Notice(server.address) -> @#test: a notice ", "irc_notice,notify_message,nick_server.address,log1"); RECV(":bob!user@host NOTICE @#test :a notice "); @@ -2571,7 +2579,7 @@ TEST(IrcProtocolWithServer, notice) * notice to ops of channel from self nick * (case of bouncer or if echo-message capability is enabled) */ - RECV(":alice!user@host NOTICE @#test :a notice "); + RECV(":alice!user@host NOTICE @#test :\002a notice "); CHECK_CHAN("--", "Notice(alice) -> @#test: a notice ", "irc_notice,self_msg,notify_none,no_highlight,nick_alice," "host_user@host,log1"); @@ -2580,12 +2588,12 @@ TEST(IrcProtocolWithServer, notice) * notice from self nick * (case of bouncer or if echo-message capability is enabled) */ - RECV(":alice!user@host NOTICE alice :a notice "); + RECV(":alice!user@host NOTICE alice :\002a notice "); CHECK_SRV("--", "Notice -> alice: a notice ", "irc_notice,notify_private,nick_alice,host_user@host,log1"); /* notice with channel name at beginning */ - RECV(":server.address NOTICE alice :[#test] a notice "); + RECV(":server.address NOTICE alice :[#test] \002a notice "); CHECK_CHAN("--", "PvNotice(server.address): a notice ", "irc_notice,nick_server.address,log1"); RECV(":server.address NOTICE alice :(#test) a notice "); @@ -2614,7 +2622,7 @@ TEST(IrcProtocolWithServer, notice) * notice to another nick with channel name at beginning * (case of a notice sent if echo-message capability is enabled) */ - RECV(":alice!user@host NOTICE bob :[#test] a notice "); + RECV(":alice!user@host NOTICE bob :[#test] \002a notice "); CHECK_SRV("--", "Notice -> bob: [#test] a notice ", "irc_notice,notify_private,nick_alice,host_user@host,log1"); @@ -2762,7 +2770,7 @@ TEST(IrcProtocolWithServer, part) /* with part message */ RECV(":alice!user@host JOIN #test"); - RECV(":alice!user@host PART #test :part message "); + RECV(":alice!user@host PART #test :\002part message "); CHECK_CHAN("<--", "alice (user@host) has left #test (part message )", "irc_part,nick_alice,host_user@host,log4"); STRCMP_EQUAL("#test", ptr_server->channels->name); @@ -2799,9 +2807,9 @@ TEST(IrcProtocolWithServer, ping) CHECK_ERROR_PARAMS("ping", 0, 1); CHECK_SENT(NULL); - RECV("PING :123456789 "); + RECV("PING :\002123456789 "); CHECK_NO_MSG; - CHECK_SENT("PONG :123456789 "); + CHECK_SENT("PONG :\002123456789 "); } /* @@ -2817,7 +2825,7 @@ TEST(IrcProtocolWithServer, pong) CHECK_SRV("", "PONG", "irc_pong,nick_server,log3"); RECV(":server PONG server"); CHECK_SRV("", "PONG", "irc_pong,nick_server,log3"); - RECV(":server PONG server : info "); + RECV(":server PONG server : \002info "); CHECK_SRV("", "PONG: info ", "irc_pong,nick_server,log3"); RECV(":server PONG server :extra info"); CHECK_SRV("", "PONG: extra info", "irc_pong,nick_server,log3"); @@ -2857,7 +2865,7 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_ERROR_NICK("privmsg"); /* message to channel/user */ - RECV(":bob!user@host PRIVMSG #test :this is the message "); + RECV(":bob!user@host PRIVMSG #test :\002this is the message "); CHECK_CHAN_DATE_NOW("bob", "this is the message ", "irc_privmsg,notify_message,prefix_nick_248,nick_bob," "host_user@host,log1"); @@ -2868,7 +2876,7 @@ TEST(IrcProtocolWithServer, privmsg) /* message with tags to channel/user */ RECV("@tag1=value1;tag2=value2 :bob!user@host PRIVMSG #test " - ":this is the message "); + ":\002this is the message "); CHECK_CHAN_DATE_NOW("bob", "this is the message ", "irc_privmsg,irc_tag_tag1=value1,irc_tag_tag2=value2," "notify_message,prefix_nick_248,nick_bob,host_user@host,log1"); @@ -2880,7 +2888,7 @@ TEST(IrcProtocolWithServer, privmsg) /* message with tags + time as timestamp to channel/user */ RECV("@tag1=value1;tag2=value2;time=1703500149 :bob!user@host PRIVMSG #test " - ":this is the message "); + ":\002this is the message "); CHECK_CHAN_DATE_VALUE( "bob", "this is the message ", @@ -2891,7 +2899,7 @@ TEST(IrcProtocolWithServer, privmsg) /* message with tags + time as timestamp with milliseconds to channel/user */ RECV("@tag1=value1;tag2=value2;time=1703500149.456 :bob!user@host PRIVMSG #test " - ":this is the message "); + ":\002this is the message "); CHECK_CHAN_DATE_VALUE( "bob", "this is the message ", @@ -2902,7 +2910,7 @@ TEST(IrcProtocolWithServer, privmsg) /* message with tags + time as timestamp with microseconds to channel/user */ RECV("@tag1=value1;tag2=value2;time=1703500149.456789 :bob!user@host PRIVMSG #test " - ":this is the message "); + ":\002this is the message "); CHECK_CHAN_DATE_VALUE( "bob", "this is the message ", @@ -2913,7 +2921,7 @@ TEST(IrcProtocolWithServer, privmsg) /* message with tags + time as ISO 8601 with microseconds to channel/user */ RECV("@tag1=value1;tag2=value2;time=2023-12-25T10:29:09.456789Z " - ":bob!user@host PRIVMSG #test :this is the message "); + ":bob!user@host PRIVMSG #test :\002this is the message "); CHECK_CHAN_DATE_VALUE( "bob", "this is the message ", @@ -2927,13 +2935,13 @@ TEST(IrcProtocolWithServer, privmsg) * message to channel/user from self nick * (case of bouncer or if echo-message capability is enabled) */ - RECV(":alice!user@host PRIVMSG #test :this is the message "); + RECV(":alice!user@host PRIVMSG #test :\002this is the message "); CHECK_CHAN("alice", "this is the message ", "irc_privmsg,self_msg,notify_none,no_highlight," "prefix_nick_white,nick_alice,host_user@host,log1"); /* message to ops of channel */ - RECV(":bob!user@host PRIVMSG @#test :this is the message "); + RECV(":bob!user@host PRIVMSG @#test :\002this is the message "); CHECK_CHAN("--", "Msg(bob) -> @#test: this is the message ", "irc_privmsg,notify_message,nick_bob,host_user@host,log1"); @@ -2941,7 +2949,7 @@ TEST(IrcProtocolWithServer, privmsg) * message to ops of channel from self nick * (case of bouncer or if echo-message capability is enabled) */ - RECV(":alice!user@host PRIVMSG @#test :this is the message "); + RECV(":alice!user@host PRIVMSG @#test :\002this is the message "); CHECK_CHAN("--", "Msg(alice) -> @#test: this is the message ", "irc_privmsg,self_msg,notify_none,no_highlight,nick_alice," "host_user@host,log1"); @@ -2953,7 +2961,7 @@ TEST(IrcProtocolWithServer, privmsg) if (echo_message == 0) { /* without echo-message */ - RECV(":alice!user@host PRIVMSG bob :this is the message "); + RECV(":alice!user@host PRIVMSG bob :\002this is the message "); CHECK_PV_CLOSE("bob", "alice", "this is the message ", "irc_privmsg,self_msg,notify_none,no_highlight," "prefix_nick_white,nick_alice,host_user@host,log1"); @@ -2961,14 +2969,14 @@ TEST(IrcProtocolWithServer, privmsg) else { /* with echo-message */ - RECV(":alice!user@host PRIVMSG bob :this is the message "); + RECV(":alice!user@host PRIVMSG bob :\002this is the message "); CHECK_PV_CLOSE("bob", "alice", "this is the message ", "irc_privmsg,self_msg,notify_none,no_highlight," "prefix_nick_white,nick_alice,host_user@host,log1"); /* with echo-message, option irc.look.open_pv_buffer_echo_msg off */ config_file_option_set (irc_config_look_open_pv_buffer_echo_msg, "off", 1); - RECV(":alice!user@host PRIVMSG bob :this is the message "); + RECV(":alice!user@host PRIVMSG bob :\002this is the message "); CHECK_SRV("--", "Msg(alice) -> bob: this is the message ", "irc_privmsg,self_msg,notify_none,no_highlight," "nick_alice,host_user@host,log1"); @@ -3018,7 +3026,7 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_CHAN(" *", "bob", "irc_privmsg,irc_action,notify_message,nick_bob," "host_user@host,log1"); - RECV(":bob!user@host PRIVMSG #test :\001ACTION is testing"); + RECV(":bob!user@host PRIVMSG #test :\001ACTION \002is testing"); CHECK_SENT(NULL); CHECK_CHAN(" *", "bob is testing", "irc_privmsg,irc_action,notify_message,nick_bob," @@ -3073,7 +3081,7 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_PV_CLOSE("bob", " *", "bob", "irc_privmsg,irc_action,notify_private,nick_bob," "host_user@host,log1"); - RECV(":bob!user@host PRIVMSG alice :\001ACTION is testing"); + RECV(":bob!user@host PRIVMSG alice :\001ACTION \002is testing"); CHECK_SENT(NULL); CHECK_PV_CLOSE("bob", " *", "bob is testing", "irc_privmsg,irc_action,notify_private,nick_bob," @@ -3154,7 +3162,7 @@ TEST(IrcProtocolWithServer, privmsg) "irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z," "irc_action,notify_message,nick_bob,host_user@host,log1"); RECV("@time=2023-12-25T10:29:09.456789Z " - ":bob!user@host PRIVMSG @#test :\001ACTION is testing\001"); + ":bob!user@host PRIVMSG @#test :\001ACTION \002is testing\001"); CHECK_SENT(NULL); CHECK_CHAN("--", "Action -> @#test: bob is testing", "irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z," @@ -3232,7 +3240,7 @@ TEST(IrcProtocolWithServer, privmsg) "irc_action,self_msg,notify_none,no_highlight,nick_alice," "host_user@host,log1"); RECV("@time=2023-12-25T10:29:09.456789Z " - ":alice!user@host PRIVMSG @#test :\001ACTION is testing\001"); + ":alice!user@host PRIVMSG @#test :\001ACTION \002is testing\001"); CHECK_SENT(NULL); CHECK_CHAN("--", "Action -> @#test: alice is testing", "irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z," @@ -3261,7 +3269,7 @@ TEST(IrcProtocolWithServer, privmsg) ":bob!user@host PRIVMSG alice :\001ACTION\001"); CHECK_SENT(NULL); RECV("@time=2023-12-25T10:29:09.456789Z " - ":bob!user@host PRIVMSG alice :\001ACTION is testing\001"); + ":bob!user@host PRIVMSG alice :\001ACTION \002is testing\001"); CHECK_SENT(NULL); RECV("@time=2023-12-25T10:29:09.456789Z " ":bob!user@host PRIVMSG alice :\001PING 1703496549 905284\001"); @@ -3425,17 +3433,30 @@ TEST(IrcProtocolWithServer, quit) /* with quit message */ RECV(":bob!user@host JOIN #test"); - RECV(":bob!user@host QUIT :quit message "); + RECV(":bob!user@host QUIT :\002quit message "); CHECK_CHAN("<--", "bob (user@host) has quit (quit message )", "irc_quit,irc_smart_filter,nick_bob,host_user@host,log4"); LONGS_EQUAL(1, ptr_channel->nicks_count); STRCMP_EQUAL("alice", ptr_channel->nicks->name); POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick); + /* with quit message */ + RECV(":bob!user_\00304red@host_\00304red JOIN #test"); + RECV(":bob!user_\00304red@host_\00304red QUIT :\002quit message "); + CHECK_CHAN("<--", "bob (user_red@host_red) has quit (quit message )", + "irc_quit,irc_smart_filter,nick_bob,host_user_\00304red@host_\00304red,log4"); + LONGS_EQUAL(1, ptr_channel->nicks_count); + STRCMP_EQUAL("alice", ptr_channel->nicks->name); + POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick); + RECV(":bob!user_\00304red@host_\00304red JOIN #test"); + CHECK_PV("bob", "-->", "bob (user_red@host_red) is back on server", + "irc_nick_back,nick_bob,host_user_\00304red@host_\00304red,log4"); + RECV(":bob!user_\00304red@host_\00304red QUIT :\002quit message "); + /* quit with option irc.look.display_host_quit set to off */ config_file_option_set (irc_config_look_display_host_quit, "off", 1); RECV(":bob!user@host JOIN #test"); - RECV(":bob!user@host QUIT :quit message "); + RECV(":bob!user@host QUIT :\002quit message "); CHECK_CHAN("<--", "bob has quit (quit message )", "irc_quit,irc_smart_filter,nick_bob,host_user@host,log4"); config_file_option_reset (irc_config_look_display_host_quit, 1); @@ -3467,13 +3488,13 @@ TEST(IrcProtocolWithServer, setname_without_setname_cap) STRCMP_EQUAL(NULL, ptr_nick->realname); /* real name of "bob" has changed */ - RECV(":bob!user@host SETNAME :new bob realname "); + RECV(":bob!user@host SETNAME :\002new bob realname "); CHECK_CHAN("--", "bob has changed real name to \"new bob realname \"", "irc_setname,irc_smart_filter,nick_bob,host_user@host,log3"); STRCMP_EQUAL(NULL, ptr_nick->realname); /* self real name has changed */ - RECV(":alice!user@host SETNAME :new alice realname "); + RECV(":alice!user@host SETNAME :\002new alice realname "); CHECK_SRV("--", "Your real name has been set to \"new alice realname \"", "irc_setname,nick_alice,host_user@host,log3"); STRCMP_EQUAL(NULL, ptr_nick->realname); @@ -3499,10 +3520,10 @@ TEST(IrcProtocolWithServer, setname_with_setname_cap) STRCMP_EQUAL(NULL, ptr_nick->realname); /* real name of "bob" has changed */ - RECV(":bob!user@host SETNAME :new bob realname "); + RECV(":bob!user@host SETNAME :\002new bob realname "); CHECK_CHAN("--", "bob has changed real name to \"new bob realname \"", "irc_setname,irc_smart_filter,nick_bob,host_user@host,log3"); - STRCMP_EQUAL("new bob realname ", ptr_nick2->realname); + STRCMP_EQUAL("\002new bob realname ", ptr_nick2->realname); /* self real name has changed */ RECV(":alice!user@host SETNAME :new realname"); @@ -3613,18 +3634,18 @@ TEST(IrcProtocolWithServer, topic) STRCMP_EQUAL(NULL, ptr_channel->topic); /* new topic */ - RECV(":alice!user@host TOPIC #test :new topic "); + RECV(":alice!user@host TOPIC #test :\002new topic "); CHECK_CHAN("--", "alice has changed topic for #test to \"new topic \"", "irc_topic,nick_alice,host_user@host,log3"); - STRCMP_EQUAL("new topic ", ptr_channel->topic); + STRCMP_EQUAL("\002new topic ", ptr_channel->topic); /* another new topic */ - RECV(":alice!user@host TOPIC #test :another new topic "); + RECV(":alice!user_\00304red@host_\00304red TOPIC #test :\00304another new topic "); CHECK_CHAN("--", - "alice has changed topic for #test from \"new topic \" to " - "\"another new topic \"", - "irc_topic,nick_alice,host_user@host,log3"); - STRCMP_EQUAL("another new topic ", ptr_channel->topic); + "alice has changed topic for #test from " + "\"new topic \" to \"another new topic \"", + "irc_topic,nick_alice,host_user_\00304red@host_\00304red,log3"); + STRCMP_EQUAL("\00304another new topic ", ptr_channel->topic); /* empty topic */ RECV(":alice!user@host TOPIC #test"); @@ -3652,7 +3673,7 @@ TEST(IrcProtocolWithServer, wallops) CHECK_SRV("--", "Wallops from alice (user@host): message", "irc_wallops,notify_private,nick_alice,host_user@host,log3"); - RECV(":alice!user@host WALLOPS :message from admin "); + RECV(":alice!user@host WALLOPS :\002message from admin "); CHECK_SRV("--", "Wallops from alice (user@host): message from admin ", "irc_wallops,notify_private,nick_alice,host_user@host,log3"); @@ -3683,7 +3704,7 @@ TEST(IrcProtocolWithServer, warn) RECV(":server WARN * TEST"); CHECK_SRV("=!=", "Warning: [] TEST", "irc_warn,nick_server,log3"); - RECV(":server WARN * TEST : the message "); + RECV(":server WARN * TEST : \002the message "); CHECK_SRV("=!=", "Warning: [TEST] the message ", "irc_warn,nick_server,log3"); RECV(":server WARN * TEST TEST2"); CHECK_SRV("=!=", "Warning: [TEST] TEST2", "irc_warn,nick_server,log3"); @@ -3867,7 +3888,7 @@ TEST(IrcProtocolWithServer, 008) RECV(":server 008 alice"); CHECK_ERROR_PARAMS("008", 1, 2); - RECV(":server 008 alice +Zbfkrsuy : Server notice mask "); + RECV(":server 008 alice +Zbfkrsuy : \002Server notice mask "); CHECK_SRV("--", "Server notice mask for alice: +Zbfkrsuy Server notice mask ", "irc_008,irc_numeric,nick_server,log3"); @@ -3896,7 +3917,7 @@ TEST(IrcProtocolWithServer, 221) STRCMP_EQUAL("abc", ptr_server->nick_modes); RECV(":server 221 alice :-abc"); - CHECK_SRV("--","User mode for alice is [-abc]", + CHECK_SRV("--", "User mode for alice is [-abc]", "irc_221,irc_numeric,nick_server,log3"); STRCMP_EQUAL(NULL, ptr_server->nick_modes); } @@ -4002,7 +4023,7 @@ TEST(IrcProtocolWithServer, whois_nick_msg) CHECK_SRV("--", "[bob] UTF-8 ", "irc_223,irc_numeric,nick_server,log3"); RECV(":server 223 alice bob"); CHECK_SRV("--", "bob", "irc_223,irc_numeric,nick_server,log3"); - RECV(":server 264 alice bob : is using encrypted connection "); + RECV(":server 264 alice bob : \002is using encrypted connection "); CHECK_SRV("--", "[bob] is using encrypted connection ", "irc_264,irc_numeric,nick_server,log3"); RECV(":server 264 alice bob"); @@ -4089,7 +4110,7 @@ TEST(IrcProtocolWithServer, whowas_nick_msg) RECV(":server 369 alice bob end"); CHECK_SRV("--", "[bob] end", "irc_369,irc_numeric,nick_server,log3"); - RECV(":server 369 alice bob : end "); + RECV(":server 369 alice bob : \002end "); CHECK_SRV("--", "[bob] end ", "irc_369,irc_numeric,nick_server,log3"); RECV(":server 369 alice bob"); CHECK_SRV("--", "bob", "irc_369,irc_numeric,nick_server,log3"); @@ -4119,10 +4140,10 @@ TEST(IrcProtocolWithServer, 301) CHECK_NO_MSG; STRCMP_EQUAL(NULL, ptr_server->channels->away_message); - RECV(":server 301 alice bob :I am away "); - CHECK_PV("bob", "--", "[bob] is away: I am away ", + RECV(":server 301 alice bob : \002I am away "); + CHECK_PV("bob", "--", "[bob] is away: I am away ", "irc_301,irc_numeric,nick_server,log3"); - STRCMP_EQUAL("I am away ", ptr_server->channels->away_message); + STRCMP_EQUAL(" \002I am away ", ptr_server->channels->away_message); } /* @@ -4176,11 +4197,11 @@ TEST(IrcProtocolWithServer, 305_306) CHECK_NO_MSG; LONGS_EQUAL(0, ptr_server->is_away); - RECV(":server 306 alice : We'll miss you "); /* now away */ + RECV(":server 306 alice : \002We'll miss you "); /* now away */ CHECK_SRV("--", " We'll miss you ", "irc_306,irc_numeric,nick_server,log3"); LONGS_EQUAL(1, ptr_server->is_away); - RECV(":server 305 alice : Does this mean you're really back? "); + RECV(":server 305 alice : \002Does this mean you're really back? "); CHECK_SRV("--", " Does this mean you're really back? ", "irc_305,irc_numeric,nick_server,log3"); LONGS_EQUAL(0, ptr_server->is_away); @@ -4209,8 +4230,8 @@ TEST(IrcProtocolWithServer, 311) CHECK_SRV("--", "[bob] user", "irc_311,irc_numeric,nick_server,log3"); /* standard parameters */ - RECV(":server 311 alice bob user host * : real name "); - CHECK_SRV("--", "[bob] (user@host): real name ", + RECV(":server 311 alice bob user_\00304red host_\00302blue * : \002real name "); + CHECK_SRV("--", "[bob] (user_red@host_blue): real name ", "irc_311,irc_numeric,nick_server,log3"); } @@ -4236,7 +4257,7 @@ TEST(IrcProtocolWithServer, 312) CHECK_SRV("--", "[bob] server", "irc_312,irc_numeric,nick_server,log3"); /* standard parameters */ - RECV(":server 312 alice bob server : https://example.com/ "); + RECV(":server 312 alice bob server : \002https://example.com/ "); CHECK_SRV("--", "[bob] server ( https://example.com/ )", "irc_312,irc_numeric,nick_server,log3"); } @@ -4263,7 +4284,7 @@ TEST(IrcProtocolWithServer, 314) CHECK_SRV("--", "[bob] user", "irc_314,irc_numeric,nick_server,log3"); /* standard parameters */ - RECV(":server 314 alice bob user host * : real name "); + RECV(":server 314 alice bob user host * : \002real name "); CHECK_SRV("--", "[bob] (user@host) was real name ", "irc_314,irc_numeric,nick_server,log3"); } @@ -4289,7 +4310,7 @@ TEST(IrcProtocolWithServer, 315) CHECK_SRV("--", "[#test] end", "irc_315,irc_numeric,nick_server,log3"); - RECV(":server 315 alice #test : End of /WHO list. "); + RECV(":server 315 alice #test : \002End of /WHO list. "); CHECK_SRV("--", "[#test] End of /WHO list. ", "irc_315,irc_numeric,nick_server,log3"); } @@ -4322,7 +4343,7 @@ TEST(IrcProtocolWithServer, 317) "[bob] idle: 1 day, 10 hours 07 minutes 57 seconds, " "signon at: Wed, 12 Mar 2008 13:18:00", "irc_317,irc_numeric,nick_server,log3"); - RECV(":server 317 alice bob 122877 1205327880 :seconds idle, signon time "); + RECV(":server 317 alice bob 122877 1205327880 :\002seconds idle, signon time "); CHECK_SRV("--", "[bob] idle: 1 day, 10 hours 07 minutes 57 seconds, " "signon at: Wed, 12 Mar 2008 13:18:00", @@ -4356,7 +4377,7 @@ TEST(IrcProtocolWithServer, 321) CHECK_SRV("--", "#test", "irc_321,irc_numeric,nick_server,log3"); RECV(":server 321 alice #test Users"); CHECK_SRV("--", "#test Users", "irc_321,irc_numeric,nick_server,log3"); - RECV(":server 321 alice #test : Users Name "); + RECV(":server 321 alice #test : \002Users Name "); CHECK_SRV("--", "#test Users Name ", "irc_321,irc_numeric,nick_server,log3"); } @@ -4379,7 +4400,7 @@ TEST(IrcProtocolWithServer, 322) RECV(":server 322 alice #test 3"); CHECK_SRV("--", "#test(3)", "irc_322,irc_numeric,nick_server,log3"); - RECV(":server 322 alice #test 3 :topic of channel "); + RECV(":server 322 alice #test 3 :\002topic of channel "); CHECK_SRV("--", "#test(3): topic of channel ", "irc_322,irc_numeric,nick_server,log3"); @@ -4417,7 +4438,7 @@ TEST(IrcProtocolWithServer, 323) CHECK_SRV("--", "", "irc_323,irc_numeric,nick_server,log3"); RECV(":server 323 alice end"); CHECK_SRV("--", "end", "irc_323,irc_numeric,nick_server,log3"); - RECV(":server 323 alice : End of /LIST "); + RECV(":server 323 alice : \002End of /LIST "); CHECK_SRV("--", " End of /LIST ", "irc_323,irc_numeric,nick_server,log3"); } @@ -4475,8 +4496,8 @@ TEST(IrcProtocolWithServer, 327) /* standard parameters */ RECV(":server 327 alice bob host 1.2.3.4"); CHECK_SRV("--", "[bob] host 1.2.3.4", "irc_327,irc_numeric,nick_server,log3"); - RECV(":server 327 alice bob host 1.2.3.4 : real name "); - CHECK_SRV("--", "[bob] host 1.2.3.4 ( real name )", + RECV(":server 327 alice bob host_\00304red 1.2.3.4 : \002real name "); + CHECK_SRV("--", "[bob] host_red 1.2.3.4 ( real name )", "irc_327,irc_numeric,nick_server,log3"); } @@ -4500,7 +4521,7 @@ TEST(IrcProtocolWithServer, 328) RECV(":server 328 alice #test :https://example.com/"); CHECK_CHAN("--", "URL for #test: https://example.com/", "irc_328,irc_numeric,nick_server,log3"); - RECV(":server 328 alice #test : URL is https://example.com/ "); + RECV(":server 328 alice #test : \002URL is https://example.com/ "); CHECK_CHAN("--", "URL for #test: URL is https://example.com/ ", "irc_328,irc_numeric,nick_server,log3"); } @@ -4566,13 +4587,13 @@ TEST(IrcProtocolWithServer, 330_343) RECV(":server 330 alice bob bob2"); CHECK_SRV("--", "[bob] bob2", "irc_330,irc_numeric,nick_server,log3"); - RECV(":server 330 alice bob bob2 : is logged in as "); + RECV(":server 330 alice bob bob2 : \002is logged in as "); CHECK_SRV("--", "[bob] is logged in as bob2", "irc_330,irc_numeric,nick_server,log3"); RECV(":server 343 alice bob bob2"); CHECK_SRV("--", "[bob] bob2", "irc_343,irc_numeric,nick_server,log3"); - RECV(":server 343 alice bob bob2 :is opered as "); + RECV(":server 343 alice bob bob2 :\002is opered as "); CHECK_SRV("--", "[bob] is opered as bob2", "irc_343,irc_numeric,nick_server,log3"); } @@ -4623,10 +4644,11 @@ TEST(IrcProtocolWithServer, 332) CHECK_CHAN("--", "Topic for #test is \"\"", "irc_332,irc_numeric,nick_server,log3"); - RECV(":server 332 alice #test :the new topic "); + RECV(":server 332 alice #test :\002the new topic "); CHECK_CHAN("--", "Topic for #test is \"the new topic \"", "irc_332,irc_numeric,nick_server,log3"); - STRCMP_EQUAL("the new topic ", ptr_server->channels->topic); + STRCMP_EQUAL("\002the new topic ", + ptr_server->channels->topic); } /* @@ -4646,22 +4668,22 @@ TEST(IrcProtocolWithServer, 333) RECV(":server 333 alice #test"); CHECK_ERROR_PARAMS("333", 2, 3); - RECV(":server 333 alice #test nick!user@host"); + RECV(":server 333 alice #test nick!user_\00304red@host_\00304red"); CHECK_NO_MSG; - RECV(":server 333 alice #test nick!user@host 1205428096"); + RECV(":server 333 alice #test nick!user_\00304red@host_\00304red 1205428096"); CHECK_CHAN("--", - "Topic set by nick (user@host) on Thu, 13 Mar 2008 17:08:16", + "Topic set by nick (user_red@host_red) on Thu, 13 Mar 2008 17:08:16", "irc_333,irc_numeric,nick_server,log3"); RECV(":server 333 alice #test 1205428096 "); CHECK_CHAN("--", "Topic set on Thu, 13 Mar 2008 17:08:16", "irc_333,irc_numeric,nick_server,log3"); /* channel not found */ - RECV(":server 333 alice #xyz nick!user@host"); + RECV(":server 333 alice #xyz nick!user_\00304red@host_\00304red"); CHECK_NO_MSG; - RECV(":server 333 alice #xyz nick!user@host 1205428096"); + RECV(":server 333 alice #xyz nick!user_\00304red@host_\00304red 1205428096"); CHECK_SRV("--", - "Topic for #xyz set by nick (user@host) on " + "Topic for #xyz set by nick (user_red@host_red) on " "Thu, 13 Mar 2008 17:08:16", "irc_333,irc_numeric,nick_server,log3"); RECV(":server 333 alice #xyz 1205428096"); @@ -4686,13 +4708,13 @@ TEST(IrcProtocolWithServer, 338) RECV(":server 338 alice bob"); CHECK_ERROR_PARAMS("338", 2, 3); - RECV(":server 338 alice bob hostname : actually using host "); - CHECK_SRV("--", "[bob] actually using host hostname", + RECV(":server 338 alice bob host_\00304red : \002actually using host "); + CHECK_SRV("--", "[bob] actually using host host_red", "irc_338,irc_numeric,nick_server,log3"); /* on Rizon server */ - RECV(":server 338 alice bob :is actually bob@example.com [1.2.3.4]"); - CHECK_SRV("--", "[bob] is actually bob@example.com [1.2.3.4]", + RECV(":server 338 alice bob :\002is actually bob_\00304red@example_\00304red.com [1.2.3.4]"); + CHECK_SRV("--", "[bob] is actually bob_red@example_red.com [1.2.3.4]", "irc_338,irc_numeric,nick_server,log3"); } @@ -4755,12 +4777,12 @@ TEST(IrcProtocolWithServer, 344) "irc_344,irc_numeric,nick_server,log3"); /* whois, geo info (UnrealIRCd) */ - RECV(":server 344 alice bob FR : is connecting from France "); + RECV(":server 344 alice bob FR : \002is connecting from France "); CHECK_SRV("--", "[bob] is connecting from France (FR)", "irc_344,irc_numeric,nick_server,log3"); /* whois, geo info (UnrealIRCd), no country code */ - RECV(":server 344 alice bob : is connecting from France "); + RECV(":server 344 alice bob : \002is connecting from France "); CHECK_SRV("--", "[bob] is connecting from France ", "irc_344,irc_numeric,nick_server,log3"); } @@ -4784,14 +4806,14 @@ TEST(IrcProtocolWithServer, 345) RECV(":server 345 alice #test end"); CHECK_SRV("--", "#test: end", "irc_345,irc_numeric,nick_server,log3"); - RECV(":server 345 alice #test : End of Channel Reop List "); + RECV(":server 345 alice #test : \002End of Channel Reop List "); CHECK_SRV("--", "#test: End of Channel Reop List ", "irc_345,irc_numeric,nick_server,log3"); /* channel not found */ RECV(":server 345 alice #xyz end"); CHECK_SRV("--", "#xyz: end", "irc_345,irc_numeric,nick_server,log3"); - RECV(":server 345 alice #xyz :End of Channel Reop List"); + RECV(":server 345 alice #xyz :\002End of Channel Reop List"); CHECK_SRV("--", "#xyz: End of Channel Reop List", "irc_345,irc_numeric,nick_server,log3"); } @@ -4816,12 +4838,12 @@ TEST(IrcProtocolWithServer, 346) RECV(":server 346 alice #test invitemask"); CHECK_CHAN("--", "[#test] [1] invitemask invited", "irc_346,irc_numeric,nick_server,log3"); - RECV(":server 346 alice #test invitemask nick!user@host"); - CHECK_CHAN("--", "[#test] [2] invitemask invited by nick (user@host)", + RECV(":server 346 alice #test invitemask nick!user_\00304red@host_\00304red"); + CHECK_CHAN("--", "[#test] [2] invitemask invited by nick (user_red@host_red)", "irc_346,irc_numeric,nick_server,log3"); - RECV(":server 346 alice #test invitemask nick!user@host 1205590879 "); + RECV(":server 346 alice #test invitemask nick!user_\00304red@host_\00304red 1205590879 "); CHECK_CHAN("--", - "[#test] [3] invitemask invited by nick (user@host) " + "[#test] [3] invitemask invited by nick (user_red@host_red) " "on Sat, 15 Mar 2008 14:21:19", "irc_346,irc_numeric,nick_server,log3"); @@ -4829,12 +4851,12 @@ TEST(IrcProtocolWithServer, 346) RECV(":server 346 alice #xyz invitemask"); CHECK_SRV("--", "[#xyz] invitemask invited", "irc_346,irc_numeric,nick_server,log3"); - RECV(":server 346 alice #xyz invitemask nick!user@host"); - CHECK_SRV("--", "[#xyz] invitemask invited by nick (user@host)", + RECV(":server 346 alice #xyz invitemask nick!user_\00304red@host_\00304red"); + CHECK_SRV("--", "[#xyz] invitemask invited by nick (user_red@host_red)", "irc_346,irc_numeric,nick_server,log3"); - RECV(":server 346 alice #xyz invitemask nick!user@host 1205590879"); + RECV(":server 346 alice #xyz invitemask nick!user_\00304red@host_\00304red 1205590879"); CHECK_SRV("--", - "[#xyz] invitemask invited by nick (user@host) " + "[#xyz] invitemask invited by nick (user_red@host_red) " "on Sat, 15 Mar 2008 14:21:19", "irc_346,irc_numeric,nick_server,log3"); } @@ -4858,7 +4880,7 @@ TEST(IrcProtocolWithServer, 347) CHECK_CHAN("--", "[#test]", "irc_347,irc_numeric,nick_server,log3"); RECV(":server 347 alice #test end"); CHECK_CHAN("--", "[#test] end", "irc_347,irc_numeric,nick_server,log3"); - RECV(":server 347 alice #test : End of Channel Invite List "); + RECV(":server 347 alice #test : \002End of Channel Invite List "); CHECK_CHAN("--", "[#test] End of Channel Invite List ", "irc_347,irc_numeric,nick_server,log3"); @@ -4867,7 +4889,7 @@ TEST(IrcProtocolWithServer, 347) CHECK_SRV("--", "[#xyz]", "irc_347,irc_numeric,nick_server,log3"); RECV(":server 347 alice #xyz end"); CHECK_SRV("--", "[#xyz] end", "irc_347,irc_numeric,nick_server,log3"); - RECV(":server 347 alice #xyz :End of Channel Invite List"); + RECV(":server 347 alice #xyz :\002End of Channel Invite List"); CHECK_SRV("--", "[#xyz] End of Channel Invite List", "irc_347,irc_numeric,nick_server,log3"); } @@ -4892,32 +4914,34 @@ TEST(IrcProtocolWithServer, 348) RECV(":server 348 alice #test nick1!user1@host1"); CHECK_CHAN("--", "[#test] [1] exception nick1!user1@host1", "irc_348,irc_numeric,nick_server,log3"); - RECV(":server 348 alice #test nick1!user1@host1 nick2!user2@host2"); + RECV(":server 348 alice #test nick1!user_\00304red@host_\00304red " + "nick2!user_\00302blue@host_\00302blue"); CHECK_CHAN("--", - "[#test] [2] exception nick1!user1@host1 " - "by nick2 (user2@host2)", + "[#test] [2] exception nick1!user_red@host_red " + "by nick2 (user_blue@host_blue)", "irc_348,irc_numeric,nick_server,log3"); - RECV(":server 348 alice #test nick1!user1@host1 nick2!user2@host2 " - "1205585109 "); + RECV(":server 348 alice #test nick1!user_\00304red@host_\00304red " + "nick2!user_\00302blue@host_\00302blue 1205585109 "); CHECK_CHAN("--", - "[#test] [3] exception nick1!user1@host1 " - "by nick2 (user2@host2) on Sat, 15 Mar 2008 12:45:09", + "[#test] [3] exception nick1!user_red@host_red " + "by nick2 (user_blue@host_blue) on Sat, 15 Mar 2008 12:45:09", "irc_348,irc_numeric,nick_server,log3"); /* channel not found */ - RECV(":server 348 alice #xyz nick1!user1@host1"); - CHECK_SRV("--", "[#xyz] exception nick1!user1@host1", + RECV(":server 348 alice #xyz nick1!user_\00304red@host_\00304red"); + CHECK_SRV("--", "[#xyz] exception nick1!user_red@host_red", "irc_348,irc_numeric,nick_server,log3"); - RECV(":server 348 alice #xyz nick1!user1@host1 nick2!user2@host2"); + RECV(":server 348 alice #xyz nick1!user_\00304red@host_\00304red " + "nick2!user_\00302blue@host_\00302blue"); CHECK_SRV("--", - "[#xyz] exception nick1!user1@host1 " - "by nick2 (user2@host2)", + "[#xyz] exception nick1!user_red@host_red " + "by nick2 (user_blue@host_blue)", "irc_348,irc_numeric,nick_server,log3"); - RECV(":server 348 alice #xyz nick1!user1@host1 nick2!user2@host2 " - "1205585109"); + RECV(":server 348 alice #xyz nick1!user_\00304red@host_\00304red " + "nick2!user_\00302blue@host_\00302blue 1205585109"); CHECK_SRV("--", - "[#xyz] exception nick1!user1@host1 " - "by nick2 (user2@host2) on Sat, 15 Mar 2008 12:45:09", + "[#xyz] exception nick1!user_red@host_red " + "by nick2 (user_blue@host_blue) on Sat, 15 Mar 2008 12:45:09", "irc_348,irc_numeric,nick_server,log3"); } @@ -4940,7 +4964,7 @@ TEST(IrcProtocolWithServer, 349) CHECK_CHAN("--", "[#test]", "irc_349,irc_numeric,nick_server,log3"); RECV(":server 349 alice #test end"); CHECK_CHAN("--", "[#test] end", "irc_349,irc_numeric,nick_server,log3"); - RECV(":server 349 alice #test :End of Channel Exception List "); + RECV(":server 349 alice #test :\002End of Channel Exception List "); CHECK_CHAN("--", "[#test] End of Channel Exception List ", "irc_349,irc_numeric,nick_server,log3"); @@ -4949,7 +4973,7 @@ TEST(IrcProtocolWithServer, 349) CHECK_SRV("--", "[#xyz]", "irc_349,irc_numeric,nick_server,log3"); RECV(":server 349 alice #xyz end"); CHECK_SRV("--", "[#xyz] end", "irc_349,irc_numeric,nick_server,log3"); - RECV(":server 349 alice #xyz :End of Channel Exception List"); + RECV(":server 349 alice #xyz :\002End of Channel Exception List"); CHECK_SRV("--", "[#xyz] End of Channel Exception List", "irc_349,irc_numeric,nick_server,log3"); } @@ -4970,7 +4994,7 @@ TEST(IrcProtocolWithServer, 350) CHECK_ERROR_PARAMS("350", 1, 2); /* non-standard parameters (using whois_nick_msg callback) */ - RECV(":server 350 alice bob : something here "); + RECV(":server 350 alice bob : \002something here "); CHECK_SRV("--", "[bob] something here ", "irc_350,irc_numeric,nick_server,log3"); RECV(":server 350 alice bob * : something here "); @@ -4982,7 +5006,7 @@ TEST(IrcProtocolWithServer, 350) CHECK_SRV("--", "bob", "irc_350,irc_numeric,nick_server,log3"); /* standard parameters */ - RECV(":server 350 alice bob * * : is connected via the WebIRC gateway "); + RECV(":server 350 alice bob * * : \002is connected via the WebIRC gateway "); CHECK_SRV("--", "[bob] is connected via the WebIRC gateway ", "irc_350,irc_numeric,nick_server,log3"); RECV(":server 350 alice bob example.com * :is connected via the WebIRC gateway"); @@ -5017,7 +5041,7 @@ TEST(IrcProtocolWithServer, 351) RECV(":server 351 alice dancer-ircd-1.0 server"); CHECK_SRV("--", "dancer-ircd-1.0 server", "irc_351,irc_numeric,nick_server,log3"); - RECV(":server 351 alice dancer-ircd-1.0 server : iMZ dncrTS/v4 "); + RECV(":server 351 alice dancer-ircd-1.0 server : iMZ \002dncrTS/v4 "); CHECK_SRV("--", "dancer-ircd-1.0 server ( iMZ dncrTS/v4 )", "irc_351,irc_numeric,nick_server,log3"); } @@ -5059,10 +5083,10 @@ TEST(IrcProtocolWithServer, 352) STRCMP_EQUAL(NULL, ptr_nick->realname); STRCMP_EQUAL(NULL, ptr_nick2->realname); - RECV(":server 352 alice #test user2 host2 server bob"); - CHECK_SRV("--", "[#test] bob (user2@host2) ()", + RECV(":server 352 alice #test user_\00304red host_\00304red server bob"); + CHECK_SRV("--", "[#test] bob (user_red@host_red) ()", "irc_352,irc_numeric,nick_server,log3"); - STRCMP_EQUAL("user2@host2", ptr_nick2->host); + STRCMP_EQUAL("user_\00304red@host_\00304red", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); STRCMP_EQUAL(NULL, ptr_nick2->realname); @@ -5073,12 +5097,12 @@ TEST(IrcProtocolWithServer, 352) LONGS_EQUAL(0, ptr_nick2->away); STRCMP_EQUAL(NULL, ptr_nick2->realname); - RECV(":server 352 alice #test user4 host4 server bob * :0 real name 1 "); + RECV(":server 352 alice #test user4 host4 server bob * :0 \002real name 1 "); CHECK_SRV("--", "[#test] bob (user4@host4) * 0 (real name 1 )", "irc_352,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user4@host4", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - STRCMP_EQUAL("real name 1 ", ptr_nick2->realname); + STRCMP_EQUAL("\002real name 1 ", ptr_nick2->realname); RECV(":server 352 alice #test user5 host5 server bob H@ :0 real name 2"); CHECK_SRV("--", "[#test] bob (user5@host5) H@ 0 (real name 2)", @@ -5101,19 +5125,19 @@ TEST(IrcProtocolWithServer, 352) LONGS_EQUAL(1, ptr_nick2->away); STRCMP_EQUAL("real name 4", ptr_nick2->realname); - RECV(":server 352 alice #test user8 host8 server bob H@ :0 real name 5"); - CHECK_SRV("--", "[#test] bob (user8@host8) H@ 0 (real name 5)", + RECV(":server 352 alice #test user_\00304red host_\00304red server bob H@ :0 real name \00302blue"); + CHECK_SRV("--", "[#test] bob (user_red@host_red) H@ 0 (real name blue)", "irc_352,irc_numeric,nick_server,log3"); - STRCMP_EQUAL("user8@host8", ptr_nick2->host); + STRCMP_EQUAL("user_\00304red@host_\00304red", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - STRCMP_EQUAL("real name 5", ptr_nick2->realname); + STRCMP_EQUAL("real name \00302blue", ptr_nick2->realname); RECV(":server 352 alice #test user8 host8 server bob H@ :0"); CHECK_SRV("--", "[#test] bob (user8@host8) H@ 0 ()", "irc_352,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user8@host8", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - STRCMP_EQUAL("real name 5", ptr_nick2->realname); + STRCMP_EQUAL("real name \00302blue", ptr_nick2->realname); /* nothing should have changed in the first nick */ STRCMP_EQUAL("user_a@host_a", ptr_nick->host); @@ -5179,7 +5203,7 @@ TEST(IrcProtocolWithServer, 353) STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name); POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick->next_nick); - RECV(":server 353 alice #test :alice bob @carol +dan!user@host "); + RECV(":server 353 alice #test :alice bob @carol +dan!user_\00304red@host_\00304red "); CHECK_NO_MSG; STRCMP_EQUAL("alice", ptr_channel->nicks->name); STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name); @@ -5189,7 +5213,7 @@ TEST(IrcProtocolWithServer, 353) ptr_channel->nicks->next_nick->next_nick->next_nick->name); STRCMP_EQUAL("+", ptr_channel->nicks->next_nick->next_nick->next_nick->prefix); - STRCMP_EQUAL("user@host", + STRCMP_EQUAL("user_\00304red@host_\00304red", ptr_channel->nicks->next_nick->next_nick->next_nick->host); POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick->next_nick->next_nick->next_nick); @@ -5204,12 +5228,12 @@ TEST(IrcProtocolWithServer, 353) ptr_channel->nicks->next_nick->next_nick->next_nick->name); STRCMP_EQUAL("+", ptr_channel->nicks->next_nick->next_nick->next_nick->prefix); - STRCMP_EQUAL("user@host", + STRCMP_EQUAL("user_\00304red@host_\00304red", ptr_channel->nicks->next_nick->next_nick->next_nick->host); POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick->next_nick->next_nick->next_nick); - RECV(":server 353 alice = #test :alice bob @carol +dan!user@host"); + RECV(":server 353 alice = #test :alice bob @carol +dan!user_\00304red@host_\00304red"); CHECK_NO_MSG; STRCMP_EQUAL("alice", ptr_channel->nicks->name); STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name); @@ -5219,7 +5243,7 @@ TEST(IrcProtocolWithServer, 353) ptr_channel->nicks->next_nick->next_nick->next_nick->name); STRCMP_EQUAL("+", ptr_channel->nicks->next_nick->next_nick->next_nick->prefix); - STRCMP_EQUAL("user@host", + STRCMP_EQUAL("user_\00304red@host_\00304red", ptr_channel->nicks->next_nick->next_nick->next_nick->host); POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick->next_nick->next_nick->next_nick); @@ -5339,22 +5363,22 @@ TEST(IrcProtocolWithServer, 354) STRCMP_EQUAL(NULL, ptr_nick2->account); STRCMP_EQUAL(NULL, ptr_nick2->realname); - RECV(":server 354 alice #test user2 host2 server bob * 0 account2"); + RECV(":server 354 alice #test user2 host2 server bob * 0 \002account2"); CHECK_SRV("--", "[#test] bob [account2] (user2@host2) * 0 ()", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user2@host2", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - STRCMP_EQUAL("account2", ptr_nick2->account); + STRCMP_EQUAL("\002account2", ptr_nick2->account); STRCMP_EQUAL(NULL, ptr_nick2->realname); - RECV(":server 354 alice #test user3 host3 server bob * 0 account3 " - ": real name 2 "); + RECV(":server 354 alice #test user3 host3 server bob * 0 \002account3 " + ": \002real name 2 "); CHECK_SRV("--", "[#test] bob [account3] (user3@host3) * 0 ( real name 2 )", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user3@host3", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - STRCMP_EQUAL("account3", ptr_nick2->account); - STRCMP_EQUAL(" real name 2 ", ptr_nick2->realname); + STRCMP_EQUAL("\002account3", ptr_nick2->account); + STRCMP_EQUAL(" \002real name 2 ", ptr_nick2->realname); RECV(":server 354 alice #test user4 host4 server bob H@ 0 account4 " ":real name 3"); @@ -5386,15 +5410,16 @@ TEST(IrcProtocolWithServer, 354) STRCMP_EQUAL("account6", ptr_nick2->account); STRCMP_EQUAL("real name 5", ptr_nick2->realname); - RECV(":server 354 alice #test user7 host7 server bob H@ 0 account7 " - ":real name 6"); + RECV(":server 354 alice #test user_\00304red host_\00304red server bob " + "H@ 0 account_\00304red :real name \00302blue"); CHECK_SRV("--", - "[#test] bob [account7] (user7@host7) H@ 0 (real name 6)", + "[#test] bob [account_red] (user_red@host_red) H@ 0 " + "(real name blue)", "irc_354,irc_numeric,nick_server,log3"); - STRCMP_EQUAL("user7@host7", ptr_nick2->host); + STRCMP_EQUAL("user_\00304red@host_\00304red", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - STRCMP_EQUAL("account7", ptr_nick2->account); - STRCMP_EQUAL("real name 6", ptr_nick2->realname); + STRCMP_EQUAL("account_\00304red", ptr_nick2->account); + STRCMP_EQUAL("real name \00302blue", ptr_nick2->realname); /* nothing should have changed in the first nick */ STRCMP_EQUAL("user_a@host_a", ptr_nick->host); @@ -5454,7 +5479,7 @@ TEST(IrcProtocolWithServer, 366) RECV(":server 366 alice #test end"); CHECK_CHAN("--", "Channel #test: 1 nick (0 ops, 0 voiced, 1 regular)", "irc_366,irc_numeric,nick_server,log3"); - RECV(":server 366 alice #test : End of /NAMES list "); + RECV(":server 366 alice #test : \002End of /NAMES list "); CHECK_CHAN("--", "Channel #test: 1 nick (0 ops, 0 voiced, 1 regular)", "irc_366,irc_numeric,nick_server,log3"); @@ -5620,7 +5645,7 @@ TEST(IrcProtocolWithServer, 368) CHECK_CHAN("--", "[#test]", "irc_368,irc_numeric,nick_server,log3"); RECV(":server 368 alice #test end"); CHECK_CHAN("--", "[#test] end", "irc_368,irc_numeric,nick_server,log3"); - RECV(":server 368 alice #test : End of Channel Ban List "); + RECV(":server 368 alice #test : \002End of Channel Ban List "); CHECK_CHAN("--", "[#test] End of Channel Ban List ", "irc_368,irc_numeric,nick_server,log3"); @@ -5629,7 +5654,7 @@ TEST(IrcProtocolWithServer, 368) CHECK_SRV("--", "[#xyz]", "irc_368,irc_numeric,nick_server,log3"); RECV(":server 368 alice #xyz end"); CHECK_SRV("--", "[#xyz] end", "irc_368,irc_numeric,nick_server,log3"); - RECV(":server 368 alice #xyz :End of Channel Ban List"); + RECV(":server 368 alice #xyz :\002End of Channel Ban List"); CHECK_SRV("--", "[#xyz] End of Channel Ban List", "irc_368,irc_numeric,nick_server,log3"); } @@ -5651,11 +5676,11 @@ TEST(IrcProtocolWithServer, 401) RECV(":server 401 alice bob"); CHECK_SRV("--", "bob", "irc_401,irc_numeric,nick_server,log3"); - RECV(":server 401 alice bob : No such nick/channel "); + RECV(":server 401 alice bob : \002No such nick/channel "); CHECK_SRV("--", "bob: No such nick/channel ", "irc_401,irc_numeric,nick_server,log3"); - RECV(":server 401 alice #unknown :No such nick/channel"); + RECV(":server 401 alice #unknown :\002No such nick/channel"); CHECK_SRV("--", "#unknown: No such nick/channel", "irc_401,irc_numeric,nick_server,log3"); } @@ -5677,7 +5702,7 @@ TEST(IrcProtocolWithServer, 402) RECV(":server 402 alice server"); CHECK_SRV("--", "server", "irc_402,irc_numeric,nick_server,log3"); - RECV(":server 402 alice server : No such server "); + RECV(":server 402 alice server : \002No such server "); CHECK_SRV("--", "server: No such server ", "irc_402,irc_numeric,nick_server,log3"); } @@ -5699,7 +5724,7 @@ TEST(IrcProtocolWithServer, 403) RECV(":server 403 alice #test2"); CHECK_SRV("--", "#test2", "irc_403,irc_numeric,nick_server,log3"); - RECV(":server 403 alice #test2 : No such channel "); + RECV(":server 403 alice #test2 : \002No such channel "); CHECK_SRV("--", "#test2: No such channel ", "irc_403,irc_numeric,nick_server,log3"); } @@ -5721,10 +5746,10 @@ TEST(IrcProtocolWithServer, 404) RECV(":server 404 alice #test"); CHECK_SRV("--", "#test", "irc_404,irc_numeric,nick_server,log3"); - RECV(":server 404 alice #test : Cannot send to channel "); + RECV(":server 404 alice #test : \002Cannot send to channel "); CHECK_CHAN("--", "#test: Cannot send to channel ", "irc_404,irc_numeric,nick_server,log3"); - RECV(":server 404 alice #test2 :Cannot send to channel"); + RECV(":server 404 alice #test2 :\002Cannot send to channel"); CHECK_SRV("--", "#test2: Cannot send to channel", "irc_404,irc_numeric,nick_server,log3"); } @@ -5746,7 +5771,7 @@ TEST(IrcProtocolWithServer, 405) RECV(":server 405 alice #test2"); CHECK_SRV("--", "#test2", "irc_405,irc_numeric,nick_server,log3"); - RECV(":server 405 alice #test2 : You have joined too many channels "); + RECV(":server 405 alice #test2 : \002You have joined too many channels "); CHECK_SRV("--", "#test2: You have joined too many channels ", "irc_405,irc_numeric,nick_server,log3"); } @@ -5768,7 +5793,7 @@ TEST(IrcProtocolWithServer, 406) RECV(":server 406 alice bob"); CHECK_SRV("--", "bob", "irc_406,irc_numeric,nick_server,log3"); - RECV(":server 406 alice bob : There was no such nick "); + RECV(":server 406 alice bob : \002There was no such nick "); CHECK_SRV("--", "bob: There was no such nick ", "irc_406,irc_numeric,nick_server,log3"); } @@ -5790,7 +5815,7 @@ TEST(IrcProtocolWithServer, 407) RECV(":server 407 alice bob@host"); CHECK_SRV("--", "bob@host", "irc_407,irc_numeric,nick_server,log3"); - RECV(":server 407 alice bob@host : Duplicate recipients. No message delivered "); + RECV(":server 407 alice bob@host : \002Duplicate recipients. No message delivered "); CHECK_SRV("--", "bob@host: Duplicate recipients. No message delivered ", "irc_407,irc_numeric,nick_server,log3"); } @@ -5810,7 +5835,7 @@ TEST(IrcProtocolWithServer, 409) RECV(":server 409 alice"); CHECK_ERROR_PARAMS("409", 1, 2); - RECV(":server 409 alice : No origin specified "); + RECV(":server 409 alice : \002No origin specified "); CHECK_SRV("--", " No origin specified ", "irc_409,irc_numeric,nick_server,log3"); } @@ -5830,7 +5855,7 @@ TEST(IrcProtocolWithServer, 411) RECV(":server 411 alice"); CHECK_ERROR_PARAMS("411", 1, 2); - RECV(":server 411 alice : No recipient given (PRIVMSG) "); + RECV(":server 411 alice : \002No recipient given (PRIVMSG) "); CHECK_SRV("--", " No recipient given (PRIVMSG) ", "irc_411,irc_numeric,nick_server,log3"); } @@ -5850,7 +5875,7 @@ TEST(IrcProtocolWithServer, 412) RECV(":server 412 alice"); CHECK_ERROR_PARAMS("412", 1, 2); - RECV(":server 412 alice : No text to send "); + RECV(":server 412 alice : \002No text to send "); CHECK_SRV("--", " No text to send ", "irc_412,irc_numeric,nick_server,log3"); } @@ -5872,7 +5897,7 @@ TEST(IrcProtocolWithServer, 413) RECV(":server 413 alice mask"); CHECK_SRV("--", "mask", "irc_413,irc_numeric,nick_server,log3"); - RECV(":server 413 alice mask : No toplevel domain specified "); + RECV(":server 413 alice mask : \002No toplevel domain specified "); CHECK_SRV("--", "mask: No toplevel domain specified ", "irc_413,irc_numeric,nick_server,log3"); } @@ -5894,7 +5919,7 @@ TEST(IrcProtocolWithServer, 414) RECV(":server 414 alice mask"); CHECK_SRV("--", "mask", "irc_414,irc_numeric,nick_server,log3"); - RECV(":server 414 alice mask : Wildcard in toplevel domain "); + RECV(":server 414 alice mask : \002Wildcard in toplevel domain "); CHECK_SRV("--", "mask: Wildcard in toplevel domain ", "irc_414,irc_numeric,nick_server,log3"); } @@ -5916,10 +5941,10 @@ TEST(IrcProtocolWithServer, 415) RECV(":server 415 alice #test"); CHECK_SRV("--", "#test", "irc_415,irc_numeric,nick_server,log3"); - RECV(":server 415 alice #test : Cannot send message to channel (+R) "); + RECV(":server 415 alice #test : \002Cannot send message to channel (+R) "); CHECK_CHAN("--", "#test: Cannot send message to channel (+R) ", "irc_415,irc_numeric,nick_server,log3"); - RECV(":server 415 alice #test2 :Cannot send message to channel (+R)"); + RECV(":server 415 alice #test2 :\002Cannot send message to channel (+R)"); CHECK_SRV("--", "#test2: Cannot send message to channel (+R)", "irc_415,irc_numeric,nick_server,log3"); } @@ -5941,7 +5966,7 @@ TEST(IrcProtocolWithServer, 421) RECV(":server 421 alice UNKNOWN"); CHECK_SRV("--", "UNKNOWN", "irc_421,irc_numeric,nick_server,log3"); - RECV(":server 421 alice UNKNOWN : Unknown command "); + RECV(":server 421 alice UNKNOWN : \002Unknown command "); CHECK_SRV("--", "UNKNOWN: Unknown command ", "irc_421,irc_numeric,nick_server,log3"); } @@ -5961,7 +5986,7 @@ TEST(IrcProtocolWithServer, 422) RECV(":server 422 alice"); CHECK_ERROR_PARAMS("422", 1, 2); - RECV(":server 422 alice : MOTD file is missing "); + RECV(":server 422 alice : \002MOTD file is missing "); CHECK_SRV("--", " MOTD file is missing ", "irc_422,irc_numeric,nick_server,log3"); } @@ -5983,7 +6008,7 @@ TEST(IrcProtocolWithServer, 423) RECV(":server 423 alice server"); CHECK_SRV("--", "server", "irc_423,irc_numeric,nick_server,log3"); - RECV(":server 423 alice server : No administrative info available "); + RECV(":server 423 alice server : \002No administrative info available "); CHECK_SRV("--", "server: No administrative info available ", "irc_423,irc_numeric,nick_server,log3"); } @@ -6003,7 +6028,7 @@ TEST(IrcProtocolWithServer, 424) RECV(":server 424 alice"); CHECK_ERROR_PARAMS("424", 1, 2); - RECV(":server 424 alice : File error doing read on /path/to/file "); + RECV(":server 424 alice : \002File error doing read on /path/to/file "); CHECK_SRV("--", " File error doing read on /path/to/file ", "irc_424,irc_numeric,nick_server,log3"); } @@ -6023,7 +6048,7 @@ TEST(IrcProtocolWithServer, 431) RECV(":server 431 alice"); CHECK_ERROR_PARAMS("431", 1, 2); - RECV(":server 431 alice : No nickname given "); + RECV(":server 431 alice : \002No nickname given "); CHECK_SRV("--", " No nickname given ", "irc_431,irc_numeric,nick_server,log3"); } @@ -6047,13 +6072,13 @@ TEST(IrcProtocolWithServer, 432_not_connected) "irc: nickname \"nick2\" is invalid, trying nickname \"nick3\"", ""); - RECV(":server 432 * alice : Erroneous Nickname "); + RECV(":server 432 * alice : \002Erroneous Nickname "); CHECK_SRV("--", "* alice Erroneous Nickname ", ""); CHECK_SRV("=!=", "irc: nickname \"nick3\" is invalid, trying nickname \"nick1_\"", ""); - RECV(":server 432 * alice1 :Erroneous Nickname"); + RECV(":server 432 * alice1 :\002Erroneous Nickname"); CHECK_SRV("--", "* alice1 Erroneous Nickname", ""); CHECK_SRV("=!=", "irc: nickname \"nick1_\" is invalid, " @@ -6080,7 +6105,7 @@ TEST(IrcProtocolWithServer, 432_connected) CHECK_SRV("--", "test%+", "irc_432,irc_numeric,nick_server,log3"); RECV(":server 432 alice test%+ error"); CHECK_SRV("--", "test%+: error", "irc_432,irc_numeric,nick_server,log3"); - RECV(":server 432 alice test%+ : Erroneous Nickname "); + RECV(":server 432 alice test%+ : \002Erroneous Nickname "); CHECK_SRV("--", "test%+: Erroneous Nickname ", "irc_432,irc_numeric,nick_server,log3"); @@ -6088,7 +6113,7 @@ TEST(IrcProtocolWithServer, 432_connected) * special case: erroneous nick is a channel: check that the message is * still displayed on the server buffer */ - RECV(":server 432 alice #test : Erroneous Nickname "); + RECV(":server 432 alice #test : \002Erroneous Nickname "); CHECK_SRV("--", "#test: Erroneous Nickname ", "irc_432,irc_numeric,nick_server,log3"); } @@ -6138,7 +6163,7 @@ TEST(IrcProtocolWithServer, 433_connected) CHECK_SRV("--", "test", "irc_433,irc_numeric,nick_server,log3"); RECV(":server 433 alice test error"); CHECK_SRV("--", "test: error", "irc_433,irc_numeric,nick_server,log3"); - RECV(":server 433 alice test : Nickname is already in use. "); + RECV(":server 433 alice test : \002Nickname is already in use. "); CHECK_SRV("--", "test: Nickname is already in use. ", "irc_433,irc_numeric,nick_server,log3"); @@ -6147,7 +6172,7 @@ TEST(IrcProtocolWithServer, 433_connected) * never happen in practice): check that the message is still displayed * on the server buffer */ - RECV(":server 433 alice #test : Nickname is already in use. "); + RECV(":server 433 alice #test : \002Nickname is already in use. "); CHECK_SRV("--", "#test: Nickname is already in use. ", "irc_433,irc_numeric,nick_server,log3"); } @@ -6171,7 +6196,7 @@ TEST(IrcProtocolWithServer, 436) CHECK_SRV("--", "bob", "irc_436,irc_numeric,nick_server,log3"); RECV(":server 436 alice bob error"); CHECK_SRV("--", "bob: error", "irc_436,irc_numeric,nick_server,log3"); - RECV(":server 436 alice bob : Nickname collision KILL "); + RECV(":server 436 alice bob : \002Nickname collision KILL "); CHECK_SRV("--", "bob: Nickname collision KILL ", "irc_436,irc_numeric,nick_server,log3"); } @@ -6185,10 +6210,10 @@ TEST(IrcProtocolWithServer, 437_not_connected) { RECV(":server 437 * alice error"); CHECK_SRV("--", "* alice error", "irc_437,irc_numeric,nick_server,log3"); - RECV(":server 437 * alice : Nick/channel is temporarily unavailable "); + RECV(":server 437 * alice : \002Nick/channel is temporarily unavailable "); CHECK_SRV("--", "* alice Nick/channel is temporarily unavailable ", "irc_437,irc_numeric,nick_server,log3"); - RECV(":server 437 * alice1 :Nick/channel is temporarily unavailable"); + RECV(":server 437 * alice1 :\002Nick/channel is temporarily unavailable"); CHECK_SRV("--", "* alice1 Nick/channel is temporarily unavailable", "irc_437,irc_numeric,nick_server,log3"); } @@ -6212,10 +6237,10 @@ TEST(IrcProtocolWithServer, 437_connected) CHECK_SRV("--", "* alice", "irc_437,irc_numeric,nick_server,log3"); RECV(":server 437 * alice error"); CHECK_SRV("--", "* alice error", "irc_437,irc_numeric,nick_server,log3"); - RECV(":server 437 * alice : Nick/channel is temporarily unavailable "); + RECV(":server 437 * alice : \002Nick/channel is temporarily unavailable "); CHECK_SRV("--", "* alice Nick/channel is temporarily unavailable ", "irc_437,irc_numeric,nick_server,log3"); - RECV(":server 437 alice #test :Cannot change nickname while banned on channel"); + RECV(":server 437 alice #test :\002Cannot change nickname while banned on channel"); CHECK_SRV("--", "#test: Cannot change nickname while banned on channel", "irc_437,irc_numeric,nick_server,log3"); } @@ -6240,7 +6265,7 @@ TEST(IrcProtocolWithServer, 438) RECV(":server 438 alice alice2 error"); CHECK_SRV("--", "error (alice => alice2)", "irc_438,irc_numeric,nick_server,log3"); - RECV(":server 438 alice alice2 : Nick change too fast. " + RECV(":server 438 alice alice2 : \002Nick change too fast. " "Please wait 30 seconds. "); CHECK_SRV("--", " Nick change too fast. Please wait 30 seconds. (alice => alice2)", @@ -6266,7 +6291,7 @@ TEST(IrcProtocolWithServer, 441) CHECK_SRV("--", "bob", "irc_441,irc_numeric,nick_server,log3"); RECV(":server 441 alice bob #test2"); CHECK_SRV("--", "bob: #test2", "irc_441,irc_numeric,nick_server,log3"); - RECV(":server 441 alice bob #test2 : They aren't on that channel "); + RECV(":server 441 alice bob #test2 : \002They aren't on that channel "); CHECK_SRV("--", "bob: #test2 They aren't on that channel ", "irc_441,irc_numeric,nick_server,log3"); } @@ -6288,7 +6313,7 @@ TEST(IrcProtocolWithServer, 442) RECV(":server 442 alice #test2"); CHECK_SRV("--", "#test2", "irc_442,irc_numeric,nick_server,log3"); - RECV(":server 442 alice #test2 : You're not on that channel "); + RECV(":server 442 alice #test2 : \002You're not on that channel "); CHECK_SRV("--", "#test2: You're not on that channel ", "irc_442,irc_numeric,nick_server,log3"); } @@ -6312,7 +6337,7 @@ TEST(IrcProtocolWithServer, 443) CHECK_SRV("--", "bob", "irc_443,irc_numeric,nick_server,log3"); RECV(":server 443 alice bob #test2"); CHECK_SRV("--", "bob: #test2", "irc_443,irc_numeric,nick_server,log3"); - RECV(":server 443 alice bob #test2 : is already on channel "); + RECV(":server 443 alice bob #test2 : \002is already on channel "); CHECK_SRV("--", "bob: #test2 is already on channel ", "irc_443,irc_numeric,nick_server,log3"); } @@ -6336,7 +6361,7 @@ TEST(IrcProtocolWithServer, 444) CHECK_SRV("--", "bob", "irc_444,irc_numeric,nick_server,log3"); RECV(":server 444 alice bob error"); CHECK_SRV("--", "bob: error", "irc_444,irc_numeric,nick_server,log3"); - RECV(":server 444 alice bob : User not logged in "); + RECV(":server 444 alice bob : \002User not logged in "); CHECK_SRV("--", "bob: User not logged in ", "irc_444,irc_numeric,nick_server,log3"); } @@ -6356,7 +6381,7 @@ TEST(IrcProtocolWithServer, 445) RECV(":server 445 alice"); CHECK_ERROR_PARAMS("445", 1, 2); - RECV(":server 445 alice : SUMMON has been disabled "); + RECV(":server 445 alice : \002SUMMON has been disabled "); CHECK_SRV("--", " SUMMON has been disabled ", "irc_445,irc_numeric,nick_server,log3"); } @@ -6376,7 +6401,7 @@ TEST(IrcProtocolWithServer, 446) RECV(":server 446 alice"); CHECK_ERROR_PARAMS("446", 1, 2); - RECV(":server 446 alice : USERS has been disabled "); + RECV(":server 446 alice : \002USERS has been disabled "); CHECK_SRV("--", " USERS has been disabled ", "irc_446,irc_numeric,nick_server,log3"); } @@ -6396,7 +6421,7 @@ TEST(IrcProtocolWithServer, 451) RECV(":server 451 alice"); CHECK_ERROR_PARAMS("451", 1, 2); - RECV(":server 451 alice : You have not registered "); + RECV(":server 451 alice : \002You have not registered "); CHECK_SRV("--", " You have not registered ", "irc_451,irc_numeric,nick_server,log3"); } @@ -6418,7 +6443,7 @@ TEST(IrcProtocolWithServer, 461) RECV(":server 461 alice PRIVMSG"); CHECK_SRV("--", "PRIVMSG", "irc_461,irc_numeric,nick_server,log3"); - RECV(":server 461 alice PRIVMSG : Not enough parameters "); + RECV(":server 461 alice PRIVMSG : \002Not enough parameters "); CHECK_SRV("--", "PRIVMSG: Not enough parameters ", "irc_461,irc_numeric,nick_server,log3"); } @@ -6438,7 +6463,7 @@ TEST(IrcProtocolWithServer, 462) RECV(":server 462 alice"); CHECK_ERROR_PARAMS("462", 1, 2); - RECV(":server 462 alice : You may not reregister "); + RECV(":server 462 alice : \002You may not reregister "); CHECK_SRV("--", " You may not reregister ", "irc_462,irc_numeric,nick_server,log3"); } @@ -6458,7 +6483,7 @@ TEST(IrcProtocolWithServer, 463) RECV(":server 463 alice"); CHECK_ERROR_PARAMS("463", 1, 2); - RECV(":server 463 alice : Your host isn't among the privileged "); + RECV(":server 463 alice : \002Your host isn't among the privileged "); CHECK_SRV("--", " Your host isn't among the privileged ", "irc_463,irc_numeric,nick_server,log3"); } @@ -6478,7 +6503,7 @@ TEST(IrcProtocolWithServer, 464) RECV(":server 464 alice"); CHECK_ERROR_PARAMS("464", 1, 2); - RECV(":server 464 alice : Password incorrect "); + RECV(":server 464 alice : \002Password incorrect "); CHECK_SRV("--", " Password incorrect ", "irc_464,irc_numeric,nick_server,log3"); } @@ -6498,7 +6523,7 @@ TEST(IrcProtocolWithServer, 465) RECV(":server 465 alice"); CHECK_ERROR_PARAMS("465", 1, 2); - RECV(":server 465 alice : You are banned from this server "); + RECV(":server 465 alice : \002You are banned from this server "); CHECK_SRV("--", " You are banned from this server ", "irc_465,irc_numeric,nick_server,log3"); } @@ -6520,7 +6545,7 @@ TEST(IrcProtocolWithServer, 467) RECV(":server 467 alice #test2"); CHECK_SRV("--", "#test2", "irc_467,irc_numeric,nick_server,log3"); - RECV(":server 467 alice #test2 : Channel key already set "); + RECV(":server 467 alice #test2 : \002Channel key already set "); CHECK_SRV("--", "#test2: Channel key already set ", "irc_467,irc_numeric,nick_server,log3"); } @@ -6547,7 +6572,7 @@ TEST(IrcProtocolWithServer, 470) RECV(":server 470 alice #test #test2 forwarding"); CHECK_SRV("--", "#test: #test2 forwarding", "irc_470,irc_numeric,nick_server,log3"); - RECV(":server 470 alice #test #test2 : Forwarding to another channel "); + RECV(":server 470 alice #test #test2 : \002Forwarding to another channel "); CHECK_SRV("--", "#test: #test2 Forwarding to another channel ", "irc_470,irc_numeric,nick_server,log3"); } @@ -6569,7 +6594,7 @@ TEST(IrcProtocolWithServer, 471) RECV(":server 471 alice #test2"); CHECK_SRV("--", "#test2", "irc_471,irc_numeric,nick_server,log3"); - RECV(":server 471 alice #test2 : Cannot join channel (+l) "); + RECV(":server 471 alice #test2 : \002Cannot join channel (+l) "); CHECK_SRV("--", "#test2: Cannot join channel (+l) ", "irc_471,irc_numeric,nick_server,log3"); } @@ -6591,7 +6616,7 @@ TEST(IrcProtocolWithServer, 472) RECV(":server 472 alice x"); CHECK_SRV("--", "x", "irc_472,irc_numeric,nick_server,log3"); - RECV(":server 472 alice x : is unknown mode char to me "); + RECV(":server 472 alice x : \002is unknown mode char to me "); CHECK_SRV("--", "x: is unknown mode char to me ", "irc_472,irc_numeric,nick_server,log3"); } @@ -6613,7 +6638,7 @@ TEST(IrcProtocolWithServer, 473) RECV(":server 473 alice #test2"); CHECK_SRV("--", "#test2", "irc_473,irc_numeric,nick_server,log3"); - RECV(":server 473 alice #test2 : Cannot join channel (+i) "); + RECV(":server 473 alice #test2 : \002Cannot join channel (+i) "); CHECK_SRV("--", "#test2: Cannot join channel (+i) ", "irc_473,irc_numeric,nick_server,log3"); } @@ -6635,7 +6660,7 @@ TEST(IrcProtocolWithServer, 474) RECV(":server 474 alice #test2"); CHECK_SRV("--", "#test2", "irc_474,irc_numeric,nick_server,log3"); - RECV(":server 474 alice #test2 : Cannot join channel (+b) "); + RECV(":server 474 alice #test2 : \002Cannot join channel (+b) "); CHECK_SRV("--", "#test2: Cannot join channel (+b) ", "irc_474,irc_numeric,nick_server,log3"); } @@ -6657,7 +6682,7 @@ TEST(IrcProtocolWithServer, 475) RECV(":server 475 alice #test2"); CHECK_SRV("--", "#test2", "irc_475,irc_numeric,nick_server,log3"); - RECV(":server 475 alice #test2 : Cannot join channel (+k) "); + RECV(":server 475 alice #test2 : \002Cannot join channel (+k) "); CHECK_SRV("--", "#test2: Cannot join channel (+k) ", "irc_475,irc_numeric,nick_server,log3"); } @@ -6679,7 +6704,7 @@ TEST(IrcProtocolWithServer, 476) RECV(":server 476 alice #test2"); CHECK_SRV("--", "#test2", "irc_476,irc_numeric,nick_server,log3"); - RECV(":server 476 alice #test2 : Bad Channel Mask "); + RECV(":server 476 alice #test2 : \002Bad Channel Mask "); CHECK_SRV("--", "#test2: Bad Channel Mask ", "irc_476,irc_numeric,nick_server,log3"); } @@ -6701,7 +6726,7 @@ TEST(IrcProtocolWithServer, 477) RECV(":server 477 alice #test2"); CHECK_SRV("--", "#test2", "irc_477,irc_numeric,nick_server,log3"); - RECV(":server 477 alice #test2 : Channel doesn't support modes "); + RECV(":server 477 alice #test2 : \002Channel doesn't support modes "); CHECK_SRV("--", "#test2: Channel doesn't support modes ", "irc_477,irc_numeric,nick_server,log3"); } @@ -6721,7 +6746,7 @@ TEST(IrcProtocolWithServer, 481) RECV(":server 481 alice"); CHECK_ERROR_PARAMS("481", 1, 2); - RECV(":server 481 alice : Permission Denied- You're not an IRC operator "); + RECV(":server 481 alice : \002Permission Denied- You're not an IRC operator "); CHECK_SRV("--", " Permission Denied- You're not an IRC operator ", "irc_481,irc_numeric,nick_server,log3"); } @@ -6743,7 +6768,7 @@ TEST(IrcProtocolWithServer, 482) RECV(":server 482 alice #test2"); CHECK_SRV("--", "#test2", "irc_482,irc_numeric,nick_server,log3"); - RECV(":server 482 alice #test2 : You're not channel operator "); + RECV(":server 482 alice #test2 : \002You're not channel operator "); CHECK_SRV("--", "#test2: You're not channel operator ", "irc_482,irc_numeric,nick_server,log3"); } @@ -6763,7 +6788,7 @@ TEST(IrcProtocolWithServer, 483) RECV(":server 483 alice"); CHECK_ERROR_PARAMS("483", 1, 2); - RECV(":server 483 alice : You cant kill a server! "); + RECV(":server 483 alice : \002You cant kill a server! "); CHECK_SRV("--", " You cant kill a server! ", "irc_483,irc_numeric,nick_server,log3"); } @@ -6783,7 +6808,7 @@ TEST(IrcProtocolWithServer, 484) RECV(":server 484 alice"); CHECK_ERROR_PARAMS("484", 1, 2); - RECV(":server 484 alice : Your connection is restricted! "); + RECV(":server 484 alice : \002Your connection is restricted! "); CHECK_SRV("--", " Your connection is restricted! ", "irc_484,irc_numeric,nick_server,log3"); } @@ -6803,7 +6828,7 @@ TEST(IrcProtocolWithServer, 485) RECV(":server 485 alice"); CHECK_ERROR_PARAMS("485", 1, 2); - RECV(":server 485 alice : You're not the original channel operator "); + RECV(":server 485 alice : \002You're not the original channel operator "); CHECK_SRV("--", " You're not the original channel operator ", "irc_485,irc_numeric,nick_server,log3"); } @@ -6823,7 +6848,7 @@ TEST(IrcProtocolWithServer, 491) RECV(":server 491 alice"); CHECK_ERROR_PARAMS("491", 1, 2); - RECV(":server 491 alice : No O-lines for your host "); + RECV(":server 491 alice : \002No O-lines for your host "); CHECK_SRV("--", " No O-lines for your host ", "irc_491,irc_numeric,nick_server,log3"); } @@ -6843,7 +6868,7 @@ TEST(IrcProtocolWithServer, 501) RECV(":server 501 alice"); CHECK_ERROR_PARAMS("501", 1, 2); - RECV(":server 501 alice : Unknown MODE flag "); + RECV(":server 501 alice : \002Unknown MODE flag "); CHECK_SRV("--", " Unknown MODE flag ", "irc_501,irc_numeric,nick_server,log3"); } @@ -6863,7 +6888,7 @@ TEST(IrcProtocolWithServer, 502) RECV(":server 502 alice"); CHECK_ERROR_PARAMS("502", 1, 2); - RECV(":server 502 alice : Cant change mode for other users "); + RECV(":server 502 alice : \002Cant change mode for other users "); CHECK_SRV("--", " Cant change mode for other users ", "irc_502,irc_numeric,nick_server,log3"); } @@ -6885,7 +6910,7 @@ TEST(IrcProtocolWithServer, 524) RECV(":server 524 alice UNKNOWN"); CHECK_SRV("--", "UNKNOWN", "irc_524,irc_numeric,nick_server,log3"); - RECV(":server 524 alice UNKNOWN : Help not found "); + RECV(":server 524 alice UNKNOWN : \002Help not found "); CHECK_SRV("--", "UNKNOWN: Help not found ", "irc_524,irc_numeric,nick_server,log3"); } @@ -6906,12 +6931,12 @@ TEST(IrcProtocolWithServer, 569) CHECK_ERROR_PARAMS("569", 1, 2); /* whois, connecting from (UnrealIRCd) */ - RECV(":server 569 alice bob 12345 : is connecting from AS12345 [Hoster] "); + RECV(":server 569 alice bob 12345 : \002is connecting from AS12345 [Hoster] "); CHECK_SRV("--", "[bob] is connecting from AS12345 [Hoster] (12345)", "irc_569,irc_numeric,nick_server,log3"); /* whois, connecting from (UnrealIRCd), no ASN */ - RECV(":server 569 alice bob :is connecting from AS12345 [Hoster]"); + RECV(":server 569 alice bob :\002is connecting from AS12345 [Hoster]"); CHECK_SRV("--", "[bob] is connecting from AS12345 [Hoster]", "irc_569,irc_numeric,nick_server,log3"); } @@ -6956,7 +6981,7 @@ TEST(IrcProtocolWithServer, 705) RECV(":server 705 alice MODE"); CHECK_SRV("--", "MODE", "irc_705,irc_numeric,nick_server,log3"); - RECV(":server 705 alice MODE : Sets and removes modes from the given target. "); + RECV(":server 705 alice MODE : \002Sets and removes modes from the given target. "); CHECK_SRV("--", "MODE: Sets and removes modes from the given target. ", "irc_705,irc_numeric,nick_server,log3"); } @@ -6978,7 +7003,7 @@ TEST(IrcProtocolWithServer, 706) RECV(":server 706 alice MODE"); CHECK_SRV("--", "MODE", "irc_706,irc_numeric,nick_server,log3"); - RECV(":server 706 alice MODE : End of /HELPOP "); + RECV(":server 706 alice MODE : \002End of /HELPOP "); CHECK_SRV("--", "MODE: End of /HELPOP ", "irc_706,irc_numeric,nick_server,log3"); } @@ -7003,15 +7028,15 @@ TEST(IrcProtocolWithServer, 710) RECV(":server 710 #test #test nick1!user1@host1"); CHECK_CHAN("--", "nick1 (user1@host1) has asked for an invite", "irc_710,irc_numeric,notify_message,nick_nick1,host_user1@host1,log3"); - RECV(":server 710 #test #test nick1!user1@host1 : has asked for an invite. "); + RECV(":server 710 #test #test nick1!user1@host1 : \002has asked for an invite. "); CHECK_CHAN("--", "nick1 (user1@host1) has asked for an invite. ", "irc_710,irc_numeric,notify_message,nick_nick1,host_user1@host1,log3"); /* channel not found */ RECV(":server 710 #xyz #xyz nick1!user1@host1"); CHECK_ERROR_PARSE("710", ":server 710 #xyz #xyz nick1!user1@host1"); - RECV(":server 710 #xyz #xyz nick1!user1@host1 : has asked for an invite. "); - CHECK_ERROR_PARSE("710", ":server 710 #xyz #xyz nick1!user1@host1 : has asked for an invite. "); + RECV(":server 710 #xyz #xyz nick1!user1@host1 : \002has asked for an invite. "); + CHECK_ERROR_PARSE("710", ":server 710 #xyz #xyz nick1!user1@host1 : \002has asked for an invite. "); } /* @@ -7031,7 +7056,7 @@ TEST(IrcProtocolWithServer, 711) RECV(":server 711 alice #test"); CHECK_ERROR_PARAMS("711", 2, 3); - RECV(":server 711 alice #test : Your KNOCK has been delivered. "); + RECV(":server 711 alice #test : \002Your KNOCK has been delivered. "); CHECK_SRV("--", "#test: Your KNOCK has been delivered. ", "irc_711,irc_numeric,nick_server,log3"); } @@ -7053,7 +7078,7 @@ TEST(IrcProtocolWithServer, 712) RECV(":server 712 alice #test"); CHECK_ERROR_PARAMS("712", 2, 3); - RECV(":server 712 alice #test : Too many KNOCKs (channel). "); + RECV(":server 712 alice #test : \002Too many KNOCKs (channel). "); CHECK_SRV("--", "#test: Too many KNOCKs (channel). ", "irc_712,irc_numeric,nick_server,log3"); } @@ -7075,7 +7100,7 @@ TEST(IrcProtocolWithServer, 713) RECV(":server 713 alice #test"); CHECK_ERROR_PARAMS("713", 2, 3); - RECV(":server 713 alice #test : Channel is open. "); + RECV(":server 713 alice #test : \002Channel is open. "); CHECK_SRV("--", "#test: Channel is open. ", "irc_713,irc_numeric,nick_server,log3"); } @@ -7097,7 +7122,7 @@ TEST(IrcProtocolWithServer, 714) RECV(":server 714 alice #test"); CHECK_ERROR_PARAMS("714", 2, 3); - RECV(":server 714 alice #test : You are already on that channel. "); + RECV(":server 714 alice #test : \002You are already on that channel. "); CHECK_SRV("--", "#test: You are already on that channel. ", "irc_714,irc_numeric,nick_server,log3"); } @@ -7117,7 +7142,7 @@ TEST(IrcProtocolWithServer, 716) RECV(":server 716 alice"); CHECK_ERROR_PARAMS("716", 1, 2); - RECV(":server 716 alice bob : is in +g mode and must manually allow you to " + RECV(":server 716 alice bob : \002is in +g mode and must manually allow you to " "message them. Your message was discarded. "); CHECK_SRV("--", "bob: is in +g mode and must manually allow you to message them. " @@ -7127,7 +7152,7 @@ TEST(IrcProtocolWithServer, 716) /* open private buffer */ RECV(":bob!user@host PRIVMSG alice :hi Alice!"); - RECV(":server 716 alice bob : is in +g mode and must manually allow you to " + RECV(":server 716 alice bob : \002is in +g mode and must manually allow you to " "message them. Your message was discarded. "); CHECK_PV("bob", "--", "bob: is in +g mode and must manually allow you to message them. " @@ -7150,13 +7175,13 @@ TEST(IrcProtocolWithServer, 717) RECV(":server 717 alice"); CHECK_ERROR_PARAMS("717", 1, 2); - RECV(":server 717 alice bob : has been informed that you messaged them. "); + RECV(":server 717 alice bob : \002has been informed that you messaged them. "); CHECK_SRV("--", "bob: has been informed that you messaged them. ", "irc_717,irc_numeric,nick_server,log3"); /* open private buffer */ RECV(":bob!user@host PRIVMSG alice :hi Alice!"); - RECV(":server 717 alice bob : has been informed that you messaged them. "); + RECV(":server 717 alice bob : \002has been informed that you messaged them. "); CHECK_PV("bob", "--", "bob: has been informed that you messaged them. ", "irc_717,irc_numeric,nick_server,log3"); @@ -7229,7 +7254,7 @@ TEST(IrcProtocolWithServer, 729) CHECK_CHAN("--", "[#test]", "irc_729,irc_numeric,nick_server,log3"); RECV(":server 729 alice #test q end"); CHECK_CHAN("--", "[#test] end", "irc_729,irc_numeric,nick_server,log3"); - RECV(":server 729 alice #test q : End of Channel Quiet List "); + RECV(":server 729 alice #test q : \002End of Channel Quiet List "); CHECK_CHAN("--", "[#test] End of Channel Quiet List ", "irc_729,irc_numeric,nick_server,log3"); @@ -7238,7 +7263,7 @@ TEST(IrcProtocolWithServer, 729) CHECK_SRV("--", "[#xyz]", "irc_729,irc_numeric,nick_server,log3"); RECV(":server 729 alice #xyz q end"); CHECK_SRV("--", "[#xyz] end", "irc_729,irc_numeric,nick_server,log3"); - RECV(":server 729 alice #xyz q : End of Channel Quiet List "); + RECV(":server 729 alice #xyz q : \002End of Channel Quiet List "); CHECK_SRV("--", "[#xyz] End of Channel Quiet List ", "irc_729,irc_numeric,nick_server,log3"); } @@ -7403,7 +7428,7 @@ TEST(IrcProtocolWithServer, 734) CHECK_SRV("=!=", " (10)", "irc_734,irc_numeric,nick_server,log3"); RECV(":server 734 alice 10 nick1,nick2 full"); CHECK_SRV("=!=", "full (10)", "irc_734,irc_numeric,nick_server,log3"); - RECV(":server 734 alice 10 nick1,nick2 : Monitor list is full "); + RECV(":server 734 alice 10 nick1,nick2 : \002Monitor list is full "); CHECK_SRV("=!=", " Monitor list is full (10)", "irc_734,irc_numeric,nick_server,log3"); } @@ -7425,13 +7450,13 @@ TEST(IrcProtocolWithServer, 742) RECV(":server 742 alice #test"); CHECK_SRV("--", "#test", "irc_742,irc_numeric,nick_server,log3"); - RECV(":server 742 alice #test n nstlk : MODE cannot be set due to channel " + RECV(":server 742 alice #test n nstlk : \002MODE cannot be set due to channel " "having an active MLOCK restriction policy "); CHECK_CHAN("--", "#test: n nstlk MODE cannot be set due to channel having " "an active MLOCK restriction policy ", "irc_742,irc_numeric,nick_server,log3"); - RECV(":server 742 alice #test2 n nstlk :MODE cannot be set due to channel " + RECV(":server 742 alice #test2 n nstlk :\002MODE cannot be set due to channel " "having an active MLOCK restriction policy"); CHECK_SRV("--", "#test2: n nstlk MODE cannot be set due to channel having " @@ -7461,10 +7486,11 @@ TEST(IrcProtocolWithServer, 900) RECV(":server 900 alice alice!user@host alice logged"); CHECK_SRV("--", "logged (alice!user@host)", "irc_900,irc_numeric,nick_server,log3"); - RECV(":server 900 alice alice!user@host alice : You are now logged in as mynick "); + RECV(":server 900 alice alice!user@host alice : " + "\002You are now logged in as mynick "); CHECK_SRV("--", " You are now logged in as mynick (alice!user@host)", "irc_900,irc_numeric,nick_server,log3"); - RECV(":server 900 * * alice : You are now logged in as mynick "); + RECV(":server 900 * * alice : \002You are now logged in as mynick "); CHECK_SRV("--", " You are now logged in as mynick ", "irc_900,irc_numeric,nick_server,log3"); } @@ -7488,7 +7514,7 @@ TEST(IrcProtocolWithServer, 901) RECV(":server 901 alice nick!user@host logged"); CHECK_SRV("--", "logged", "irc_901,irc_numeric,nick_server,log3"); - RECV(":server 901 alice nick!user@host : You are now logged out "); + RECV(":server 901 alice nick!user@host : \002You are now logged out "); CHECK_SRV("--", " You are now logged out ", "irc_901,irc_numeric,nick_server,log3"); } @@ -7513,7 +7539,7 @@ TEST(IrcProtocolWithServer, 903_907) RECV(":server 903 alice ok"); CHECK_SRV("--", "ok", "irc_903,irc_numeric,nick_server,log3"); - RECV(":server 903 alice : SASL authentication successful "); + RECV(":server 903 alice : \002SASL authentication successful "); CHECK_SRV("--", " SASL authentication successful ", "irc_903,irc_numeric,nick_server,log3"); RECV(":server 903 * : SASL authentication successful "); @@ -7523,7 +7549,7 @@ TEST(IrcProtocolWithServer, 903_907) RECV(":server 907 alice ok"); CHECK_SRV("--", "ok", "irc_907,irc_numeric,nick_server,log3"); - RECV(":server 907 alice : SASL authentication successful "); + RECV(":server 907 alice : \002SASL authentication successful "); CHECK_SRV("--", " SASL authentication successful ", "irc_907,irc_numeric,nick_server,log3"); } @@ -7558,25 +7584,25 @@ TEST(IrcProtocolWithServer, 902_904_905_906) RECV(":server 902 alice error"); CHECK_SRV("--", "error", "irc_902,irc_numeric,nick_server,log3"); - RECV(":server 902 alice : SASL authentication failed "); + RECV(":server 902 alice : \002SASL authentication failed "); CHECK_SRV("--", " SASL authentication failed ", "irc_902,irc_numeric,nick_server,log3"); RECV(":server 904 alice error"); CHECK_SRV("--", "error", "irc_904,irc_numeric,nick_server,log3"); - RECV(":server 904 alice : SASL authentication failed "); + RECV(":server 904 alice : \002SASL authentication failed "); CHECK_SRV("--", " SASL authentication failed ", "irc_904,irc_numeric,nick_server,log3"); RECV(":server 905 alice error"); CHECK_SRV("--", "error", "irc_905,irc_numeric,nick_server,log3"); - RECV(":server 905 alice : SASL authentication failed "); + RECV(":server 905 alice : \002SASL authentication failed "); CHECK_SRV("--", " SASL authentication failed ", "irc_905,irc_numeric,nick_server,log3"); RECV(":server 906 alice error"); CHECK_SRV("--", "error", "irc_906,irc_numeric,nick_server,log3"); - RECV(":server 906 alice : SASL authentication failed "); + RECV(":server 906 alice : \002SASL authentication failed "); CHECK_SRV("--", " SASL authentication failed ", "irc_906,irc_numeric,nick_server,log3"); } @@ -7599,7 +7625,7 @@ TEST(IrcProtocolWithServer, 936) RECV(":server 936 alice #test"); CHECK_SRV("--", "#test", "irc_936,irc_numeric,nick_server,log3"); RECV(":server 936 alice #test CENSORED_WORD " - ": Your message contained a censored word, and was blocked "); + ": \002Your message contained a censored word, and was blocked "); CHECK_CHAN("--", "#test: CENSORED_WORD Your message contained a censored word, " "and was blocked ",