From 46cea77585720f38d197f8bb4f3159c0b3d63ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 13 Aug 2023 16:38:29 +0200 Subject: relay: synchronize nick modes with IRC client upon connection (closes #1984) --- src/plugins/relay/irc/relay-irc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index afe44ccc5..eaf37f407 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -1638,11 +1638,11 @@ relay_irc_recv (struct t_relay_client *client, const char *data) struct t_hashtable *hash_parsed, *hash_redirect; struct t_infolist *infolist_server; const char *irc_command, *str_num_params, *isupport, *pos_password; - const char *ptr_data; + const char *ptr_data, *ptr_nick_modes; char str_time[128], str_signal[128], str_server_channel[256], *nick; char str_param[128], *str_args, *version, str_command[128], **params; char *pos, *password, *irc_is_channel, *info, *error, *str_cmd_lower; - char modifier_data[128], *new_data, *ctcp_type, *ctcp_params; + char modifier_data[128], *new_data, *ctcp_type, *ctcp_params, *nick_modes; long num_params; int i, redirect_msg; @@ -1875,12 +1875,17 @@ relay_irc_recv (struct t_relay_client *client, const char *data) version); if (version) free (version); + nick_modes = NULL; infolist_server = weechat_infolist_get ("irc_server", NULL, client->protocol_args); if (infolist_server) { if (weechat_infolist_next (infolist_server)) { + ptr_nick_modes = weechat_infolist_string (infolist_server, + "nick_modes"); + if (ptr_nick_modes) + nick_modes = strdup (ptr_nick_modes); isupport = weechat_infolist_string (infolist_server, "isupport"); if (isupport && isupport[0]) @@ -1916,6 +1921,18 @@ relay_irc_recv (struct t_relay_client *client, const char *data) RELAY_IRC_DATA(client, address), RELAY_IRC_DATA(client, nick)); + /* send nick modes */ + if (nick_modes && nick_modes[0]) + { + relay_irc_sendf (client, + ":%s MODE %s :+%s", + RELAY_IRC_DATA(client, address), + RELAY_IRC_DATA(client, nick), + nick_modes); + } + if (nick_modes) + free (nick_modes); + /* hook signals */ relay_irc_hook_signals (client); -- cgit v1.2.3