Files
pokerth/src/chatcleaner/capsfloodcheck.cpp
T
lotodore 02518c67b2 Reformatting code using Kernighan & Ritchie style, tabs, tab width=4.
Command line: astyle --style=kr --indent=force-tab=4 --lineend=linux -n -r <file names>
2011-02-11 20:02:08 +00:00

24 lines
493 B
C++

#include "capsfloodcheck.h"
#include <QtCore>
CapsFloodCheck::CapsFloodCheck()
: capsNumberToTrigger(0)
{
}
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;
}
}