summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r--src/helperfuncs.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index a6df520c5..3efa58bba 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -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)
{