some chatcleaner adjustments

This commit is contained in:
doitux
2009-07-27 20:18:18 +00:00
parent e44286044d
commit a612cff91f
4 changed files with 19 additions and 9 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ using namespace std;
CleanerConfig::CleanerConfig()
{
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 1;
configRev = 2;
// Pfad und Dateinamen setzen
#ifdef _WIN32
@@ -114,7 +114,7 @@ CleanerConfig::CleanerConfig()
configList.push_back(ConfigInfo("HostAddress", CONFIG_TYPE_STRING, "127.0.0.1"));
configList.push_back(ConfigInfo("DefaultListenPort", CONFIG_TYPE_STRING, "4327"));
configList.push_back(ConfigInfo("WarnLevelToKick", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("WarnLevelToKick", CONFIG_TYPE_INT, "2"));
configList.push_back(ConfigInfo("TextFloodLevelToTrigger", CONFIG_TYPE_INT, "3"));
list<string> badWordsList;
+5 -3
View File
@@ -35,9 +35,11 @@ CleanerServer::~CleanerServer()
}
void CleanerServer::newCon()
{
tcpSocket = tcpServer->nextPendingConnection();
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(onRead()));
{
if(!tcpSocket->isOpen()) {
tcpSocket = tcpServer->nextPendingConnection();
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(onRead()));
}
}
void CleanerServer::onRead()
+3 -1
View File
@@ -43,9 +43,11 @@ QString MessageFilter::check(unsigned playerId, QString nick, QString msg)
action = WARN;
}
else {
if(i.value().warnLevel == warnLevelToKick) {
if(i.value().warnLevel == warnLevelToKick || i.value().lastWarnType == offence) {
// Kick Command
action = KICK;
//remove playerId from all lists and as LAST from myClientWarnLevelList
myTextFloodCheck->removeNickFromList(i.key());
myClientWarnLevelList.remove(i.key());
}
else {
+9 -3
View File
@@ -31,11 +31,16 @@ bool TextFloodCheck::run(unsigned playerId) {
}
else {
if(timer.elapsed().total_seconds()-i.value().timeStamp <= 1) {
if(i.value().floodLevel == textFloodLevelToTrigger)
if(i.value().floodLevel == textFloodLevelToTrigger) {
myTextFloodInfos.floodLevel--;
// qDebug () << "set player floodlevel to " << myTextFloodInfos.floodLevel << endl;
myTextFloodInfos.timeStamp = timer.elapsed().total_seconds();
msgTimesList.insert(playerId, myTextFloodInfos);
return true;
else
}
else {
myTextFloodInfos.floodLevel++;
}
}
myTextFloodInfos.timeStamp = timer.elapsed().total_seconds();
msgTimesList.insert(playerId, myTextFloodInfos);
@@ -65,5 +70,6 @@ void TextFloodCheck::cleanMsgTimesList() {
void TextFloodCheck::removeNickFromList(unsigned playerId) {
// qDebug() << "id " << playerId << "removed from textfloodcheck list" << endl;
msgTimesList.remove(playerId);
}