1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 17:23:15 +02:00

irc: fix display of PART messages on channels with +a (anonymous flag) (closes #396)

The purpose of the fix is to display any PART received on a channel,
even if the nick is not found in the channel's nicklist
(when channel is "+a", all PART are received from nick "anonymous").
This commit is contained in:
Sébastien Helleu
2015-04-13 07:56:06 +02:00
parent ed6e59f093
commit 55e2f258b7
2 changed files with 119 additions and 119 deletions
+2
View File
@@ -40,6 +40,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
config_option_reset, config_color, config_color_default, config_write,
config_read, config_reload, hook_command, buffer_string_replace_local_var,
command
* irc: fix display of PART messages on channels with +a (anonymous flag)
(closes #396)
* irc: remove useless rename of channel buffer on JOIN received with different
case (closes #336)
* irc: fix completion of commands /allchan and /allpv
+117 -119
View File
@@ -1549,135 +1549,133 @@ IRC_PROTOCOL_CALLBACK(part)
ptr_channel = irc_channel_search (server,
(argv[2][0] == ':') ? argv[2] + 1 : argv[2]);
if (ptr_channel)
if (!ptr_channel)
return WEECHAT_RC_OK;
ptr_nick = irc_nick_search (server, ptr_channel, nick);
local_part = (irc_server_strcasecmp (server, nick, server->nick) == 0);
/* display part message */
if (!ignored)
{
ptr_nick = irc_nick_search (server, ptr_channel, nick);
if (ptr_nick)
ptr_nick_speaking = NULL;
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
local_part = (irc_server_strcasecmp (server, nick, server->nick) == 0);
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
&& (weechat_config_boolean (irc_config_look_smart_filter_quit))) ?
irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL;
}
display_host = weechat_config_boolean (irc_config_look_display_host_quit);
if (pos_comment)
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (command,
(local_part
|| (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| !weechat_config_boolean (irc_config_look_smart_filter_quit)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter",
nick, address),
_("%s%s%s%s%s%s%s%s%s%s has left %s%s%s %s(%s%s%s)"),
weechat_prefix ("quit"),
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? " (" : "",
IRC_COLOR_CHAT_HOST,
(display_host) ? address : "",
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? ")" : "",
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_CHANNEL,
ptr_channel->name,
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_REASON_QUIT,
pos_comment,
IRC_COLOR_CHAT_DELIMITERS);
}
else
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (command,
(local_part
|| (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| !weechat_config_boolean (irc_config_look_smart_filter_quit)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter",
nick, address),
_("%s%s%s%s%s%s%s%s%s%s has left %s%s%s"),
weechat_prefix ("quit"),
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? " (" : "",
IRC_COLOR_CHAT_HOST,
(display_host) ? address : "",
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? ")" : "",
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_CHANNEL,
ptr_channel->name,
IRC_COLOR_MESSAGE_QUIT);
}
}
/* display part message */
if (!ignored)
/* part request was issued by local client ? */
if (local_part)
{
irc_nick_free_all (server, ptr_channel);
/* cycling ? => rejoin channel immediately */
if (ptr_channel->cycle)
{
ptr_channel->cycle = 0;
if (ptr_channel->key)
{
ptr_nick_speaking = NULL;
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
join_length = strlen (ptr_channel->name) + 1 +
strlen (ptr_channel->key) + 1;
join_string = malloc (join_length);
if (join_string)
{
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
&& (weechat_config_boolean (irc_config_look_smart_filter_quit))) ?
irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL;
}
display_host = weechat_config_boolean (irc_config_look_display_host_quit);
if (pos_comment)
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (command,
(local_part
|| (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| !weechat_config_boolean (irc_config_look_smart_filter_quit)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter",
nick, address),
_("%s%s%s%s%s%s%s%s%s%s has left %s%s%s %s(%s%s%s)"),
weechat_prefix ("quit"),
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? " (" : "",
IRC_COLOR_CHAT_HOST,
(display_host) ? address : "",
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? ")" : "",
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_CHANNEL,
ptr_channel->name,
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_REASON_QUIT,
pos_comment,
IRC_COLOR_CHAT_DELIMITERS);
snprintf (join_string, join_length, "%s %s",
ptr_channel->name,
ptr_channel->key);
irc_command_join_server (server, join_string, 1, 1);
free (join_string);
}
else
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (command,
(local_part
|| (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| !weechat_config_boolean (irc_config_look_smart_filter_quit)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter",
nick, address),
_("%s%s%s%s%s%s%s%s%s%s has left %s%s%s"),
weechat_prefix ("quit"),
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? " (" : "",
IRC_COLOR_CHAT_HOST,
(display_host) ? address : "",
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? ")" : "",
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_CHANNEL,
ptr_channel->name,
IRC_COLOR_MESSAGE_QUIT);
}
}
/* part request was issued by local client ? */
if (local_part)
{
irc_nick_free_all (server, ptr_channel);
/* cycling ? => rejoin channel immediately */
if (ptr_channel->cycle)
{
ptr_channel->cycle = 0;
if (ptr_channel->key)
{
join_length = strlen (ptr_channel->name) + 1 +
strlen (ptr_channel->key) + 1;
join_string = malloc (join_length);
if (join_string)
{
snprintf (join_string, join_length, "%s %s",
ptr_channel->name,
ptr_channel->key);
irc_command_join_server (server, join_string, 1, 1);
free (join_string);
}
else
irc_command_join_server (server, ptr_channel->name,
1, 1);
}
else
irc_command_join_server (server, ptr_channel->name,
1, 1);
}
else
{
if (weechat_config_boolean (irc_config_look_part_closes_buffer))
weechat_buffer_close (ptr_channel->buffer);
else
ptr_channel->part = 1;
}
irc_bar_item_update_channel ();
irc_command_join_server (server, ptr_channel->name,
1, 1);
}
else
{
/* part from another user */
irc_channel_join_smart_filtered_remove (ptr_channel,
ptr_nick->name);
irc_nick_free (server, ptr_channel, ptr_nick);
}
irc_command_join_server (server, ptr_channel->name,
1, 1);
}
else
{
if (weechat_config_boolean (irc_config_look_part_closes_buffer))
weechat_buffer_close (ptr_channel->buffer);
else
ptr_channel->part = 1;
}
irc_bar_item_update_channel ();
}
else if (ptr_nick)
{
/* part from another user */
irc_channel_join_smart_filtered_remove (ptr_channel,
ptr_nick->name);
irc_nick_free (server, ptr_channel, ptr_nick);
}
return WEECHAT_RC_OK;