]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add a constructor to OperInfo and use it to set the type name.
authorPeter Powell <petpow@saberuk.com>
Mon, 16 Oct 2017 01:37:57 +0000 (02:37 +0100)
committerPeter Powell <petpow@saberuk.com>
Wed, 18 Oct 2017 17:38:30 +0000 (18:38 +0100)
include/configreader.h
src/configparser.cpp
src/configreader.cpp
src/modules/m_spanningtree/opertype.cpp

index 001d4a92a5678387bf6d31f792d53e3075bd1de6..9fcb9c6a333f72a12fed7dfc08a1201c91092c53 100644 (file)
@@ -184,6 +184,11 @@ class CoreExport OperInfo : public refcountbase
        /** Name of the oper type; i.e. the one shown in WHOIS */
        std::string name;
 
+       /** Creates a new OperInfo with the specified oper type name.
+        * @param Name The name of the oper type.
+        */
+       OperInfo(const std::string& Name);
+
        /** Get a configuration item, searching in the oper, type, and class blocks (in that order) */
        std::string getConfig(const std::string& key);
        void init();
index 86268a13284c4aefe838a217d64ce0df45e4b289..2af796b21c771c3532781d881c7470ec652809f2 100644 (file)
@@ -507,6 +507,11 @@ ConfigTag::ConfigTag(const std::string& Tag, const std::string& file, int line)
 {
 }
 
+OperInfo::OperInfo(const std::string& Name)
+       : name(Name)
+{
+}
+
 std::string OperInfo::getConfig(const std::string& key)
 {
        std::string rv;
index 6471413e08e2095ae36134458230101a1a648e86..2a50a22b394a2aa96831b75a82650425565b2ded 100644 (file)
@@ -158,9 +158,8 @@ void ServerConfig::CrossCheckOperClassType()
                if (OperTypes.find(name) != OperTypes.end())
                        throw CoreException("Duplicate type block with name " + name + " at " + tag->getTagLocation());
 
-               OperInfo* ifo = new OperInfo;
+               OperInfo* ifo = new OperInfo(name);
                OperTypes[name] = ifo;
-               ifo->name = name;
                ifo->type_block = tag;
 
                std::string classname;
@@ -190,8 +189,7 @@ void ServerConfig::CrossCheckOperClassType()
                if (oper_blocks.find(name) != oper_blocks.end())
                        throw CoreException("Duplicate oper block with name " + name + " at " + tag->getTagLocation());
 
-               OperInfo* ifo = new OperInfo;
-               ifo->name = type;
+               OperInfo* ifo = new OperInfo(type);
                ifo->oper_block = tag;
                ifo->type_block = tblk->second->type_block;
                ifo->class_blocks.assign(tblk->second->class_blocks.begin(), tblk->second->class_blocks.end());
index ab531c171e47b31c1df92b040f6c0f8c0463fd73..b1d0c327e3b693fd8082c6c87ca62d73bf27b68c 100644 (file)
@@ -39,10 +39,7 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, std::vector<std::string>&
        if (iter != ServerInstance->Config->OperTypes.end())
                u->oper = iter->second;
        else
-       {
-               u->oper = new OperInfo;
-               u->oper->name = opertype;
-       }
+               u->oper = new OperInfo(opertype);
 
        if (Utils->quiet_bursts)
        {