diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-11-08 20:16:45 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-11-08 20:16:45 +0100 |
commit | fed54c196ebfcab1d05e37ab0a730663fd1aff04 (patch) | |
tree | 2a3589348709270e11fdc51725c09e2375d7dc89 /src/plugins/irc | |
parent | d478526b085306891d2d2d258a8ca27f7f407a6c (diff) | |
download | weechat-fed54c196ebfcab1d05e37ab0a730663fd1aff04.zip |
Update buffer local variables when irc server is renamed
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-server.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 09fd5de2d..30656a094 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1211,6 +1211,7 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name) { int length; char *mask, *pos_option, *new_option_name, *buffer_name; + char charset_modifier[256]; const char *option_name; struct t_infolist *infolist; struct t_config_option *ptr_option; @@ -1263,7 +1264,7 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name) free (server->name); server->name = strdup (new_server_name); - /* change name for buffers with this server */ + /* change name and local variables on buffers */ for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { @@ -1271,12 +1272,22 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name) { buffer_name = irc_buffer_build_name (server->name, ptr_channel->name); weechat_buffer_set (ptr_channel->buffer, "name", buffer_name); + weechat_buffer_set (ptr_channel->buffer, "localvar_set_server", + server->name); } } if (server->buffer) { buffer_name = irc_buffer_build_name (server->name, NULL); weechat_buffer_set (server->buffer, "name", buffer_name); + weechat_buffer_set (server->buffer, "localvar_set_server", + server->name); + weechat_buffer_set (server->buffer, "localvar_set_channel", + server->name); + snprintf (charset_modifier, sizeof (charset_modifier), + "irc.%s", server->name); + weechat_buffer_set (server->buffer, "localvar_set_charset_modifier", + charset_modifier); } return 1; |