summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-10 18:43:15 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-10 18:43:15 +0000
commite51a4b5c29deac855496d6658a3c4612a61ffbb7 (patch)
tree56fc8b6ff360388567bcb64aee8dfd179085edf4 /src/mode.cpp
parent6c9588419d3cfe01d04d3c870eaac712bb6745b8 (diff)
Move InsertMode into ModeParser
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4849 e03df62e-2008-0410-955e-edbf42e46eb7
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;
+}
+