diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-color.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 31 |
4 files changed, 36 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h index 526c50196..488f110b4 100644 --- a/src/plugins/irc/irc-color.h +++ b/src/plugins/irc/irc-color.h @@ -84,6 +84,7 @@ #define IRC_COLOR_STATUS_NAME weechat_color("status_name") #define IRC_COLOR_STATUS_NAME_SSL weechat_color("status_name_ssl") #define IRC_COLOR_MESSAGE_JOIN weechat_color(weechat_config_string(irc_config_color_message_join)) +#define IRC_COLOR_MESSAGE_CHGHOST weechat_color(weechat_config_string(irc_config_color_message_chghost)) #define IRC_COLOR_MESSAGE_QUIT weechat_color(weechat_config_string(irc_config_color_message_quit)) #define IRC_COLOR_REASON_QUIT weechat_color(weechat_config_string(irc_config_color_reason_quit)) #define IRC_COLOR_TOPIC_CURRENT weechat_color(weechat_config_string(irc_config_color_topic_current)) diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 1b1c85a98..f6c61d41f 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -115,6 +115,7 @@ struct t_config_option *irc_config_color_item_lag_counting; struct t_config_option *irc_config_color_item_lag_finished; struct t_config_option *irc_config_color_item_nick_modes; struct t_config_option *irc_config_color_message_join; +struct t_config_option *irc_config_color_message_chghost; struct t_config_option *irc_config_color_message_quit; struct t_config_option *irc_config_color_mirc_remap; struct t_config_option *irc_config_color_nick_prefixes; @@ -3018,6 +3019,12 @@ irc_config_init () N_("color for text in join messages"), NULL, -1, 0, "green", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_message_chghost = weechat_config_new_option ( + irc_config_file, ptr_section, + "message_chghost", "color", + N_("color for text in chghost messages"), + NULL, -1, 0, "brown", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_color_message_quit = weechat_config_new_option ( irc_config_file, ptr_section, "message_quit", "color", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 5ebed8362..3982ee94f 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -152,6 +152,7 @@ extern struct t_config_option *irc_config_color_item_lag_counting; extern struct t_config_option *irc_config_color_item_lag_finished; extern struct t_config_option *irc_config_color_item_nick_modes; extern struct t_config_option *irc_config_color_message_join; +extern struct t_config_option *irc_config_color_message_chghost; extern struct t_config_option *irc_config_color_message_quit; extern struct t_config_option *irc_config_color_mirc_remap; extern struct t_config_option *irc_config_color_nick_prefixes; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 0c0b59fa1..8624ac373 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -651,26 +651,49 @@ IRC_PROTOCOL_CALLBACK(cap) IRC_PROTOCOL_CALLBACK(chghost) { int length; + char *str_host; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; IRC_PROTOCOL_MIN_ARGS(4); + length = strlen (argv[2]) + 1 + strlen (argv[3]) + 1; + str_host = malloc (length); + if (str_host) + snprintf (str_host, length, "%s@%s", argv[2], argv[3]); + for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { ptr_nick = irc_nick_search (server, ptr_channel, nick); if (ptr_nick) { + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, NULL, nick, address), + _("%s%s%s%s (%s%s%s)%s has changed host to %s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_MESSAGE_CHGHOST, + IRC_COLOR_CHAT_HOST, + str_host); + if (ptr_nick->host) free (ptr_nick->host); - length = strlen (argv[2]) + 1 + strlen (argv[3]) + 1; - ptr_nick->host = malloc (length); - if (ptr_nick->host) - snprintf (ptr_nick->host, length, "%s@%s", argv[2], argv[3]); + ptr_nick->host = strdup (str_host); } } + if (str_host) + free (str_host); + return WEECHAT_RC_OK; } |