]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove irc::modestacker
authorAttila Molnar <attilamolnar@hush.com>
Wed, 3 Sep 2014 13:40:19 +0000 (15:40 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Wed, 3 Sep 2014 13:40:19 +0000 (15:40 +0200)
include/hashcomp.h
src/hashcomp.cpp

index 6cd3fc3c0fd06f6d7cb67c39ca0011433dbd1a60..c99b5d64613b3364ab754e1689bbe6e1cd1fd451 100644 (file)
@@ -174,77 +174,6 @@ namespace irc
         */
        std::string CoreExport stringjoiner(const std::vector<std::string>& sequence, char separator = ' ');
 
-       /** irc::modestacker stacks mode sequences into a list.
-        * It can then reproduce this list, clamped to a maximum of MAXMODES
-        * values per line.
-        */
-       class CoreExport modestacker
-       {
-        private:
-               /** The mode sequence and its parameters
-                */
-               std::deque<std::string> sequence;
-
-               /** True if the mode sequence is initially adding
-                * characters, false if it is initially removing
-                * them
-                */
-               bool adding;
-        public:
-
-               /** Construct a new modestacker.
-                * @param add True if the stack is adding modes,
-                * false if it is removing them
-                */
-               modestacker(bool add);
-
-               /** Push a modeletter and its parameter onto the stack.
-                * No checking is performed as to if this mode actually
-                * requires a parameter. If you stack invalid mode
-                * sequences, they will be tidied if and when they are
-                * passed to a mode parser.
-                * @param modeletter The mode letter to insert
-                * @param parameter The parameter for the mode
-                */
-               void Push(char modeletter, const std::string &parameter);
-
-               /** Push a modeletter without parameter onto the stack.
-                * No checking is performed as to if this mode actually
-                * requires a parameter. If you stack invalid mode
-                * sequences, they will be tidied if and when they are
-                * passed to a mode parser.
-                * @param modeletter The mode letter to insert
-                */
-               void Push(char modeletter);
-
-               /** Push a '+' symbol onto the stack.
-                */
-               void PushPlus();
-
-               /** Push a '-' symbol onto the stack.
-                */
-               void PushMinus();
-
-               /** Return zero or more elements which form the
-                * mode line. This will be clamped to a max of
-                * MAXMODES items (MAXMODES-1 mode parameters and
-                * one mode sequence string), and max_line_size
-                * characters. As specified below, this function
-                * should be called in a loop until it returns zero,
-                * indicating there are no more modes to return.
-                * @param result The vector to populate. This will not
-                * be cleared before it is used.
-                * @param max_line_size The maximum size of the line
-                * to build, in characters, seperate to MAXMODES.
-                * @return The number of elements in the deque.
-                * The function should be called repeatedly until it
-                * returns 0, in case there are multiple lines of
-                * mode changes to be obtained.
-                */
-               int GetStackedLine(std::vector<std::string> &result, int max_line_size = 360);
-
-       };
-
        /** irc::sepstream allows for splitting token seperated lists.
         * Each successive call to sepstream::GetToken() returns
         * the next token, until none remain, at which point the method returns
index 895b500ae8c8d94cfeb341a0cc14242b2499dce0..46981e7034d30c148bc5be264acc78733baa14c8 100644 (file)
@@ -348,71 +348,6 @@ bool irc::sepstream::StreamEnd()
        return this->pos > this->tokens.length();
 }
 
-irc::modestacker::modestacker(bool add) : adding(add)
-{
-       sequence.clear();
-       sequence.push_back("");
-}
-
-void irc::modestacker::Push(char modeletter, const std::string &parameter)
-{
-       *(sequence.begin()) += modeletter;
-       sequence.push_back(parameter);
-}
-
-void irc::modestacker::Push(char modeletter)
-{
-       this->Push(modeletter,"");
-}
-
-void irc::modestacker::PushPlus()
-{
-       this->Push('+',"");
-}
-
-void irc::modestacker::PushMinus()
-{
-       this->Push('-',"");
-}
-
-int irc::modestacker::GetStackedLine(std::vector<std::string> &result, int max_line_size)
-{
-       if (sequence.empty())
-       {
-               return 0;
-       }
-
-       unsigned int n = 0;
-       int size = 1; /* Account for initial +/- char */
-       int nextsize = 0;
-       int start = result.size();
-       std::string modeline = adding ? "+" : "-";
-       result.push_back(modeline);
-
-       if (sequence.size() > 1)
-               nextsize = sequence[1].length() + 2;
-
-       while (!sequence[0].empty() && (sequence.size() > 1) && (n < ServerInstance->Config->Limits.MaxModes) && ((size + nextsize) < max_line_size))
-       {
-               modeline += *(sequence[0].begin());
-               if (!sequence[1].empty())
-               {
-                       result.push_back(sequence[1]);
-                       size += nextsize; /* Account for mode character and whitespace */
-               }
-               sequence[0].erase(sequence[0].begin());
-               sequence.erase(sequence.begin() + 1);
-
-               if (sequence.size() > 1)
-                       nextsize = sequence[1].length() + 2;
-
-               n++;
-       }
-       result[start] = modeline;
-
-       return n;
-}
-
 std::string irc::stringjoiner(const std::vector<std::string>& sequence, char separator)
 {
        std::string joined;