initial capsfloodcheck support

This commit is contained in:
doitux
2009-07-29 23:27:27 +00:00
parent a612cff91f
commit 0356d21e0f
6 changed files with 69 additions and 12 deletions
+23
View File
@@ -0,0 +1,23 @@
#include "capsfloodcheck.h"
#include <QtCore>
CapsFloodCheck::CapsFloodCheck()
{
}
bool CapsFloodCheck::run(QString msg)
{
msg = msg.simplified().remove(" ");
QRegExp e(QString("[A-Z]{%1,}").arg(capsNumberToTrigger));
if(e.isValid()) {
e.setCaseSensitivity(Qt::CaseSensitive);
e.indexIn(msg);
if(e.matchedLength() != -1 ) return true;
else return false;
}
else {
qDebug() << "The current Caps Flood RegExp is invalid" << endl;
return false;
}
}