diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-04-03 19:11:55 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-04-03 19:11:55 +0200 |
commit | 19d74e18a511e12972b4d7cb4920acfc76d3b509 (patch) | |
tree | 2402670299859aec8efbc72cbc5532d540ff0e3e | |
parent | 96f49f39e0fb41e50b416fea9891d15fa2333a8e (diff) | |
download | weechat-19d74e18a511e12972b4d7cb4920acfc76d3b509.zip |
Add highlight word "$nick" instead of real nick in IRC and xfer plugins
-rw-r--r-- | src/plugins/irc/irc-channel.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 6 | ||||
-rw-r--r-- | src/plugins/xfer/xfer-chat.c | 38 |
3 files changed, 24 insertions, 22 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 3cf20f143..92651e9ad 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -201,7 +201,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type, weechat_buffer_set (new_buffer, "nicklist_display_groups", "0"); /* set highlights settings on channel buffer */ - weechat_buffer_set (new_buffer, "highlight_words", server->nick); + weechat_buffer_set(new_buffer, "highlight_words_add", "$nick"); if (weechat_config_string (irc_config_look_highlight_tags) && weechat_config_string (irc_config_look_highlight_tags)[0]) { diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 978bf4694..1566dc728 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -258,14 +258,11 @@ irc_server_set_nick (struct t_irc_server *server, const char *nick) free (server->nick); server->nick = (nick) ? strdup (nick) : NULL; - weechat_buffer_set (server->buffer, "highlight_words", nick); - /* set local variable "nick" for server and all channels/pv */ weechat_buffer_set (server->buffer, "localvar_set_nick", nick); for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - weechat_buffer_set (ptr_channel->buffer, "highlight_words", nick); weechat_buffer_set (ptr_channel->buffer, "localvar_set_nick", nick); } @@ -2359,8 +2356,7 @@ irc_server_create_buffer (struct t_irc_server *server) weechat_buffer_set (server->buffer, "input_get_unknown_commands", "1"); /* set highlights settings on server buffer */ - if (server->nick) - weechat_buffer_set (server->buffer, "highlight_words", server->nick); + weechat_buffer_set (server->buffer, "highlight_words_add", "$nick"); if (weechat_config_string (irc_config_look_highlight_tags) && weechat_config_string (irc_config_look_highlight_tags)[0]) { diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c index e12af3da5..63d6bff7d 100644 --- a/src/plugins/xfer/xfer-chat.c +++ b/src/plugins/xfer/xfer-chat.c @@ -303,7 +303,9 @@ void xfer_chat_open_buffer (struct t_xfer *xfer) { char *name; - int length; + int length, buffer_created; + + buffer_created = 0; length = strlen (xfer->plugin_name) + 8 + strlen (xfer->remote_nick) + 1; name = malloc (length); @@ -317,26 +319,30 @@ xfer_chat_open_buffer (struct t_xfer *xfer) xfer->buffer = weechat_buffer_new (name, &xfer_chat_buffer_input_cb, NULL, &xfer_chat_buffer_close_cb, NULL); + buffer_created = 1; /* failed to create buffer ? then return */ if (!xfer->buffer) return; } - - weechat_buffer_set (xfer->buffer, "title", _("xfer chat")); - weechat_buffer_set (xfer->buffer, "short_name", xfer->remote_nick); - weechat_buffer_set (xfer->buffer, "localvar_set_type", "private"); - weechat_buffer_set (xfer->buffer, "localvar_set_nick", xfer->local_nick); - weechat_buffer_set (xfer->buffer, "localvar_set_channel", xfer->remote_nick); - weechat_buffer_set (xfer->buffer, "highlight_words", xfer->local_nick); - weechat_printf (xfer->buffer, - _("Connected to %s (%d.%d.%d.%d) via " - "xfer chat"), - xfer->remote_nick, - xfer->address >> 24, - (xfer->address >> 16) & 0xff, - (xfer->address >> 8) & 0xff, - xfer->address & 0xff); + + if (buffer_created) + { + weechat_buffer_set (xfer->buffer, "title", _("xfer chat")); + weechat_buffer_set (xfer->buffer, "short_name", xfer->remote_nick); + weechat_buffer_set (xfer->buffer, "localvar_set_type", "private"); + weechat_buffer_set (xfer->buffer, "localvar_set_nick", xfer->local_nick); + weechat_buffer_set (xfer->buffer, "localvar_set_channel", xfer->remote_nick); + weechat_buffer_set (xfer->buffer, "highlight_words_add", "$nick"); + weechat_printf (xfer->buffer, + _("Connected to %s (%d.%d.%d.%d) via " + "xfer chat"), + xfer->remote_nick, + xfer->address >> 24, + (xfer->address >> 16) & 0xff, + (xfer->address >> 8) & 0xff, + xfer->address & 0xff); + } free (name); } |