]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sqloper.cpp
Set the minimum length to 1 for most config items with a default.
[user/henk/code/inspircd.git] / src / modules / m_sqloper.cpp
index 4728170192e8cbc6c47d644643fe3cac36f96904..21590ede60657dc9d9edb881ede34f08fa36bdd5 100644 (file)
@@ -1,8 +1,15 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2017 Dylan Frank <b00mx0r@aureus.pw>
+ *   Copyright (C) 2019 B00mX0r <b00mx0r@aureus.pw>
+ *   Copyright (C) 2018 Dylan Frank <b00mx0r@aureus.pw>
+ *   Copyright (C) 2013-2014, 2018 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2013, 2017-2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
+ *   Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2006-2007, 2010 Craig Edwards <brain@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -96,6 +103,7 @@ class OperQuery : public SQL::Query
                        ifo->class_blocks.assign(tblk->second->class_blocks.begin(), tblk->second->class_blocks.end());
                        oper_blocks[name] = ifo;
                        my_blocks.push_back(name);
+                       row.clear();
                }
 
                // If this was done as a result of /OPER and not a config read
@@ -109,7 +117,7 @@ class OperQuery : public SQL::Query
        void OnError(SQL::Error& error) CXX11_OVERRIDE
        {
                ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "query failed (%s)", error.ToString());
-               ServerInstance->SNO->WriteGlobalSno('a', "m_sqloper: failed to update blocks from database");
+               ServerInstance->SNO->WriteGlobalSno('a', "m_sqloper: Failed to update blocks from database");
                if (!uid.empty())
                {
                        // Fallback. We don't want to block a netadmin from /OPER
@@ -130,7 +138,7 @@ class OperQuery : public SQL::Query
 
                if (oper_command)
                {
-                       std::vector<std::string> params;
+                       CommandBase::Params params;
                        params.push_back(username);
                        params.push_back(password);
 
@@ -138,12 +146,13 @@ class OperQuery : public SQL::Query
                        ModResult MOD_RESULT;
 
                        std::string origin = "OPER";
-                       FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (origin, params, localuser, true, origin));
+                       FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (origin, params, localuser, true));
                        if (MOD_RESULT == MOD_RES_DENY)
                                return;
 
                        // Now handle /OPER.
-                       oper_command->Handle(params, user);
+                       ClientProtocol::TagMap tags;
+                       oper_command->Handle(user, CommandBase::Params(params, tags));
                }
                else
                {
@@ -181,7 +190,7 @@ public:
                else
                        SQL.SetProvider("SQL/" + dbid);
 
-               query = tag->getString("query", "SELECT * FROM ircd_opers WHERE active=1;");
+               query = tag->getString("query", "SELECT * FROM ircd_opers WHERE active=1;", 1);
                // Update sqloper list from the database.
                GetOperBlocks();
        }
@@ -195,7 +204,7 @@ public:
                }
        }
 
-       ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE
+       ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE
        {
                // If we are not in the middle of an existing /OPER and someone is trying to oper-up
                if (validated && command == "OPER" && parameters.size() >= 2 && !active)