1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-12 09:50:29 +00:00

Generate "METADATA host" commands on "MODE +/-x"

Use "METADATA host" commands to let servers supporting this command
know which (possibly cloaked) hostname is in effect for a specific
client. This prevents "double cloaking" of hostnames and even cloaked
hostnames are in sync on all servers supporting "METADATA" now.
This commit is contained in:
Alexander Barton 2012-11-05 23:49:12 +01:00
parent 44b7ff02fd
commit 40e3daf560

View File

@ -36,6 +36,8 @@
#include "irc-mode.h"
static void Announce_Client_Hostname PARAMS((CLIENT *Origin, CLIENT *Client));
static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
CLIENT *Target));
static bool Channel_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
@ -367,9 +369,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
Client_ID(Target),
the_modes);
if (send_RPL_HOSTHIDDEN_MSG)
IRC_WriteStrClient(Client, RPL_HOSTHIDDEN_MSG,
Client_ID(Client),
Client_HostnameCloaked(Client));
Announce_Client_Hostname(Origin, Client);
}
LogDebug("%s \"%s\": Mode change, now \"%s\".",
Client_TypeText(Target), Client_Mask(Target),
@ -381,6 +381,27 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
} /* Client_Mode */
/**
* Announce changed client hostname in the network.
*
* @param Client The client of which the hostname changed.
*/
static void
Announce_Client_Hostname(CLIENT *Origin, CLIENT *Client)
{
assert(Client != NULL);
/* Inform the client itself */
IRC_WriteStrClient(Client, RPL_HOSTHIDDEN_MSG, Client_ID(Client),
Client_HostnameCloaked(Client));
/* Inform other servers in the network */
IRC_WriteStrServersPrefixFlag(Origin, Client_ThisServer(), 'M',
"METADATA %s host :%s", Client_ID(Client),
Client_HostnameCloaked(Client));
}
static bool
Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel)
{