fixed case sensitive forbidden word, added remove command
This commit is contained in:
parent
0a74b22efc
commit
70e0a150a7
@ -12,7 +12,7 @@ bool PunisherModule::messageHandler(Message msg)
|
||||
{
|
||||
for(const QString &w : forbidden_words)
|
||||
{
|
||||
if(msg.args.contains(w))
|
||||
if(msg.args.contains(w, Qt::CaseInsensitive))
|
||||
{
|
||||
answer = QString("KICK #%1 %2\r\n").arg(getChan()).arg(msg.nick);
|
||||
return true;
|
||||
@ -34,6 +34,30 @@ bool PunisherModule::messageHandler(Message msg)
|
||||
return true;
|
||||
}
|
||||
|
||||
if(msg.args.startsWith("!forbidden remove ") && getUsers()->getFromNick(msg.nick)->isOp())
|
||||
{
|
||||
QStringList str = msg.args.split(' ');
|
||||
int i=2;
|
||||
answer = QString("");
|
||||
for(; i<str.size(); ++i)
|
||||
{
|
||||
for(auto it = forbidden_words.begin(); it != forbidden_words.end(); it++)
|
||||
{
|
||||
if(str[i].compare(*it, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
forbidden_words.erase(it);
|
||||
answer += say(QString("removed %1 to the list of forbidden words").arg(str[i]));
|
||||
}
|
||||
else
|
||||
answer += say(QString("%1 was not part of the list of forbidden words").arg(str[i]));
|
||||
}
|
||||
|
||||
}
|
||||
if(i==2)
|
||||
answer = say(QString("missing argument"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(msg.args.compare("!forbidden reset") == 0 && getUsers()->getFromNick(msg.nick)->isOp())
|
||||
{
|
||||
forbidden_words.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user