]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Minor ISupportManager changes
authorAttila Molnar <attilamolnar@hush.com>
Mon, 14 Jul 2014 14:42:22 +0000 (16:42 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Mon, 14 Jul 2014 14:42:22 +0000 (16:42 +0200)
- Make GetLines() a const method
- Rename Lines to cachedlines
- Get rid of a variable in Build()

include/isupportmanager.h
src/server.cpp

index c62cd1ae30db1ca5b23ad8cfa09a5314967f47e2..3915b8b1b580961a1aac311e6fb0e648b47d291c 100644 (file)
@@ -24,17 +24,14 @@ class CoreExport ISupportManager
 {
  private:
        /** The generated lines which are sent to clients. */
-       std::vector<std::string> Lines;
+       std::vector<std::string> cachedlines;
 
  public:
        /** (Re)build the ISUPPORT vector. */
        void Build();
 
        /** Returns the std::vector of ISUPPORT lines. */
-       const std::vector<std::string>& GetLines()
-       {
-               return this->Lines;
-       }
+       const std::vector<std::string>& GetLines() const { return cachedlines; }
 
        /** Send the 005 numerics (ISUPPORT) to a user. */
        void SendTo(LocalUser* user);
index 66466fae94cbdbbd65e86566c1526b0370eee561..ceefa438798f94ad19b0334ed6bfa6f4f20c6c72 100644 (file)
@@ -198,10 +198,9 @@ void ISupportManager::Build()
        }
 
        // Transform the map into a list of lines, ready to be sent to clients
-       std::vector<std::string>& lines = this->Lines;
        std::string line;
        unsigned int token_count = 0;
-       lines.clear();
+       cachedlines.clear();
 
        for (std::map<std::string, std::string>::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<std::string>::const_iterator i = this->Lines.begin(); i != this->Lines.end(); ++i)
+       for (std::vector<std::string>::const_iterator i = cachedlines.begin(); i != cachedlines.end(); ++i)
                user->WriteNumeric(RPL_ISUPPORT, *i);
 }