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,6 +78,11 @@ 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) {
|
||||||
|
if(gameId) {
|
||||||
|
//check for ingame to do not kick but mute
|
||||||
|
action = MUTE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Kick Command
|
// Kick Command
|
||||||
action = KICK;
|
action = KICK;
|
||||||
//remove playerId from all lists and as LAST from myClientWarnLevelList
|
//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);
|
myClientKickCounterList.insert(nick, tmpInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ClientWarnInfos tmpInfos;
|
ClientWarnInfos tmpInfos;
|
||||||
tmpInfos.warnLevel = i.value().warnLevel+1;
|
tmpInfos.warnLevel = i.value().warnLevel+1;
|
||||||
@@ -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