Files
pokerth/src/chatcleaner/badwordcheck.cpp
T

35 lines
560 B
C++
Raw Normal View History

#include "badwordcheck.h"
#include <QtCore>
BadWordCheck::BadWordCheck()
{
}
bool BadWordCheck::run(QString msg)
{
msg = msg.toLower();
2012-12-21 01:01:01 +01:00
bool badMessage(false);
QStringListIterator it(badWords);
while (it.hasNext()) {
2012-12-21 01:01:01 +01:00
QString bw=it.next();
if(msg.contains(bw)) {
badMessage=true;
2012-12-09 19:44:20 +01:00
2012-12-21 01:01:01 +01:00
//exception check
QStringListIterator it2(badWordsException);
while (it2.hasNext()) {
QString bwe=it2.next();
if(bwe.contains(bw) && msg.contains(bwe)) {
badMessage=false;
}
}
}
}
2012-12-09 19:44:20 +01:00
2012-12-21 01:01:01 +01:00
if(badMessage) return true;
else return false;
2012-12-09 19:44:20 +01:00
}