diff --git a/ChangeLog.adoc b/ChangeLog.adoc index c801da7ed..f59d934ef 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -75,6 +75,7 @@ Bug fixes:: * irc: update autojoin option with redirected channels when autojoin_dynamic is enabled (issue #1898) * irc: don't switch to buffer of joined channel if it was not manually joined nor present in server autojoin option * irc: fix target buffer for commands 432/433 (erroneous nickname/nickname already in use) when the nickname looks like a channel + * irc: display command 437 on server buffer when nickname cannot change while banned on channel (issue #88) * irc: add messages 415 (cannot send message to channel) and 742 (mode cannot be set) * lua: fix crash with print when the value to print is not a string (issue #1904, issue #1905) * ruby: fix crash on quit when a child process is still running (issue #1889, issue #1915) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 6da8efce4..73424482a 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1511,7 +1511,7 @@ IRC_PROTOCOL_CALLBACK(error) IRC_PROTOCOL_CALLBACK(generic_error) { - int arg_error; + int arg_error, force_server_buffer; char *str_error, str_target[512]; const char *pos_channel, *pos_nick; struct t_irc_channel *ptr_channel; @@ -1529,8 +1529,16 @@ IRC_PROTOCOL_CALLBACK(generic_error) if (params[arg_error + 1]) { - if ((strcmp (command, "432") != 0) - && (strcmp (command, "433") != 0) + /* + * force display on server buffer for these messages: + * - 432: erroneous nickname + * - 433: nickname already in use + * - 437: nick/channel temporarily unavailable + */ + force_server_buffer = ((strcmp (command, "432") == 0) + || (strcmp (command, "433") == 0) + || (strcmp (command, "437") == 0)); + if (!force_server_buffer && irc_channel_is_channel (server, params[arg_error])) { pos_channel = params[arg_error]; diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 4bde26ec8..c99ef13bb 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -4289,7 +4289,7 @@ TEST(IrcProtocolWithServer, 437_not_connected) TEST(IrcProtocolWithServer, 437_connected) { - SRV_INIT; + SRV_INIT_JOIN; /* not enough parameters */ RECV(":server 437"); @@ -4303,6 +4303,8 @@ TEST(IrcProtocolWithServer, 437_connected) CHECK_SRV("-- * alice error"); RECV(":server 437 * alice :Nick/channel is temporarily unavailable"); CHECK_SRV("-- * alice Nick/channel is temporarily unavailable"); + RECV(":server 437 alice #test :Cannot change nickname while banned on channel"); + CHECK_SRV("-- #test: Cannot change nickname while banned on channel"); } /*