summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 915dcd809..b0043b828 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -3,13 +3,13 @@
* +------------------------------------+
*
* InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
+ * E-mail:
+ * <brain@chatspike.net>
+ * <Craig@chatspike.net>
*
* Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
@@ -699,3 +699,27 @@ ModeParser::ModeParser()
this->AddMode(new ModeUserServerNoticeMask, 'n');
}
+bool ModeParser::InsertMode(std::string &output, const char* mode, unsigned short section)
+{
+ unsigned short currsection = 1;
+ unsigned int pos = output.find("CHANMODES=", 0) + 10; // +10 for the length of "CHANMODES="
+
+ if(section > 4 || section == 0)
+ {
+ log(DEBUG, "InsertMode: CHANMODES doesn't have a section %dh :/", section);
+ return false;
+ }
+
+ for(; pos < output.size(); pos++)
+ {
+ if(section == currsection)
+ break;
+
+ if(output[pos] == ',')
+ currsection++;
+ }
+
+ output.insert(pos, mode);
+ return true;
+}
+