add gameId usage to mute players ingame instead of kick
This commit is contained in:
@@ -133,8 +133,8 @@ bool CleanerServer::handleMessage(InternalChatCleanerPacket &msg)
|
|||||||
if (netRequest->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeGame) {
|
if (netRequest->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeGame) {
|
||||||
gameId = netRequest->cleanerChatType.choice.cleanerChatTypeGame.gameId;
|
gameId = netRequest->cleanerChatType.choice.cleanerChatTypeGame.gameId;
|
||||||
}
|
}
|
||||||
// TODO use gameId
|
|
||||||
QStringList checkreturn = myMessageFilter->check(playerId, nick, message);
|
QStringList checkreturn = myMessageFilter->check(gameId, playerId, nick, message);
|
||||||
QString checkAction = checkreturn.at(0);
|
QString checkAction = checkreturn.at(0);
|
||||||
QString checkMessage = checkreturn.at(1);
|
QString checkMessage = checkreturn.at(1);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ enum ActionType {
|
|||||||
NOTHING,
|
NOTHING,
|
||||||
WARN,
|
WARN,
|
||||||
KICK,
|
KICK,
|
||||||
KICKBAN
|
KICKBAN,
|
||||||
|
MUTE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OffenceType {
|
enum OffenceType {
|
||||||
@@ -49,7 +50,7 @@ MessageFilter::~MessageFilter()
|
|||||||
delete cleanTimer;
|
delete cleanTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
QStringList MessageFilter::check(unsigned gameId, unsigned playerId, QString nick, QString msg)
|
||||||
{
|
{
|
||||||
QStringList returnList;
|
QStringList returnList;
|
||||||
QString returnMessage;
|
QString returnMessage;
|
||||||
@@ -77,30 +78,36 @@ QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
|||||||
action = WARN;
|
action = WARN;
|
||||||
} else {
|
} else {
|
||||||
if(i.value().warnLevel == warnLevelToKick || i.value().lastWarnType == offence) {
|
if(i.value().warnLevel == warnLevelToKick || i.value().lastWarnType == offence) {
|
||||||
// Kick Command
|
if(gameId) {
|
||||||
action = KICK;
|
//check for ingame to do not kick but mute
|
||||||
//remove playerId from all lists and as LAST from myClientWarnLevelList
|
action = MUTE;
|
||||||
myTextFloodCheck->removeNickFromList(i.key());
|
}
|
||||||
myClientWarnLevelList.remove(i.key());
|
else {
|
||||||
//check if player is already on kickCounterList
|
// Kick Command
|
||||||
QMap<QString, ClientKickInfos>::const_iterator j = myClientKickCounterList.find(nick);
|
action = KICK;
|
||||||
if(j == myClientKickCounterList.end()) {
|
//remove playerId from all lists and as LAST from myClientWarnLevelList
|
||||||
//if player is NOT on this list put the playerId on it to ban after multiple offence
|
myTextFloodCheck->removeNickFromList(i.key());
|
||||||
ClientKickInfos tmpInfos;
|
myClientWarnLevelList.remove(i.key());
|
||||||
tmpInfos.kickNumber = 1;
|
//check if player is already on kickCounterList
|
||||||
tmpInfos.lastKickTimestamp = timer.elapsed().total_seconds();
|
QMap<QString, ClientKickInfos>::const_iterator j = myClientKickCounterList.find(nick);
|
||||||
myClientKickCounterList.insert(nick, tmpInfos);
|
if(j == myClientKickCounterList.end()) {
|
||||||
} else {
|
//if player is NOT on this list put the playerId on it to ban after multiple offence
|
||||||
//pleayer is already on the list: either raise kickNumber or kickban when kickNumerToBan is reached
|
|
||||||
if(j.value().kickNumber == kickNumberToBan) {
|
|
||||||
action = KICKBAN;
|
|
||||||
//remove player from kickCounterList
|
|
||||||
myClientKickCounterList.remove(j.key());
|
|
||||||
} else {
|
|
||||||
ClientKickInfos tmpInfos;
|
ClientKickInfos tmpInfos;
|
||||||
tmpInfos.kickNumber = j.value().kickNumber+1;
|
tmpInfos.kickNumber = 1;
|
||||||
tmpInfos.lastKickTimestamp = timer.elapsed().total_seconds();
|
tmpInfos.lastKickTimestamp = timer.elapsed().total_seconds();
|
||||||
myClientKickCounterList.insert(nick, tmpInfos);
|
myClientKickCounterList.insert(nick, tmpInfos);
|
||||||
|
} else {
|
||||||
|
//pleayer is already on the list: either raise kickNumber or kickban when kickNumerToBan is reached
|
||||||
|
if(j.value().kickNumber == kickNumberToBan) {
|
||||||
|
action = KICKBAN;
|
||||||
|
//remove player from kickCounterList
|
||||||
|
myClientKickCounterList.remove(j.key());
|
||||||
|
} else {
|
||||||
|
ClientKickInfos tmpInfos;
|
||||||
|
tmpInfos.kickNumber = j.value().kickNumber+1;
|
||||||
|
tmpInfos.lastKickTimestamp = timer.elapsed().total_seconds();
|
||||||
|
myClientKickCounterList.insert(nick, tmpInfos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -146,6 +153,9 @@ QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
|||||||
} else if(action == KICKBAN) {
|
} else if(action == KICKBAN) {
|
||||||
returnMessage = QString("%1 kicked and banned! Please respect: http://chatrules.pokerth.net\n").arg(nick);
|
returnMessage = QString("%1 kicked and banned! Please respect: http://chatrules.pokerth.net\n").arg(nick);
|
||||||
returnAction = QString("kickban");
|
returnAction = QString("kickban");
|
||||||
|
} else if(action == MUTE) {
|
||||||
|
returnMessage = QString("%1 muted! Please respect: http://chatrules.pokerth.net\n").arg(nick);
|
||||||
|
returnAction = QString("mute");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
returnAction = QString("");
|
returnAction = QString("");
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
MessageFilter(CleanerConfig*);
|
MessageFilter(CleanerConfig*);
|
||||||
~MessageFilter();
|
~MessageFilter();
|
||||||
|
|
||||||
QStringList check(unsigned, QString, QString);
|
QStringList check(unsigned, unsigned, QString, QString);
|
||||||
void refreshConfig();
|
void refreshConfig();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
Reference in New Issue
Block a user