]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Fall back to the most recent version supported on "CAP LS".
[user/henk/code/inspircd.git] / src / users.cpp
index 4050337c7a2e7ed6ab9b02564136d508ff044c14..0d5d2a7d70c509f883cc15c0f5ee504f0cec7924 100644 (file)
@@ -46,7 +46,7 @@ std::string User::GetModeLetters(bool includeparams) const
        std::string ret(1, '+');
        std::string params;
 
-       for (unsigned char i = 'A'; i < 'z'; i++)
+       for (unsigned char i = 'A'; i <= 'z'; i++)
        {
                const ModeHandler* const mh = ServerInstance->Modes.FindMode(i, MODETYPE_USER);
                if ((!mh) || (!IsModeSet(mh)))
@@ -167,7 +167,8 @@ bool LocalUser::HasModePermission(const ModeHandler* mh) const
                return false;
 
        const unsigned char mode = mh->GetModeChar();
-       if (mode < 'A' || mode > ('A' + 64)) return false;
+       if (ModeParser::IsModeChar(mode))
+               return false;
 
        return ((mh->GetModeType() == MODETYPE_USER ? oper->AllowedUserModes : oper->AllowedChanModes))[(mode - 'A')];
 
@@ -179,12 +180,12 @@ bool LocalUser::HasModePermission(const ModeHandler* mh) const
  * allowing remote kills, etc - but if they have access to the src, they most likely have
  * access to the conf - so it's an end to a means either way.
  */
-bool User::HasPermission(const std::string&)
+bool User::HasCommandPermission(const std::string&)
 {
        return true;
 }
 
-bool LocalUser::HasPermission(const std::string &command)
+bool LocalUser::HasCommandPermission(const std::string& command)
 {
        // are they even an oper at all?
        if (!this->IsOper())
@@ -195,27 +196,17 @@ bool LocalUser::HasPermission(const std::string &command)
        return oper->AllowedOperCommands.Contains(command);
 }
 
-bool User::HasPrivPermission(const std::string &privstr, bool noisy)
+bool User::HasPrivPermission(const std::string& privstr)
 {
        return true;
 }
 
-bool LocalUser::HasPrivPermission(const std::string &privstr, bool noisy)
+bool LocalUser::HasPrivPermission(const std::string& privstr)
 {
        if (!this->IsOper())
-       {
-               if (noisy)
-                       this->WriteNotice("You are not an oper");
                return false;
-       }
-
-       if (oper->AllowedPrivs.Contains(privstr))
-               return true;
 
-       if (noisy)
-               this->WriteNotice("Oper type " + oper->name + " does not have access to priv " + privstr);
-
-       return false;
+       return oper->AllowedPrivs.Contains(privstr);
 }
 
 void UserIOHandler::OnDataReady()
@@ -560,7 +551,7 @@ void LocalUser::FullConnect()
        FOREACH_MOD(OnPostConnect, (this));
 
        ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]",
-               this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str());
+               this->server_sa.port(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str());
        ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString());
        ServerInstance->BanCache.AddHit(this->GetIPString(), "", "");
        // reset the flood penalty (which could have been raised due to things like auto +x)
@@ -656,11 +647,6 @@ void LocalUser::OverruleNick()
        this->ChangeNick(this->uuid);
 }
 
-int LocalUser::GetServerPort()
-{
-       return this->server_sa.port();
-}
-
 const std::string& User::GetIPString()
 {
        if (cachedip.empty())
@@ -1121,7 +1107,7 @@ void LocalUser::SetClass(const std::string &explicit_name)
                        if (!c->ports.empty())
                        {
                                /* and our port doesn't match, fail. */
-                               if (!c->ports.count(this->GetServerPort()))
+                               if (!c->ports.count(this->server_sa.port()))
                                {
                                        ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires a different port, skipping");
                                        continue;