From 35d6c43f85833b235cab22f7565669c46409cc84 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 27 Mar 2004 15:09:36 +0000 Subject: [PATCH] Fixed bug when opened private win and remote user changes his nick --- ChangeLog | 5 +++-- src/irc/irc-recv.c | 17 +++++++++++++++++ weechat/ChangeLog | 5 +++-- weechat/src/irc/irc-recv.c | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1b5e9f00..5b2e2dee3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2004-03-20 +ChangeLog - 2004-03-27 Version 0.0.6 (under dev!): - * command /query added (starts private conversation) + * fixed bug when opened private win and remote user changes his nick + * /query command added (starts private conversation) * IRC messages 476, 477 added * /mode command is now ok and channel flags are displayed in status bar * fixed display bug (text was blinking when scrolling) diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index 004dfe3a1..6239b5ebc 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -602,6 +602,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) t_irc_channel *ptr_channel; t_irc_nick *ptr_nick; int nick_is_me; + t_gui_window *ptr_window; /* no host => we can't identify sender of message! */ if (host == NULL) @@ -623,6 +624,21 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) ptr_nick = nick_search (ptr_channel, host); if (ptr_nick) { + /* change nickname in any opened private window */ + for (ptr_window = gui_windows; ptr_window; + ptr_window = ptr_window->next_window) + { + if ((SERVER(ptr_window) == server) && WIN_IS_PRIVATE(ptr_window)) + { + if (CHANNEL(ptr_window)->name) + { + free (CHANNEL(ptr_window)->name); + CHANNEL(ptr_window)->name = strdup (arguments); + } + } + } + + /* change nickname on channel */ nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0; nick_change (ptr_channel, ptr_nick, arguments); irc_display_prefix (ptr_channel->window, PREFIX_INFO); @@ -655,6 +671,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) free (server->nick); server->nick = strdup (arguments); } + gui_redraw_window_status (gui_current_window); gui_redraw_window_input (gui_current_window); return 0; diff --git a/weechat/ChangeLog b/weechat/ChangeLog index c1b5e9f00..5b2e2dee3 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,11 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2004-03-20 +ChangeLog - 2004-03-27 Version 0.0.6 (under dev!): - * command /query added (starts private conversation) + * fixed bug when opened private win and remote user changes his nick + * /query command added (starts private conversation) * IRC messages 476, 477 added * /mode command is now ok and channel flags are displayed in status bar * fixed display bug (text was blinking when scrolling) diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c index 004dfe3a1..6239b5ebc 100644 --- a/weechat/src/irc/irc-recv.c +++ b/weechat/src/irc/irc-recv.c @@ -602,6 +602,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) t_irc_channel *ptr_channel; t_irc_nick *ptr_nick; int nick_is_me; + t_gui_window *ptr_window; /* no host => we can't identify sender of message! */ if (host == NULL) @@ -623,6 +624,21 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) ptr_nick = nick_search (ptr_channel, host); if (ptr_nick) { + /* change nickname in any opened private window */ + for (ptr_window = gui_windows; ptr_window; + ptr_window = ptr_window->next_window) + { + if ((SERVER(ptr_window) == server) && WIN_IS_PRIVATE(ptr_window)) + { + if (CHANNEL(ptr_window)->name) + { + free (CHANNEL(ptr_window)->name); + CHANNEL(ptr_window)->name = strdup (arguments); + } + } + } + + /* change nickname on channel */ nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0; nick_change (ptr_channel, ptr_nick, arguments); irc_display_prefix (ptr_channel->window, PREFIX_INFO); @@ -655,6 +671,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) free (server->nick); server->nick = strdup (arguments); } + gui_redraw_window_status (gui_current_window); gui_redraw_window_input (gui_current_window); return 0;