summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-channel.c3
-rw-r--r--src/plugins/irc/irc-command.c2
-rw-r--r--src/plugins/irc/irc-server.c11
3 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 2c015ed57..0d2debba5 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -97,6 +97,9 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
}
weechat_buffer_set (new_buffer, "short_name", channel_name);
+ weechat_buffer_set (new_buffer, "localvar_set_nick", server->nick);
+ weechat_buffer_set (new_buffer, "localvar_set_server", server->name);
+ weechat_buffer_set (new_buffer, "localvar_set_channel", channel_name);
weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index c962ba206..a8892592f 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -3138,6 +3138,8 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
}
weechat_buffer_set (irc_current_server->buffer, "short_name",
irc_current_server->name);
+ weechat_buffer_set (irc_current_server->buffer, "localvar_set_server",
+ irc_current_server->name);
weechat_bar_item_update ("buffer_name");
weechat_bar_item_update ("input_prompt");
return WEECHAT_RC_OK;
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 998856a5e..4f9ea7916 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -300,12 +300,22 @@ irc_server_set_with_option (struct t_irc_server *server,
void
irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
+ struct t_irc_channel *ptr_channel;
+
if (server->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, "localvar_set_nick", nick);
+ }
+
weechat_bar_item_update ("input_prompt");
}
@@ -2180,6 +2190,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
}
weechat_buffer_set (server->buffer, "short_name", server->name);
+ weechat_buffer_set (server->buffer, "localvar_set_server", server->name);
weechat_buffer_set (server->buffer, "display", "1");