]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_override.cpp
Added <oper:swhois> to m_swhois, which will override <type:swhois> if specified
[user/henk/code/inspircd.git] / src / modules / m_override.cpp
index 026b2798d7c13af4ec863e4b5ce1e7412c1dec4e..edfffcca45ac611ce05278742944edeec632c776 100644 (file)
@@ -97,13 +97,13 @@ class ModuleOverride : public Module
        {
                // checks to see if the oper's type has <type:override>
                override_t::iterator j = overrides.find(source->oper);
-               
+
                if (j != overrides.end())
                {
-                       // its defined, return its value as a boolean for if the token is set
-                       return (j->second.find(token, 0) != std::string::npos);
+                       // its defined or * is set, return its value as a boolean for if the token is set
+                       return ((j->second.find(token, 0) != std::string::npos) || (j->second.find("*", 0) != std::string::npos));
                }
-               
+
                // its not defined at all, count as false
                return false;
        }
@@ -240,7 +240,7 @@ class ModuleOverride : public Module
                return ACR_DEFAULT;
        }
        
-       virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
+       virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs)
        {
                if (*user->oper)
                {
@@ -248,20 +248,18 @@ class ModuleOverride : public Module
                        {
                                if ((chan->modes[CM_INVITEONLY]) && (CanOverride(user,"INVITE")))
                                {
-                                       if (NoisyOverride)
+                                       irc::string x = chan->name;
+                                       if (!user->IsInvited(x))
                                        {
-                                               irc::string x = chan->name;
-                                               if (!user->IsInvited(x))
-                                               {
-                                                       /* XXX - Ugly cast for a parameter that isn't used? :< - Om */
+                                               /* XXX - Ugly cast for a parameter that isn't used? :< - Om */
+                                               if (NoisyOverride)
                                                        chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass invite-only", cname, user->nick);
-                                               }
+                                               ServerInstance->SNO->WriteToSnoMask('O',std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname));
                                        }
-                                       ServerInstance->SNO->WriteToSnoMask('O',std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname));
                                        return -1;
                                }
                                
-                               if ((chan->key[0]) && (CanOverride(user,"KEY")))
+                               if ((*chan->key) && (CanOverride(user,"KEY")))
                                {
                                        if (NoisyOverride)
                                                chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass the channel key", cname, user->nick);
@@ -282,10 +280,8 @@ class ModuleOverride : public Module
                                        if (chan->IsBanned(user))
                                        {
                                                if (NoisyOverride)
-                                               {
                                                        chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass channel ban", cname, user->nick);
-                                                       ServerInstance->SNO->WriteToSnoMask('O',"%s used oper-override to bypass channel ban", cname, user->nick);
-                                               }
+                                               ServerInstance->SNO->WriteToSnoMask('O',"%s used oper-override to bypass channel ban on %s", user->nick, cname);
                                        }
                                        return -1;
                                }
@@ -301,7 +297,7 @@ class ModuleOverride : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,1,VF_VENDOR);
+               return Version(1,1,0,1,VF_VENDOR,API_VERSION);
        }
 };