diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-25 22:34:03 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-25 22:34:03 +0200 |
commit | e50be16730245e2ef5891ac4fc73ef38a34eadf6 (patch) | |
tree | beee1e210ae9578b7bb7367f6a81c7fe3f406577 /src/plugins/irc | |
parent | d9789e522fd6120c7140a6d970503cc6433a6851 (diff) | |
download | weechat-e50be16730245e2ef5891ac4fc73ef38a34eadf6.zip |
irc: fix display of actions sent with `/me` (issue #139)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-command.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-ctcp.c | 65 | ||||
-rw-r--r-- | src/plugins/irc/irc-ctcp.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 11 |
4 files changed, 53 insertions, 26 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 4b4bf607c..9d9285206 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1913,7 +1913,7 @@ IRC_COMMAND_CALLBACK(ctcp) /* display message only if capability "echo-message" is NOT enabled */ if (!weechat_hashtable_has_key (ptr_server->cap_list, "echo-message")) { - irc_ctcp_display_send (ptr_server, ctcp_target, ctcp_type, + irc_ctcp_display_send (ptr_server, NULL, ctcp_target, ctcp_type, ctcp_args); } irc_ctcp_send (ptr_server, ctcp_target, ctcp_type, ctcp_args); diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 5026dee14..b086e4f2f 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -1262,28 +1262,53 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, void irc_ctcp_display_send (struct t_irc_server *server, + struct t_irc_channel *channel, const char *target, const char *type, const char *args) { - weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer ( - server, target, NULL, "ctcp", NULL), - 0, - irc_protocol_tags ( - server, - "privmsg", - NULL, - "irc_ctcp,self_msg,notify_none,no_highlight", - NULL, NULL), - _("%sCTCP query to %s%s%s: %s%s%s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (server, 0, NULL, target), - target, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - type, - IRC_COLOR_RESET, - (args && args[0]) ? " " : "", - (args && args[0]) ? args : ""); + if (weechat_strcasecmp (type, "action") == 0) + { + weechat_printf_date_tags ( + (channel) ? channel->buffer : irc_msgbuffer_get_target_buffer ( + server, target, NULL, "ctcp", NULL), + 0, + irc_protocol_tags ( + server, + "privmsg", + NULL, + "irc_action,self_msg,notify_none,no_highlight", + NULL, NULL), + "%s%s%s%s%s%s", + weechat_prefix ("action"), + IRC_COLOR_CHAT_NICK_SELF, + server->nick, + (args && args[0]) ? IRC_COLOR_RESET : "", + (args && args[0]) ? " " : "", + (args && args[0]) ? args : ""); + } + else + { + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, target, NULL, "ctcp", NULL), + 0, + irc_protocol_tags ( + server, + "privmsg", + NULL, + "irc_ctcp,self_msg,notify_none,no_highlight", + NULL, NULL), + _("%sCTCP query to %s%s%s: %s%s%s%s%s"), + weechat_prefix ("network"), + (channel) ? + IRC_COLOR_CHAT_CHANNEL : irc_nick_color_for_msg (server, 0, NULL, target), + target, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + type, + IRC_COLOR_RESET, + (args && args[0]) ? " " : "", + (args && args[0]) ? args : ""); + } } /* diff --git a/src/plugins/irc/irc-ctcp.h b/src/plugins/irc/irc-ctcp.h index beafb1c45..e02d91ea6 100644 --- a/src/plugins/irc/irc-ctcp.h +++ b/src/plugins/irc/irc-ctcp.h @@ -50,6 +50,7 @@ extern void irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *remote_nick, const char *arguments, const char *message); extern void irc_ctcp_display_send (struct t_irc_server *server, + struct t_irc_channel *channel, const char *target, const char *type, const char *args); extern void irc_ctcp_send (struct t_irc_server *server, diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 56f63ba2a..2e27722e3 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2959,6 +2959,7 @@ IRC_PROTOCOL_CALLBACK(pong) void irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server, + struct t_irc_channel *channel, const char *target, const char *arguments) { @@ -2981,7 +2982,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server, ctcp_args = (pos_space) ? weechat_strndup (pos_space + 1, pos_end - pos_space - 1) : NULL; - irc_ctcp_display_send (server, target, ctcp_type, ctcp_args); + irc_ctcp_display_send (server, channel, target, ctcp_type, ctcp_args); if (ctcp_type) free (ctcp_type); @@ -3052,8 +3053,8 @@ IRC_PROTOCOL_CALLBACK(privmsg) { if (nick_is_me) { - irc_protocol_privmsg_display_ctcp_send (server, pos_target, - msg_args); + irc_protocol_privmsg_display_ctcp_send ( + server, ptr_channel, pos_target, msg_args); } else { @@ -3156,8 +3157,8 @@ IRC_PROTOCOL_CALLBACK(privmsg) { if (nick_is_me) { - irc_protocol_privmsg_display_ctcp_send (server, remote_nick, - msg_args); + irc_protocol_privmsg_display_ctcp_send ( + server, NULL, remote_nick, msg_args); } else { |