1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

irc: add IRC message tags in messages displayed (closes #1680)

This commit is contained in:
Sébastien Helleu
2021-12-30 21:11:22 +01:00
parent 5c6fc8c4bd
commit b66298d369
9 changed files with 305 additions and 160 deletions
+1
View File
@@ -1442,6 +1442,7 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
irc_protocol_tags (
"nick_back",
NULL,
NULL,
(nick) ? nick->name : NULL,
(nick) ? nick->host : NULL),
_("%s%s%s %s(%s%s%s)%s is back on server"),
+3
View File
@@ -915,6 +915,7 @@ irc_command_me_channel_display (struct t_irc_server *server,
channel->buffer,
0,
irc_protocol_tags ("privmsg",
NULL,
"irc_action,self_msg,notify_none,no_highlight",
server->nick, NULL),
"%s%s%s%s%s%s%s",
@@ -1746,6 +1747,7 @@ IRC_COMMAND_CALLBACK(ctcp)
ptr_server, ctcp_target, NULL, "ctcp", NULL),
0,
irc_protocol_tags ("privmsg",
NULL,
"irc_ctcp,self_msg,notify_none,no_highlight",
NULL, NULL),
_("%sCTCP query to %s%s%s: %s%s%s%s%s"),
@@ -3579,6 +3581,7 @@ IRC_COMMAND_CALLBACK(msg)
0,
irc_protocol_tags (
"privmsg",
NULL,
"self_msg,notify_none,no_highlight",
ptr_server->nick, NULL),
"%sMSG%s(%s%s%s)%s: %s",
+29 -17
View File
@@ -111,6 +111,7 @@ irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
void
irc_ctcp_display_request (struct t_irc_server *server,
time_t date,
struct t_hashtable *tags,
const char *command,
struct t_irc_channel *channel,
const char *nick,
@@ -129,7 +130,7 @@ irc_ctcp_display_request (struct t_irc_server *server,
server, nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
irc_protocol_tags (command, tags, "irc_ctcp", NULL, address),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
@@ -149,6 +150,7 @@ irc_ctcp_display_request (struct t_irc_server *server,
void
irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
struct t_hashtable *tags,
const char *command, const char *nick,
const char *address, const char *arguments)
{
@@ -196,7 +198,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp", NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, NULL),
irc_protocol_tags (command, tags, "irc_ctcp", NULL, NULL),
/* TRANSLATORS: %.3fs is a float number + "s" ("seconds") */
_("%sCTCP reply from %s%s%s: %s%s%s %.3fs"),
weechat_prefix ("network"),
@@ -215,7 +217,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp", NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
irc_protocol_tags (command, tags, "irc_ctcp", NULL, address),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
@@ -234,7 +236,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp", NULL),
date,
irc_protocol_tags (command, NULL, NULL, address),
irc_protocol_tags (command, tags, NULL, NULL, address),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
@@ -259,9 +261,11 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
void
irc_ctcp_reply_to_nick (struct t_irc_server *server,
struct t_hashtable *tags,
const char *command,
struct t_irc_channel *channel,
const char *nick, const char *ctcp,
const char *nick,
const char *ctcp,
const char *arguments)
{
struct t_hashtable *hashtable;
@@ -307,6 +311,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
0,
irc_protocol_tags (
command,
tags,
"irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"no_highlight",
NULL, NULL),
@@ -994,7 +999,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, const char *command,
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,
const char *arguments, const char *message)
@@ -1056,6 +1062,7 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
date,
irc_protocol_tags (
command,
tags,
(nick_is_me) ?
"irc_action,self_msg,notify_none,no_highlight" :
"irc_action,notify_message",
@@ -1098,6 +1105,7 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
date,
irc_protocol_tags (
command,
tags,
(nick_is_me) ?
"irc_action,self_msg,notify_none,no_highlight" :
"irc_action,notify_private",
@@ -1120,8 +1128,9 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
else if (weechat_strcasecmp (ptr_args + 1, "PING") == 0)
{
reply = irc_ctcp_get_reply (server, ptr_args + 1);
irc_ctcp_display_request (server, date, command, channel, nick,
address, ptr_args + 1, pos_args, reply);
irc_ctcp_display_request (server, date, tags, command, channel,
nick, address, ptr_args + 1, pos_args,
reply);
if (!reply || reply[0])
{
if (reply)
@@ -1129,15 +1138,16 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
decoded_reply = irc_ctcp_replace_variables (server, reply);
if (decoded_reply)
{
irc_ctcp_reply_to_nick (server, command, channel, nick,
ptr_args + 1, decoded_reply);
irc_ctcp_reply_to_nick (server, tags, command, channel,
nick, ptr_args + 1,
decoded_reply);
free (decoded_reply);
}
}
else
{
irc_ctcp_reply_to_nick (server, command, channel, nick,
ptr_args + 1, pos_args);
irc_ctcp_reply_to_nick (server, tags, command, channel,
nick, ptr_args + 1, pos_args);
}
}
}
@@ -1152,8 +1162,8 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
reply = irc_ctcp_get_reply (server, ptr_args + 1);
if (reply)
{
irc_ctcp_display_request (server, date, command, channel, nick,
address, ptr_args + 1, pos_args,
irc_ctcp_display_request (server, date, tags, command, channel,
nick, address, ptr_args + 1, pos_args,
reply);
if (reply[0])
@@ -1161,8 +1171,9 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
decoded_reply = irc_ctcp_replace_variables (server, reply);
if (decoded_reply)
{
irc_ctcp_reply_to_nick (server, command, channel, nick,
ptr_args + 1, decoded_reply);
irc_ctcp_reply_to_nick (server, tags, command, channel,
nick, ptr_args + 1,
decoded_reply);
free (decoded_reply);
}
}
@@ -1176,7 +1187,8 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
server, nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
irc_protocol_tags (command, tags, "irc_ctcp", NULL,
address),
_("%sUnknown CTCP requested by %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
+3 -1
View File
@@ -36,6 +36,7 @@ extern const char *irc_ctcp_get_reply (struct t_irc_server *server,
const char *ctcp);
extern void irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
time_t date,
struct t_hashtable *tags,
const char *command,
const char *nick,
const char *address,
@@ -43,7 +44,8 @@ extern void irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
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,
const char *command, struct t_irc_channel *channel,
struct t_hashtable *tags, const char *command,
struct t_irc_channel *channel,
const char *address, const char *nick,
const char *remote_nick, const char *arguments,
const char *message);
+6 -2
View File
@@ -102,7 +102,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
buffer,
0,
irc_protocol_tags (
"privmsg", str_tags,
"privmsg",
NULL,
str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
NULL),
"%s%s%s%s%s %s",
@@ -119,7 +121,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
buffer,
0,
irc_protocol_tags (
"privmsg", str_tags,
"privmsg",
NULL,
str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
NULL),
"%s%s",
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -93,8 +93,11 @@ struct t_irc_protocol_msg
t_irc_recv_func *recv_function; /* function called when msg is received */
};
extern const char *irc_protocol_tags (const char *command, const char *tags,
const char *nick, const char *address);
extern const char *irc_protocol_tags (const char *command,
struct t_hashtable *irc_msg_tags,
const char *extra_tags,
const char *nick,
const char *address);
extern time_t irc_protocol_parse_time (const char *time);
extern void irc_protocol_recv_command (struct t_irc_server *server,
const char *irc_message,