some chatcleaner adjustments
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user