1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 01:03:14 +02:00

irc: display STATUSMSG actions differently from standard actions on channels (closes #1577, issue #139)

This commit is contained in:
Sébastien Helleu
2023-05-27 09:32:52 +02:00
parent 93d447ffc7
commit 0babf5db23
20 changed files with 251 additions and 158 deletions
+8 -5
View File
@@ -1850,6 +1850,7 @@ IRC_COMMAND_CALLBACK(connect)
IRC_COMMAND_CALLBACK(ctcp)
{
struct t_irc_channel *ptr_channel_target;
char **targets, *ctcp_type, str_time[512];
const char *ctcp_target, *ctcp_args;
int num_targets, arg_target, arg_type, arg_args, i;
@@ -1932,12 +1933,14 @@ 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_channel_target = irc_channel_search (
ptr_server,
irc_channel_search (ptr_server, ctcp_target),
ctcp_target,
ctcp_type,
ctcp_args);
(irc_server_prefix_char_statusmsg (ptr_server,
ctcp_target[0])
&& irc_channel_is_channel (ptr_server, ctcp_target + 1)) ?
ctcp_target + 1 : ctcp_target);
irc_ctcp_display_send (ptr_server, ptr_channel_target,
ctcp_target, ctcp_type, ctcp_args);
}
irc_ctcp_send (ptr_server, ctcp_target, ctcp_type, ctcp_args);
}
+107 -38
View File
@@ -1042,8 +1042,8 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
void
irc_ctcp_recv (struct t_irc_server *server, time_t date,
struct t_hashtable *tags, const char *command,
struct t_irc_channel *channel, const char *address,
const char *nick, const char *remote_nick,
struct t_irc_channel *channel, const char *target,
const char *address, const char *nick, const char *remote_nick,
const char *arguments, const char *message)
{
char *dup_arguments, *ptr_args, *pos_end, *pos_space, *pos_args;
@@ -1098,25 +1098,59 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date,
nick_color = irc_nick_find_color (nick);
else
nick_color = strdup (IRC_COLOR_CHAT_NICK);
weechat_printf_date_tags (
channel->buffer,
date,
irc_protocol_tags (
server,
command,
tags,
(nick_is_me) ?
"irc_action,self_msg,notify_none,no_highlight" :
"irc_action,notify_message",
nick, address),
"%s%s%s%s%s%s%s",
weechat_prefix ("action"),
irc_nick_mode_for_display (server, ptr_nick, 0),
nick_color,
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
if (irc_server_prefix_char_statusmsg (server, target[0]))
{
/* STATUSMSG action */
weechat_printf_date_tags (
channel->buffer,
date,
irc_protocol_tags (
server,
command,
tags,
(nick_is_me) ?
"irc_action,self_msg,notify_none,no_highlight" :
"irc_action,notify_message",
nick,
address),
"%s%s -> %s%s%s: %s%s%s%s%s%s",
weechat_prefix ("network"),
/* TRANSLATORS: "Action" is an IRC CTCP "ACTION" sent with /me */
_("Action"),
IRC_COLOR_CHAT_CHANNEL,
target,
IRC_COLOR_RESET,
irc_nick_mode_for_display (server, ptr_nick, 0),
nick_color,
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
else
{
/* standard action */
weechat_printf_date_tags (
channel->buffer,
date,
irc_protocol_tags (
server,
command,
tags,
(nick_is_me) ?
"irc_action,self_msg,notify_none,no_highlight" :
"irc_action,notify_message",
nick,
address),
"%s%s%s%s%s%s%s",
weechat_prefix ("action"),
irc_nick_mode_for_display (server, ptr_nick, 0),
nick_color,
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
if (nick_color)
free (nick_color);
}
@@ -1265,25 +1299,60 @@ irc_ctcp_display_send (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *target, const char *type, const char *args)
{
struct t_irc_nick *ptr_nick;
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",
server->nick, 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 : "");
if (channel
&& irc_server_prefix_char_statusmsg (server, target[0]))
{
/* STATUSMSG action */
ptr_nick = irc_nick_search (server, channel, server->nick);
weechat_printf_date_tags (
channel->buffer,
0,
irc_protocol_tags (
server,
"privmsg",
NULL,
"irc_action,self_msg,notify_none,no_highlight",
server->nick,
NULL),
"%s%s -> %s%s%s: %s%s%s%s %s",
weechat_prefix ("network"),
/* TRANSLATORS: "Action" is an IRC CTCP "ACTION" sent with /me */
_("Action"),
IRC_COLOR_CHAT_CHANNEL,
target,
IRC_COLOR_RESET,
irc_nick_mode_for_display (server, ptr_nick, 0),
IRC_COLOR_CHAT_NICK_SELF,
server->nick,
IRC_COLOR_RESET,
args);
}
else
{
/* standard action */
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",
server->nick,
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
{
+1 -1
View File
@@ -45,7 +45,7 @@ extern char *irc_ctcp_replace_variables (struct t_irc_server *server,
const char *format);
extern void irc_ctcp_recv (struct t_irc_server *server, time_t date,
struct t_hashtable *tags, const char *command,
struct t_irc_channel *channel,
struct t_irc_channel *channel, const char *target,
const char *address, const char *nick,
const char *remote_nick, const char *arguments,
const char *message);
+3 -2
View File
@@ -3059,7 +3059,8 @@ IRC_PROTOCOL_CALLBACK(privmsg)
else
{
irc_ctcp_recv (server, date, tags, command, ptr_channel,
address, nick, NULL, msg_args, irc_message);
params[0], address, nick, NULL, msg_args,
irc_message);
}
goto end;
}
@@ -3165,7 +3166,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
else
{
irc_ctcp_recv (server, date, tags, command, NULL,
irc_ctcp_recv (server, date, tags, command, NULL, params[0],
address, nick, remote_nick, msg_args, irc_message);
}
goto end;