mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 02:33:12 +02:00
Merge remote-tracking branch 'origin/pr/640'
This commit is contained in:
@@ -759,6 +759,83 @@ IRC_PROTOCOL_CALLBACK(cap)
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for the IRC message "CHGHOST": user/host change of a nick (with
|
||||
* capability "chghost"):
|
||||
* http://ircv3.net/specs/extensions/chghost-3.2.html
|
||||
*
|
||||
* Message looks like:
|
||||
* :nick!user@host CHGHOST user new.host.goes.here
|
||||
* :nick!user@host CHGHOST newuser host
|
||||
* :nick!user@host CHGHOST newuser new.host.goes.here
|
||||
*/
|
||||
|
||||
IRC_PROTOCOL_CALLBACK(chghost)
|
||||
{
|
||||
int length, local_chghost, smart_filter;
|
||||
char *str_host;
|
||||
struct t_irc_channel *ptr_channel;
|
||||
struct t_irc_nick *ptr_nick;
|
||||
struct t_irc_channel_speaking *ptr_nick_speaking;
|
||||
|
||||
IRC_PROTOCOL_MIN_ARGS(4);
|
||||
IRC_PROTOCOL_CHECK_HOST;
|
||||
|
||||
local_chghost = (irc_server_strcasecmp (server, nick, server->nick) == 0);
|
||||
|
||||
length = strlen (argv[2]) + 1 + strlen (argv[3]) + 1;
|
||||
str_host = malloc (length);
|
||||
if (str_host)
|
||||
snprintf (str_host, length, "%s@%s", argv[2], argv[3]);
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
ptr_nick = irc_nick_search (server, ptr_channel, nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
if (!ignored)
|
||||
{
|
||||
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
|
||||
&& (weechat_config_boolean (irc_config_look_smart_filter_chghost))) ?
|
||||
irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL;
|
||||
smart_filter = (!local_chghost
|
||||
&& weechat_config_boolean (irc_config_look_smart_filter)
|
||||
&& weechat_config_boolean (irc_config_look_smart_filter_chghost)
|
||||
&& !ptr_nick_speaking);
|
||||
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
server, NULL, command, NULL, ptr_channel->buffer),
|
||||
date,
|
||||
irc_protocol_tags (command,
|
||||
smart_filter ? "irc_smart_filter" : NULL,
|
||||
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),
|
||||
nick,
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
address,
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
IRC_COLOR_MESSAGE_CHGHOST,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
str_host);
|
||||
}
|
||||
|
||||
if (ptr_nick->host)
|
||||
free (ptr_nick->host);
|
||||
ptr_nick->host = strdup (str_host);
|
||||
}
|
||||
}
|
||||
|
||||
if (str_host)
|
||||
free (str_host);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for the IRC message "ERROR".
|
||||
*
|
||||
@@ -6051,6 +6128,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
|
||||
{ "authenticate", /* authenticate */ 1, 0, &irc_protocol_cb_authenticate },
|
||||
{ "away", /* away (cap away-notify) */ 1, 0, &irc_protocol_cb_away },
|
||||
{ "cap", /* client capability */ 1, 0, &irc_protocol_cb_cap },
|
||||
{ "chghost", /* user/host change (cap chghost) */ 1, 0, &irc_protocol_cb_chghost },
|
||||
{ "error", /* error received from IRC server */ 1, 0, &irc_protocol_cb_error },
|
||||
{ "invite", /* invite a nick on a channel */ 1, 0, &irc_protocol_cb_invite },
|
||||
{ "join", /* join a channel */ 1, 0, &irc_protocol_cb_join },
|
||||
|
||||
Reference in New Issue
Block a user