summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-09-03 15:40:19 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-09-03 15:40:19 +0200
commit87025fd5ac24bb758eec053e2f92382835e8ecd1 (patch)
treef27ff46757d5410f65d0c3efede55c138f0ec524
parent7166c4905a08b590bcf61e9e3d13953f7965f93a (diff)
Remove irc::modestacker
-rw-r--r--include/hashcomp.h71
-rw-r--r--src/hashcomp.cpp65
2 files changed, 0 insertions, 136 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 6cd3fc3c0..c99b5d646 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -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
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 895b500ae..46981e703 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -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;