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

irc: add tag "new_host_xxx" in message displayed for command CHGHOST (closes #1808)

This commit is contained in:
Sébastien Helleu
2023-06-04 09:45:47 +02:00
parent 7f4c3a660a
commit e04d8894a0
3 changed files with 20 additions and 15 deletions
+1
View File
@@ -63,6 +63,7 @@ New features::
* irc: add `${username}` in server options "nicks" and "username", change their default values to use it
* irc: add infos "irc_server_cap" and "irc_server_cap_value"
* irc: add option irc.look.display_host_notice
* irc: add tag "new_host_xxx" in message displayed for command CHGHOST (issue #1808)
* logger: add option logger.file.log_conditions (issue #1942)
* logger: add info "logger_log_file"
* relay: rename "ssl" options and protocol to "tls"
+12 -10
View File
@@ -1367,7 +1367,7 @@ IRC_PROTOCOL_CALLBACK(cap)
IRC_PROTOCOL_CALLBACK(chghost)
{
int length, local_chghost, smart_filter;
char *str_host;
char *str_host, str_tags[512];
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
@@ -1402,12 +1402,14 @@ IRC_PROTOCOL_CALLBACK(chghost)
&& (irc_server_strcasecmp (server,
ptr_channel->name, nick) == 0))
{
snprintf (str_tags, sizeof (str_tags),
"new_host_%s", str_host);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (server, command, tags, NULL, nick,
address),
irc_protocol_tags (server, command, tags, str_tags,
nick, address),
_("%s%s%s%s (%s%s%s)%s has changed host to %s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 1, NULL, nick),
@@ -1434,17 +1436,17 @@ IRC_PROTOCOL_CALLBACK(chghost)
&& weechat_config_boolean (irc_config_look_smart_filter)
&& weechat_config_boolean (irc_config_look_smart_filter_chghost)
&& !ptr_nick_speaking);
snprintf (str_tags, sizeof (str_tags),
"new_host_%s%s%s",
str_host,
(smart_filter) ? "," : "",
(smart_filter) ? "irc_smart_filter" : "");
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (
server,
command,
tags,
(smart_filter) ? "irc_smart_filter" : NULL,
nick, address),
irc_protocol_tags (server, command, tags, str_tags,
nick, address),
_("%s%s%s%s (%s%s%s)%s has changed host to %s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
+7 -5
View File
@@ -1822,29 +1822,31 @@ TEST(IrcProtocolWithServer, chghost)
/* self nick */
RECV(":alice!user@host CHGHOST user2 host2");
CHECK_CHAN("--", "alice (user@host) has changed host to user2@host2",
"irc_chghost,nick_alice,host_user@host,log3");
"irc_chghost,new_host_user2@host2,nick_alice,host_user@host,log3");
STRCMP_EQUAL("user2@host2", ptr_nick->host);
RECV(":alice!user@host CHGHOST user2 host2");
CHECK_CHAN("--", "alice (user@host) has changed host to user2@host2",
"irc_chghost,nick_alice,host_user@host,log3");
"irc_chghost,new_host_user2@host2,nick_alice,host_user@host,log3");
STRCMP_EQUAL("user2@host2", ptr_nick->host);
RECV(":alice!user2@host2 CHGHOST user3 :host3");
CHECK_CHAN("--", "alice (user2@host2) has changed host to user3@host3",
"irc_chghost,nick_alice,host_user2@host2,log3");
"irc_chghost,new_host_user3@host3,nick_alice,host_user2@host2,log3");
STRCMP_EQUAL("user3@host3", ptr_nick->host);
/* another nick */
RECV(":bob!user@host CHGHOST user_bob_2 host_bob_2");
CHECK_CHAN("--",
"bob (user@host) has changed host to user_bob_2@host_bob_2",
"irc_chghost,irc_smart_filter,nick_bob,host_user@host,log3");
"irc_chghost,new_host_user_bob_2@host_bob_2,irc_smart_filter,"
"nick_bob,host_user@host,log3");
STRCMP_EQUAL("user_bob_2@host_bob_2", ptr_nick2->host);
CHECK_PV("bob",
"--",
"bob (user@host) has changed host to user_bob_2@host_bob_2",
"irc_chghost,nick_bob,host_user@host,log3");
"irc_chghost,new_host_user_bob_2@host_bob_2,nick_bob,"
"host_user@host,log3");
}
/*