diff options
| author | Alexander Barton <alex@barton.de> | 2012-11-05 23:49:12 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-11-05 23:49:12 +0100 |
| commit | 40e3daf560799df1d16629b35078979583cb4349 (patch) | |
| tree | 0db77bfbaea04da4cff64b073b93036cdffe5cbb /src | |
| parent | 44b7ff02fd34731c6ed0d552dbde5c9981d53127 (diff) | |
| download | ngircd-40e3daf560799df1d16629b35078979583cb4349.tar.gz ngircd-40e3daf560799df1d16629b35078979583cb4349.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/irc-mode.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c index ce4044d0..1cf19afc 100644 --- a/src/ngircd/irc-mode.c +++ b/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 *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) { |