]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cgiirc.cpp
Sync helpop chmodes s and p with docs
[user/henk/code/inspircd.git] / src / modules / m_cgiirc.cpp
index 9ad25e6fbaec626573fe9402a8f08a3bf1f81b02..f0963e4c1a81706a33ab134795796afb0fd2dd6f 100644 (file)
@@ -332,6 +332,26 @@ class ModuleCgiIRC
                ServerInstance->SNO->EnableSnomask('w', "CGIIRC");
        }
 
+       void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
+       {
+               tokens["EXTBAN"].push_back('w');
+       }
+
+       ModResult OnCheckBan(User* user, Channel*, const std::string& mask) CXX11_OVERRIDE
+       {
+               if (mask.length() <= 2 || mask[0] != 'w' || mask[1] != ':')
+                       return MOD_RES_PASSTHRU;
+
+               const std::string* gateway = cmdwebirc.gateway.get(user);
+               if (!gateway)
+                       return MOD_RES_PASSTHRU;
+
+               if (InspIRCd::Match(*gateway, mask.substr(2)))
+                       return MOD_RES_DENY;
+
+               return MOD_RES_PASSTHRU;
+       }
+
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                std::vector<IdentHost> identhosts;
@@ -516,15 +536,17 @@ class ModuleCgiIRC
 
        void OnWhois(Whois::Context& whois) CXX11_OVERRIDE
        {
-               if (!whois.IsSelfWhois() && !whois.GetSource()->HasPrivPermission("users/auspex"))
-                       return;
-
                // If these fields are not set then the client is not using a gateway.
-               const std::string* realhost = cmdwebirc.realhost.get(whois.GetTarget());
-               const std::string* realip = cmdwebirc.realip.get(whois.GetTarget());
+               std::string* realhost = cmdwebirc.realhost.get(whois.GetTarget());
+               std::string* realip = cmdwebirc.realip.get(whois.GetTarget());
                if (!realhost || !realip)
                        return;
 
+               // If the source doesn't have the right privs then only show the gateway name.
+               std::string hidden = "*";
+               if (!whois.GetSource()->HasPrivPermission("users/auspex"))
+                       realhost = realip = &hidden;
+
                const std::string* gateway = cmdwebirc.gateway.get(whois.GetTarget());
                if (gateway)
                        whois.SendLine(RPL_WHOISGATEWAY, *realhost, *realip, "is connected via the " + *gateway + " WebIRC gateway");