]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
Fix configure system loading cache file too late.
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index a6df520c5d2d10fddb7a3306fd0ad35e9052d27e..3efa58bba44150c111d2e109ab5f14d6cb6f39e6 100644 (file)
@@ -196,6 +196,33 @@ bool InspIRCd::IsValidMask(const std::string &mask)
        return true;
 }
 
+void InspIRCd::StripColor(std::string &sentence)
+{
+       /* refactor this completely due to SQUIT bug since the old code would strip last char and replace with \0 --peavey */
+       int seq = 0;
+
+       for (std::string::iterator i = sentence.begin(); i != sentence.end();)
+       {
+               if (*i == 3)
+                       seq = 1;
+               else if (seq && (( ((*i >= '0') && (*i <= '9')) || (*i == ',') ) ))
+               {
+                       seq++;
+                       if ( (seq <= 4) && (*i == ',') )
+                               seq = 1;
+                       else if (seq > 3)
+                               seq = 0;
+               }
+               else
+                       seq = 0;
+
+               if (seq || ((*i == 2) || (*i == 15) || (*i == 22) || (*i == 21) || (*i == 31)))
+                       i = sentence.erase(i);
+               else
+                       ++i;
+       }
+}
+
 /* true for valid channel name, false else */
 bool IsChannelHandler::Call(const char *chname, size_t max)
 {