From: Attila Molnar Date: Mon, 14 Jul 2014 14:42:22 +0000 (+0200) Subject: Minor ISupportManager changes X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=e7bdcd71dce911f64d8f0c85f4935dfa83a81dd3;p=user%2Fhenk%2Fcode%2Finspircd.git Minor ISupportManager changes - Make GetLines() a const method - Rename Lines to cachedlines - Get rid of a variable in Build() --- diff --git a/include/isupportmanager.h b/include/isupportmanager.h index c62cd1ae3..3915b8b1b 100644 --- a/include/isupportmanager.h +++ b/include/isupportmanager.h @@ -24,17 +24,14 @@ class CoreExport ISupportManager { private: /** The generated lines which are sent to clients. */ - std::vector Lines; + std::vector cachedlines; public: /** (Re)build the ISUPPORT vector. */ void Build(); /** Returns the std::vector of ISUPPORT lines. */ - const std::vector& GetLines() - { - return this->Lines; - } + const std::vector& GetLines() const { return cachedlines; } /** Send the 005 numerics (ISUPPORT) to a user. */ void SendTo(LocalUser* user); diff --git a/src/server.cpp b/src/server.cpp index 66466fae9..ceefa4387 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -198,10 +198,9 @@ void ISupportManager::Build() } // Transform the map into a list of lines, ready to be sent to clients - std::vector& lines = this->Lines; std::string line; unsigned int token_count = 0; - lines.clear(); + cachedlines.clear(); for (std::map::const_iterator it = tokens.begin(); it != tokens.end(); ++it) { @@ -220,7 +219,7 @@ void ISupportManager::Build() // Reached maximum number of tokens for this line or the current token // is the last one; finalize the line and store it for later use line.append(":are supported by this server"); - lines.push_back(line); + cachedlines.push_back(line); line.clear(); } } @@ -228,6 +227,6 @@ void ISupportManager::Build() void ISupportManager::SendTo(LocalUser* user) { - for (std::vector::const_iterator i = this->Lines.begin(); i != this->Lines.end(); ++i) + for (std::vector::const_iterator i = cachedlines.begin(); i != cachedlines.end(); ++i) user->WriteNumeric(RPL_ISUPPORT, *i); }