diff --git a/ChangeLog b/ChangeLog index fbb13ab73..f0930ec23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2008-12-10 +ChangeLog - 2008-12-19 Version 0.2.7 (under dev!): + * add some colors in IRC messages from server (for text and nicks) + (task #8926) * new relay plugin (network communication between WeeChat and remote application) * add support for more than one proxy, with proxy selection for each IRC diff --git a/po/cs.po b/po/cs.po index e78068e72..1e0421aff 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" "PO-Revision-Date: 2008-09-17 16:19+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3495,6 +3495,14 @@ msgstr "" msgid "display notices as private messages" msgstr "zobrazit upozornění jako soukromé zprávy" +#, fuzzy +msgid "color for text in join messages" +msgstr "prefix pro zprávy připojení" + +#, fuzzy +msgid "color for text in part/quit messages" +msgstr "prefix pro zprávy ukončení" + #, fuzzy msgid "color for nick in input bar" msgstr "barva přezdívek" @@ -3632,19 +3640,19 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "%s kanál \"%s\" nebyl nalezen příkazem \"%s\"\n" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" msgstr "%s%s%s byl vykopnut %s%s%s z %s%s" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" +msgid "%s%s%s%s has kicked %s%s" msgstr "%s%s%s byl vykopnut %s%s%s z %s%s" #, fuzzy, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" msgstr "%s%s%s byl zabit %s%s%s ze serveru" #, fuzzy, c-format -msgid "%sYou were killed by %s%s" +msgid "%s%sYou were killed by %s%s" msgstr "Nyní známý jako %s%s\n" #, fuzzy, c-format diff --git a/po/de.po b/po/de.po index c7ae3506f..75d29e079 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -3478,6 +3478,14 @@ msgstr "" msgid "display notices as private messages" msgstr "NOTICEs als Queries anzeigen" +#, fuzzy +msgid "color for text in join messages" +msgstr "Farbe eines Fensters mit neuen Messages" + +#, fuzzy +msgid "color for text in part/quit messages" +msgstr "Standardnachricht beim Beenden" + #, fuzzy msgid "color for nick in input bar" msgstr "Farbe von Nicknames" @@ -3615,19 +3623,19 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "%s Channel \"%s\" für den \"%s\"-Befehl nicht gefunden\n" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" msgstr "%s%s%s hat %s%s%s aus %s%s gekickt" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" +msgid "%s%s%s%s has kicked %s%s" msgstr "%s%s%s hat %s%s%s aus %s%s gekickt" #, fuzzy, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" msgstr "%s%s%s hat %s%s%s vom Server getrennt" #, fuzzy, c-format -msgid "%sYou were killed by %s%s" +msgid "%s%sYou were killed by %s%s" msgstr "Sie sind nun als %s%s bekannt\n" #, fuzzy, c-format diff --git a/po/es.po b/po/es.po index 5d6f63b8a..b8baad907 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -3467,6 +3467,14 @@ msgstr "" msgid "display notices as private messages" msgstr "mostrar noticias como mensajes privados" +#, fuzzy +msgid "color for text in join messages" +msgstr "color para una ventana con mensajes nuevos" + +#, fuzzy +msgid "color for text in part/quit messages" +msgstr "mensaje de fin por defecto" + #, fuzzy msgid "color for nick in input bar" msgstr "color para los nombres de usuario" @@ -3606,19 +3614,19 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "%s canal \"%s\" no encontrado para el comando \"%s\"\n" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" msgstr "%s%s%s ha pateado a %s%s%s de %s%s" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" +msgid "%s%s%s%s has kicked %s%s" msgstr "%s%s%s ha pateado a %s%s%s de %s%s" #, fuzzy, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" msgstr "%s%s%s ha expulsado a %s%s%s del servidor" #, fuzzy, c-format -msgid "%sYou were killed by %s%s" +msgid "%s%sYou were killed by %s%s" msgstr "Usted es conocido ahora como %s%s\n" #, fuzzy, c-format diff --git a/po/fr.po b/po/fr.po index c3fdacf8e..7e6be3b70 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" -"PO-Revision-Date: 2008-12-19 13:15+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" +"PO-Revision-Date: 2008-12-19 15:02+0100\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -3602,6 +3602,12 @@ msgstr "délai pour filtrer les messages join/part/quit (en minutes)" msgid "display notices as private messages" msgstr "afficher les notices comme des messages privés" +msgid "color for text in join messages" +msgstr "couleur pour le texte dans les messages join" + +msgid "color for text in part/quit messages" +msgstr "couleur pour le texte dans les messages part/quit" + msgid "color for nick in input bar" msgstr "couleur du pseudo dans la barre de saisie" @@ -3730,20 +3736,20 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "%s%s: canal \"%s\" non trouvé pour la commande \"%s\"" #, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" -msgstr "%s%s%s%s a poussé dehors %s%s%s de %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" +msgstr "%s%s%s%s a expulsé %s%s %s(%s%s%s)" #, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" -msgstr "%s%s%s%s a poussé dehors %s%s%s de %s%s" +msgid "%s%s%s%s has kicked %s%s" +msgstr "%s%s%s%s a expulsé %s%s" #, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" -msgstr "%sVous avez été tué par %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" +msgstr "%s%sVous avez été tué par %s%s %s(%s%s%s)" #, c-format -msgid "%sYou were killed by %s%s" -msgstr "%sVous avez été tué par %s%s" +msgid "%s%sYou were killed by %s%s" +msgstr "%s%sVous avez été tué par %s%s" #, c-format msgid "%sMode %s%s %s[%s%s%s]%s by %s%s" diff --git a/po/hu.po b/po/hu.po index fa4d30711..cc335ca2d 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3510,6 +3510,14 @@ msgstr "" msgid "display notices as private messages" msgstr "figyelmeztetések privát üzenetként való mutatása" +#, fuzzy +msgid "color for text in join messages" +msgstr "új üzenetet tartalmazó ablak színe" + +#, fuzzy +msgid "color for text in part/quit messages" +msgstr "alapértelmezett kilépő üzenet" + #, fuzzy msgid "color for nick in input bar" msgstr "nevek színe" @@ -3641,19 +3649,19 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "%s a \"%s\" szoba nem található a \"%s\" parancshoz\n" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" msgstr "%s%s%s kirúgta %s%s%s-t a(z) %s%s szobából" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" +msgid "%s%s%s%s has kicked %s%s" msgstr "%s%s%s kirúgta %s%s%s-t a(z) %s%s szobából" #, fuzzy, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" msgstr "%s%s%s eltávolította %s%s%s-t a szerverről" #, fuzzy, c-format -msgid "%sYou were killed by %s%s" +msgid "%s%sYou were killed by %s%s" msgstr "Az új neved: %s%s\n" #, fuzzy, c-format diff --git a/po/ru.po b/po/ru.po index 6f06cda97..a562b6320 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -3503,6 +3503,14 @@ msgstr "" msgid "display notices as private messages" msgstr "отображать notice'ы в виде личных сообщений" +#, fuzzy +msgid "color for text in join messages" +msgstr "цвет текущего окна с сообщениями" + +#, fuzzy +msgid "color for text in part/quit messages" +msgstr "сообщение о выходе по-умолчанию" + #, fuzzy msgid "color for nick in input bar" msgstr "цвет ников" @@ -3634,19 +3642,19 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "%s канал \"%s\" не найден для команды \"%s\"\n" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" msgstr "%s%s%s выкинул %s%s%s с канала %s%s" #, fuzzy, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" +msgid "%s%s%s%s has kicked %s%s" msgstr "%s%s%s выкинул %s%s%s с канала %s%s" #, fuzzy, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" msgstr "%s%s%s убил %s%s%s" #, fuzzy, c-format -msgid "%sYou were killed by %s%s" +msgid "%s%sYou were killed by %s%s" msgstr "Теперь вы известны как %s%s\n" #, fuzzy, c-format diff --git a/po/weechat.pot b/po/weechat.pot index 22d73d7de..cd3ee90c4 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 13:12+0100\n" +"POT-Creation-Date: 2008-12-19 15:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2993,6 +2993,12 @@ msgstr "" msgid "display notices as private messages" msgstr "" +msgid "color for text in join messages" +msgstr "" + +msgid "color for text in part/quit messages" +msgstr "" + msgid "color for nick in input bar" msgstr "" @@ -3106,19 +3112,19 @@ msgid "%s%s: channel \"%s\" not found for \"%s\" command" msgstr "" #, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s %s(%s%s%s)" +msgid "%s%s%s%s has kicked %s%s %s(%s%s%s)" msgstr "" #, c-format -msgid "%s%s%s%s has kicked %s%s%s from %s%s" +msgid "%s%s%s%s has kicked %s%s" msgstr "" #, c-format -msgid "%sYou were killed by %s%s %s(%s%s%s)" +msgid "%s%sYou were killed by %s%s %s(%s%s%s)" msgstr "" #, c-format -msgid "%sYou were killed by %s%s" +msgid "%s%sYou were killed by %s%s" msgstr "" #, c-format diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 54b029c7c..e00a2fe0a 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -52,6 +52,7 @@ struct t_config_section *irc_config_section_server = NULL; /* IRC config, look section */ +struct t_config_option *irc_config_look_color_nicks_in_server_messages; struct t_config_option *irc_config_look_one_server_buffer; struct t_config_option *irc_config_look_open_near_server; struct t_config_option *irc_config_look_nick_prefix; @@ -68,6 +69,8 @@ struct t_config_option *irc_config_look_notice_as_pv; /* IRC config, color section */ +struct t_config_option *irc_config_color_message_join; +struct t_config_option *irc_config_color_message_quit; struct t_config_option *irc_config_color_input_nick; /* IRC config, network section */ @@ -1106,7 +1109,13 @@ irc_config_init () weechat_config_free (irc_config_file); return 0; } - + + irc_config_look_color_nicks_in_server_messages = weechat_config_new_option ( + irc_config_file, ptr_section, + "color_nicks_in_server_messages", "boolean", + N_("use nick color in messages from server"), + NULL, 0, 0, "on", NULL, NULL, NULL, + NULL, NULL, NULL, NULL); irc_config_look_one_server_buffer = weechat_config_new_option ( irc_config_file, ptr_section, "one_server_buffer", "boolean", @@ -1192,6 +1201,18 @@ irc_config_init () return 0; } + irc_config_color_message_join = weechat_config_new_option ( + irc_config_file, ptr_section, + "message_join", "color", + N_("color for text in join messages"), + NULL, -1, 0, "green", NULL, NULL, NULL, + NULL, NULL, NULL, NULL); + irc_config_color_message_quit = weechat_config_new_option ( + irc_config_file, ptr_section, + "message_quit", "color", + N_("color for text in part/quit messages"), + NULL, -1, 0, "red", NULL, NULL, NULL, + NULL, NULL, NULL, NULL); irc_config_color_input_nick = weechat_config_new_option ( irc_config_file, ptr_section, "input_nick", "color", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 229ab16a1..71374071a 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -63,6 +63,7 @@ extern struct t_config_file *irc_config_file; extern struct t_config_section *irc_config_section_server_default; extern struct t_config_section *irc_config_section_server; +extern struct t_config_option *irc_config_look_color_nicks_in_server_messages; extern struct t_config_option *irc_config_look_one_server_buffer; extern struct t_config_option *irc_config_look_open_near_server; extern struct t_config_option *irc_config_look_nick_prefix; @@ -77,6 +78,8 @@ extern struct t_config_option *irc_config_look_smart_filter; extern struct t_config_option *irc_config_look_smart_filter_delay; extern struct t_config_option *irc_config_look_notice_as_pv; +extern struct t_config_option *irc_config_color_message_join; +extern struct t_config_option *irc_config_color_message_quit; extern struct t_config_option *irc_config_color_input_nick; extern struct t_config_option *irc_config_network_default_msg_part; diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 90cdcdfa2..d2c49475f 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -434,7 +434,7 @@ irc_nick_search (struct t_irc_channel *channel, const char *nickname) { struct t_irc_nick *ptr_nick; - if (!nickname) + if (!channel || !nickname) return NULL; for (ptr_nick = channel->nicks; ptr_nick; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index bea5d7e33..54eb56ca9 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -341,30 +341,6 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command, } } - if (!irc_ignore_check (server, ptr_channel, nick, host)) - { - local_join = (strcmp (nick, server->nick) == 0); - ptr_nick_speaking = (weechat_config_boolean (irc_config_look_smart_filter)) ? - irc_channel_nick_speaking_time_search (ptr_channel, nick, 1) : NULL; - weechat_printf_tags (ptr_channel->buffer, - irc_protocol_tags (command, - (local_join - || !weechat_config_boolean (irc_config_look_smart_filter) - || ptr_nick_speaking) ? - NULL : "irc_smart_filter"), - _("%s%s%s %s(%s%s%s)%s has joined %s%s"), - weechat_prefix ("join"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - address, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - pos_channel); - } - /* remove topic and display channel creation date if joining new channel */ if (!ptr_channel->nicks) { @@ -379,6 +355,30 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command, if (ptr_nick) ptr_nick->host = strdup (address); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + local_join = (strcmp (nick, server->nick) == 0); + ptr_nick_speaking = (weechat_config_boolean (irc_config_look_smart_filter)) ? + irc_channel_nick_speaking_time_search (ptr_channel, nick, 1) : NULL; + weechat_printf_tags (ptr_channel->buffer, + irc_protocol_tags (command, + (local_join + || !weechat_config_boolean (irc_config_look_smart_filter) + || ptr_nick_speaking) ? + NULL : "irc_smart_filter"), + _("%s%s%s %s(%s%s%s)%s has joined %s%s"), + weechat_prefix ("join"), + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_MESSAGE_JOIN, + IRC_COLOR_CHAT_CHANNEL, + pos_channel); + } + return WEECHAT_RC_OK; } @@ -392,7 +392,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, { char *pos_comment; struct t_irc_channel *ptr_channel; - struct t_irc_nick *ptr_nick; + struct t_irc_nick *ptr_nick, *ptr_nick_kicked; /* KICK message looks like: :nick1!user@host KICK #channel nick2 :kick reason @@ -416,23 +416,22 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, return WEECHAT_RC_ERROR; } + ptr_nick = irc_nick_search (ptr_channel, nick); + ptr_nick_kicked = irc_nick_search (ptr_channel, argv[3]); + if (!irc_ignore_check (server, ptr_channel, nick, host)) { if (pos_comment) { weechat_printf_tags (ptr_channel->buffer, irc_protocol_tags (command, NULL), - _("%s%s%s%s has kicked %s%s%s from %s%s " - "%s(%s%s%s)"), + _("%s%s%s%s has kicked %s%s %s(%s%s%s)"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick_kicked), argv[3], - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - argv[2], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, pos_comment, @@ -442,16 +441,13 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, { weechat_printf_tags (ptr_channel->buffer, irc_protocol_tags (command, NULL), - _("%s%s%s%s has kicked %s%s%s from %s%s"), + _("%s%s%s%s has kicked %s%s"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - argv[3], - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - argv[2]); + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick_kicked), + argv[3]); } } @@ -467,9 +463,8 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, { /* someone was kicked from channel (but not me) => remove only this nick */ - ptr_nick = irc_nick_search (ptr_channel, argv[3]); - if (ptr_nick) - irc_nick_free (ptr_channel, ptr_nick); + if (ptr_nick_kicked) + irc_nick_free (ptr_channel, ptr_nick_kicked); } return WEECHAT_RC_OK; @@ -485,7 +480,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command, { char *pos_comment; struct t_irc_channel *ptr_channel; - struct t_irc_nick *ptr_nick; + struct t_irc_nick *ptr_nick, *ptr_nick_killed; /* KILL message looks like: :nick1!user@host KILL mynick :kill reason @@ -501,15 +496,19 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command, for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { + ptr_nick = irc_nick_search (ptr_channel, nick); + ptr_nick_killed = irc_nick_search (ptr_channel, argv[2]); + if (!irc_ignore_check (server, ptr_channel, nick, host)) { if (pos_comment) { weechat_printf_tags (ptr_channel->buffer, irc_protocol_tags (command, NULL), - _("%sYou were killed by %s%s %s(%s%s%s)"), + _("%s%sYou were killed by %s%s %s(%s%s%s)"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, @@ -520,9 +519,10 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command, { weechat_printf_tags (ptr_channel->buffer, irc_protocol_tags (command, NULL), - _("%sYou were killed by %s%s"), + _("%s%sYou were killed by %s%s"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick); } } @@ -537,9 +537,8 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command, { /* someone was killed on channel (but not me) => remove only this nick */ - ptr_nick = irc_nick_search (ptr_channel, argv[2]); - if (ptr_nick) - irc_nick_free (ptr_channel, ptr_nick); + if (ptr_nick_killed) + irc_nick_free (ptr_channel, ptr_nick_killed); } } @@ -556,6 +555,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command, { char *pos_modes; struct t_irc_channel *ptr_channel; + struct t_irc_nick *ptr_nick; /* MODE message looks like: :nick!user@host MODE #test +o nick @@ -575,6 +575,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command, irc_mode_channel_set (server, ptr_channel, pos_modes); irc_server_sendf (server, "MODE %s", ptr_channel->name); } + ptr_nick = irc_nick_search (ptr_channel, nick); if (!irc_ignore_check (server, ptr_channel, nick, host)) { weechat_printf_tags ((ptr_channel) ? @@ -589,7 +590,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command, pos_modes, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick); } } @@ -625,7 +626,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, { struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; - char *new_nick; + char *new_nick, *old_color; int local_nick; /* NICK message looks like: @@ -668,6 +669,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, weechat_buffer_set (NULL, "hotlist", "-"); /* change nick and display message on all channels */ + old_color = strdup (ptr_nick->color); irc_nick_change (server, ptr_channel, ptr_nick, new_nick); if (local_nick) { @@ -676,7 +678,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, _("%sYou are now known as " "%s%s"), weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), new_nick); } else @@ -688,10 +690,11 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, _("%s%s%s%s is now known as " "%s%s"), weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, + weechat_config_boolean(irc_config_look_color_nicks_in_server_messages) ? + old_color : IRC_COLOR_CHAT_NICK, nick, IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), new_nick); } irc_channel_nick_speaking_rename (ptr_channel, @@ -700,6 +703,9 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, nick, new_nick); } + if (old_color) + free (old_color); + /* enable hotlist */ weechat_buffer_set (NULL, "hotlist", "+"); } @@ -725,6 +731,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, struct timeval tv; long sec1, usec1, sec2, usec2, difftime; struct t_irc_channel *ptr_channel; + struct t_irc_nick *ptr_nick; int notify_private; /* NOTICE message looks like: @@ -821,13 +828,14 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, { /* notice for channel */ ptr_channel = irc_channel_search (server, pos_target); + ptr_nick = irc_nick_search (ptr_channel, nick); weechat_printf_tags ((ptr_channel) ? ptr_channel->buffer : server->buffer, irc_protocol_tags (command, NULL), "%sNotice%s(%s%s%s)%s: %s", (ptr_channel) ? weechat_prefix ("network") : irc_buffer_get_server_prefix (server, "network"), IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), (nick && nick[0]) ? nick : "?", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, @@ -976,13 +984,13 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, _("%s%s%s %s(%s%s%s)%s has left %s%s " "%s(%s%s%s)"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, address, IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, + IRC_COLOR_MESSAGE_QUIT, IRC_COLOR_CHAT_CHANNEL, ptr_channel->name, IRC_COLOR_CHAT_DELIMITERS, @@ -1001,13 +1009,13 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, _("%s%s%s %s(%s%s%s)%s has left " "%s%s"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, address, IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, + IRC_COLOR_MESSAGE_QUIT, IRC_COLOR_CHAT_CHANNEL, ptr_channel->name); } @@ -2125,9 +2133,6 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, if (ptr_nick || (strcmp (ptr_channel->name, nick) == 0)) { - if (ptr_nick) - irc_nick_free (ptr_channel, ptr_nick); - /* display quit message */ if (!irc_ignore_check (server, ptr_channel, nick, host)) { @@ -2145,13 +2150,13 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, _("%s%s%s %s(%s%s%s)%s has quit " "%s(%s%s%s)"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, address, IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, + IRC_COLOR_MESSAGE_QUIT, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, pos_comment, @@ -2167,15 +2172,17 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, NULL : "irc_smart_filter"), _("%s%s%s %s(%s%s%s)%s has quit"), weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, address, IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT); + IRC_COLOR_MESSAGE_QUIT); } } + if (ptr_nick) + irc_nick_free (ptr_channel, ptr_nick); } } @@ -2261,6 +2268,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command, { char *pos_topic, *topic_color; struct t_irc_channel *ptr_channel; + struct t_irc_nick *ptr_nick; struct t_gui_buffer *ptr_buffer; /* TOPIC message looks like: @@ -2283,8 +2291,9 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command, ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; ptr_channel = irc_channel_search (server, argv[2]); + ptr_nick = irc_nick_search (ptr_channel, nick); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - + if (!irc_ignore_check (server, ptr_channel, nick, host)) { if (pos_topic && pos_topic[0]) @@ -2297,7 +2306,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command, "\"%s%s\""), (ptr_buffer == server->buffer) ? irc_buffer_get_server_prefix (server, "network") : weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT, IRC_COLOR_CHAT_CHANNEL, @@ -2315,7 +2324,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command, _("%s%s%s%s has unset topic for %s%s"), (ptr_buffer == server->buffer) ? irc_buffer_get_server_prefix (server, "network") : weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), nick, IRC_COLOR_CHAT, IRC_COLOR_CHAT_CHANNEL, @@ -3277,6 +3286,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command, int argc, char **argv, char **argv_eol) { struct t_irc_channel *ptr_channel; + struct t_irc_nick *ptr_nick; time_t datetime; /* 333 message looks like: @@ -3286,6 +3296,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command, IRC_PROTOCOL_MIN_ARGS(6); ptr_channel = irc_channel_search (server, argv[3]); + ptr_nick = irc_nick_search (ptr_channel, argv[4]); datetime = (time_t)(atol ((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5])); if (ptr_channel && ptr_channel->nicks) @@ -3294,7 +3305,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command, irc_protocol_tags (command, "irc_numeric"), _("%sTopic set by %s%s%s on %s"), weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), argv[4], IRC_COLOR_CHAT, ctime (&datetime)); @@ -3308,7 +3319,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command, IRC_COLOR_CHAT_CHANNEL, argv[3], IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, + IRC_COLOR_NICK_IN_SERVER_MESSAGE(ptr_nick), argv[4], IRC_COLOR_CHAT, ctime (&datetime)); diff --git a/src/plugins/irc/irc.h b/src/plugins/irc/irc.h index d8ad68975..14aa43c2e 100644 --- a/src/plugins/irc/irc.h +++ b/src/plugins/irc/irc.h @@ -63,7 +63,12 @@ #define IRC_COLOR_BAR_DELIM weechat_color("bar_delim") #define IRC_COLOR_STATUS_NUMBER weechat_color(weechat_config_string(weechat_config_get("weechat.color.status_number"))) #define IRC_COLOR_STATUS_NAME weechat_color(weechat_config_string(weechat_config_get("weechat.color.status_name"))) +#define IRC_COLOR_MESSAGE_JOIN weechat_color(weechat_config_string(irc_config_color_message_join)) +#define IRC_COLOR_MESSAGE_QUIT weechat_color(weechat_config_string(irc_config_color_message_quit)) #define IRC_COLOR_INPUT_NICK weechat_color(weechat_config_string(irc_config_color_input_nick)) +#define IRC_COLOR_NICK_IN_SERVER_MESSAGE(nick) \ + ((nick && weechat_config_boolean(irc_config_look_color_nicks_in_server_messages)) ? \ + nick->color : IRC_COLOR_CHAT_NICK) extern struct t_weechat_plugin *weechat_irc_plugin; extern struct t_hook *irc_hook_timer_check_away;