diff options
author | Peter Powell <petpow@saberuk.com> | 2017-10-16 02:37:57 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-10-18 18:38:30 +0100 |
commit | 020c1d6ea658956e7cb2462a748790a4f4e30787 (patch) | |
tree | f06c01791ddf214d27a2b682da5ac41ed99d70c3 | |
parent | ee7ac5aaede95eb82ecc948d0e52ad01ddeaa6c9 (diff) |
Add a constructor to OperInfo and use it to set the type name.
-rw-r--r-- | include/configreader.h | 5 | ||||
-rw-r--r-- | src/configparser.cpp | 5 | ||||
-rw-r--r-- | src/configreader.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/opertype.cpp | 5 |
4 files changed, 13 insertions, 8 deletions
diff --git a/include/configreader.h b/include/configreader.h index 001d4a92a..9fcb9c6a3 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -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(); diff --git a/src/configparser.cpp b/src/configparser.cpp index 86268a132..2af796b21 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -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; diff --git a/src/configreader.cpp b/src/configreader.cpp index 6471413e0..2a50a22b3 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -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()); diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index ab531c171..b1d0c327e 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -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) { |