commit 40e3daf560799df1d16629b35078979583cb4349 from: Alexander Barton date: Mon Nov 05 22:49:12 2012 UTC 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. commit - 44b7ff02fd34731c6ed0d552dbde5c9981d53127 commit + 40e3daf560799df1d16629b35078979583cb4349 blob - ce4044d0bf7b154401e10096af47abed1911550b blob + 1cf19afc2bf437f19a2887509e12851c932a7951 --- src/ngircd/irc-mode.c +++ src/ngircd/irc-mode.c @@ -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 *Ori 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 *Ori } /* 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) {