summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-25 19:25:01 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-25 19:25:01 +0200
commit809f59dfd1afabbd9f6728f5eddbcec0e92ce697 (patch)
tree8d8c33e9613e487f191d68309477840afc3e0d1d /src
parent45fb1ae4bae31abed6e95f11c7cd6f5b9e935680 (diff)
downloadweechat-809f59dfd1afabbd9f6728f5eddbcec0e92ce697.zip
irc: hide messages sent with `/msg` to a nick when capability "echo-message" is enabled (issue #139)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-command.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index dc67c030b..c7a21f9e9 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -3794,29 +3794,38 @@ IRC_COMMAND_CALLBACK(msg)
}
else
{
- string = irc_color_decode (
- argv_eol[arg_text],
- weechat_config_boolean (irc_config_network_colors_send));
- weechat_printf_date_tags (
- ptr_server->buffer,
- 0,
- irc_protocol_tags (
- ptr_server,
- "privmsg",
- NULL,
- "self_msg,notify_none,no_highlight",
- ptr_server->nick, NULL),
- "%sMSG%s(%s%s%s)%s: %s",
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_DELIMITERS,
- irc_nick_color_for_msg (
- ptr_server, 0, NULL, targets[i]),
- targets[i],
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_RESET,
- (string) ? string : argv_eol[arg_text]);
- if (string)
- free (string);
+ /*
+ * display message only if capability "echo-message"
+ * is NOT enabled
+ */
+ if (!weechat_hashtable_has_key (ptr_server->cap_list,
+ "echo-message"))
+ {
+ string = irc_color_decode (
+ argv_eol[arg_text],
+ weechat_config_boolean (
+ irc_config_network_colors_send));
+ weechat_printf_date_tags (
+ ptr_server->buffer,
+ 0,
+ irc_protocol_tags (
+ ptr_server,
+ "privmsg",
+ NULL,
+ "self_msg,notify_none,no_highlight",
+ ptr_server->nick, NULL),
+ "%sMSG%s(%s%s%s)%s: %s",
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_DELIMITERS,
+ irc_nick_color_for_msg (
+ ptr_server, 0, NULL, targets[i]),
+ targets[i],
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_RESET,
+ (string) ? string : argv_eol[arg_text]);
+ if (string)
+ free (string);
+ }
}
}
irc_server_sendf (ptr_server,