From 5a5e05eae9cfc037b82a2ece27d54419e71f534c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 6 Sep 2014 08:48:43 +0200 Subject: [PATCH] irc: display nick changes in server buffer (closes #188) --- ChangeLog.asciidoc | 1 + src/plugins/irc/irc-protocol.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 1ca02f6da..7b332f5f7 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -21,6 +21,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] weechat.look.command_incomplete (task #5419) * api: use microseconds instead of milliseconds in functions util_timeval_diff and util_timeval_add +* irc: display nick changes in server buffer (closes #188) * irc: disable creation of temporary servers by default with command /connect, new option irc.look.temporary_servers * trigger: add option "restore" in command /trigger diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 3c15d614d..928f7b5dd 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1055,6 +1055,33 @@ IRC_PROTOCOL_CALLBACK(nick) ptr_nick_found = NULL; + /* first display message in server buffer if it's local nick */ + if (local_nick) + { + /* temporary disable hotlist */ + weechat_buffer_set (NULL, "hotlist", "-"); + + snprintf (str_tags, sizeof (str_tags), + "irc_nick1_%s,irc_nick2_%s", + nick, + new_nick); + weechat_printf_date_tags (server->buffer, + date, + irc_protocol_tags (command, + str_tags, + NULL, + address), + _("%sYou are now known as " + "%s%s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK_SELF, + new_nick, + IRC_COLOR_RESET); + + /* enable hotlist */ + weechat_buffer_set (NULL, "hotlist", "+"); + } + for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { @@ -1094,7 +1121,7 @@ IRC_PROTOCOL_CALLBACK(nick) if (!ptr_nick->host) ptr_nick->host = strdup (address); - /* change nick and display message on all channels */ + /* change nick and display message on channel */ old_color = strdup (ptr_nick->color); irc_nick_change (server, ptr_channel, ptr_nick, new_nick); if (local_nick)