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) {
|
||||
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 checkMessage = checkreturn.at(1);
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ enum ActionType {
|
||||
NOTHING,
|
||||
WARN,
|
||||
KICK,
|
||||
KICKBAN
|
||||
KICKBAN,
|
||||
MUTE
|
||||
};
|
||||
|
||||
enum OffenceType {
|
||||
@@ -49,7 +50,7 @@ MessageFilter::~MessageFilter()
|
||||
delete cleanTimer;
|
||||
}
|
||||
|
||||
QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
||||
QStringList MessageFilter::check(unsigned gameId, unsigned playerId, QString nick, QString msg)
|
||||
{
|
||||
QStringList returnList;
|
||||
QString returnMessage;
|
||||
@@ -77,6 +78,11 @@ QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
||||
action = WARN;
|
||||
} else {
|
||||
if(i.value().warnLevel == warnLevelToKick || i.value().lastWarnType == offence) {
|
||||
if(gameId) {
|
||||
//check for ingame to do not kick but mute
|
||||
action = MUTE;
|
||||
}
|
||||
else {
|
||||
// Kick Command
|
||||
action = KICK;
|
||||
//remove playerId from all lists and as LAST from myClientWarnLevelList
|
||||
@@ -103,6 +109,7 @@ QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
||||
myClientKickCounterList.insert(nick, tmpInfos);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ClientWarnInfos tmpInfos;
|
||||
tmpInfos.warnLevel = i.value().warnLevel+1;
|
||||
@@ -146,6 +153,9 @@ QStringList MessageFilter::check(unsigned playerId, QString nick, QString msg)
|
||||
} else if(action == KICKBAN) {
|
||||
returnMessage = QString("%1 kicked and banned! Please respect: http://chatrules.pokerth.net\n").arg(nick);
|
||||
returnAction = QString("kickban");
|
||||
} else if(action == MUTE) {
|
||||
returnMessage = QString("%1 muted! Please respect: http://chatrules.pokerth.net\n").arg(nick);
|
||||
returnAction = QString("mute");
|
||||
}
|
||||
} else {
|
||||
returnAction = QString("");
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
MessageFilter(CleanerConfig*);
|
||||
~MessageFilter();
|
||||
|
||||
QStringList check(unsigned, QString, QString);
|
||||
QStringList check(unsigned, unsigned, QString, QString);
|
||||
void refreshConfig();
|
||||
|
||||
public slots:
|
||||
|
||||
Reference in New Issue
Block a user