]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added ircu-like hidewhois feature that allows hiding of server name in whois with...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 3 Feb 2006 10:03:01 +0000 (10:03 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 3 Feb 2006 10:03:01 +0000 (10:03 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3034 e03df62e-2008-0410-955e-edbf42e46eb7

docs/inspircd.conf.example
include/inspircd_io.h
src/commands.cpp
src/inspircd_io.cpp

index f59b09e506a1c47b1404c60ae387b7b9ec84291d..11fdc6da42ef862715c62f86c244b26fca7601f2 100644 (file)
 #                  instead of the server names in the quit message,   #
 #                  identical to the way IRCu displays them.           #
 #                                                                     #
+#  hidewhois     - When defined with a non-empty value, the given     #
+#                  text will be used in place of the user's server    #
+#                  in WHOIS, when a user is WHOISed by a non-oper.    #
+#                  For example, most nets will want to set this to    #
+#                  something like '*.netname.net' to conceal the      #
+#                  actual server the user is on.                      #
+#                                                                     #
 
 <options prefixquit="Quit: "
          loglevel="default"
          customversion=""
          maxtargets="20"
         hidesplits="no"
+        hidewhois=""
          allowhalfop="yes">
 
 
index a3190cd6a35f50916a01eaeb71870e67f03dd61d..990b746be7575c34a7f051d7ea0cff639a5f46fc 100644 (file)
@@ -224,6 +224,10 @@ class ServerConfig : public classbase
         */
        bool HideSplits;
 
+       /** Set to a non-empty string to obfuscate the server name of users in WHOIS
+        */
+       char HideWhoisServer[MAXBUF];
+
        /** A list of IP addresses the server is listening
         * on.
         */
index 4d09db9feb38b51bd239d0792dfae86dee078d0b..4b376bbde2e241ca1058ea810c1a3ff1f4f2eb3e 100644 (file)
@@ -133,7 +133,14 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
                                WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl.c_str());
                        }
                }
-               WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
+               if (*Config->HideWhoisServer)
+               {
+                       WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, *user->oper ? dest->server : Config->HideWhoisServer, *user->oper ? GetServerDescription(dest->server).c_str() : Config->Network);
+               }
+               else
+               {
+                       WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
+               }
                if (*dest->awaymsg)
                {
                        WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg);
index 88cb1438f513b10eb57f725be6727db8fe75320d..66fa0908ec49ec39f11378979e2d4877c37df1a4 100644 (file)
@@ -45,7 +45,7 @@ ServerConfig::ServerConfig()
 {
        this->ClearStack();
        *ServerName = *Network = *ServerDesc = *AdminName = '\0';
-       *AdminEmail = *AdminNick = *diepass = *restartpass = '\0';
+       *HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = '\0';
        *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
        *OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
        log_file = NULL;
@@ -227,6 +227,7 @@ void ServerConfig::Read(bool bail, userrec* user)
        ConfValue("options","customversion",0,Config->CustomVersion,&Config->config_f);
        ConfValue("options","maxtargets",0,MT,&Config->config_f);
        ConfValue("options","hidesplits",0,HS,&Config->config_f);
+       ConfValue("options","hidewhois",0,Config->HideWhoisServer,&Config->config_f);
 
        Config->HideSplits = ((*HS == 'y') || (*HS == 'Y') || (*HS == '1') || (*HS == 't') || (*HS == 'T'));
         Config->SoftLimit = atoi(SLIMT);