added curse
This commit is contained in:
parent
9a3052e9cb
commit
1e0b06f437
@ -2,14 +2,34 @@
|
|||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "user.h"
|
||||||
|
|
||||||
#define VOY_NONE -1
|
#define VOY_NONE -1
|
||||||
enum{VOY_A, VOY_E, VOY_I, VOY_O, VOY_U, VOY_ET, VOY_AI, VOY_OU, VOY_IN, VOY_ON, VOY_OI, VOY_EN, VOY_OUILLE, VOY_ATTE, VOY_US};
|
enum{VOY_A, VOY_E, VOY_I, VOY_O, VOY_U, VOY_ET, VOY_AI, VOY_OU, VOY_IN, VOY_ON, VOY_OI, VOY_EN, VOY_OUILLE, VOY_ATTE, VOY_US};
|
||||||
|
|
||||||
bool PoilAuModule::messageHandler(Message msg)
|
bool PoilAuModule::messageHandler(Message msg)
|
||||||
{
|
{
|
||||||
|
if(msg.args.startsWith("!curse ") == 0 && getUsers()->getFromNick(msg.nick)->isOp())
|
||||||
|
{
|
||||||
|
QStringList str = msg.args.split(' ');
|
||||||
|
if(str.size() == 2)
|
||||||
|
{
|
||||||
|
setCursed(str[1]);
|
||||||
|
answer = say(QString("%1 is now the cursed").arg(str[1]));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.command.compare("NICK", Qt::CaseInsensitive) == 0 && msg.nick.compare(cursedNick) == 0)
|
||||||
|
{
|
||||||
|
setCursed(msg.args);
|
||||||
|
answer = say(QString("%1 is now the cursed").arg(msg.args));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.args.startsWith("!")) return false;
|
if (msg.args.startsWith("!")) return false;
|
||||||
if(!isReady)
|
bool cursed = (cursedNick.compare(msg.nick) == 0);
|
||||||
|
if(!isReady && !cursed)
|
||||||
return false;
|
return false;
|
||||||
if(msg.command.compare(QString("PRIVMSG"), Qt::CaseInsensitive) != 0)
|
if(msg.command.compare(QString("PRIVMSG"), Qt::CaseInsensitive) != 0)
|
||||||
return false;
|
return false;
|
||||||
@ -173,6 +193,10 @@ void PoilAuModule::setReady()
|
|||||||
isReady = true;
|
isReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PoilAuModule::setCursed(QString nick)
|
||||||
|
{
|
||||||
|
cursedNick = nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,14 +9,16 @@ class PoilAuModule : public QObject, public Module
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
bool isReady;
|
bool isReady;
|
||||||
|
QString cursedNick;
|
||||||
public:
|
public:
|
||||||
PoilAuModule() : isReady(true) {}
|
PoilAuModule() : isReady(true), cursedNick("CaptainPlop") {}
|
||||||
|
|
||||||
virtual bool messageHandler(Message msg);
|
virtual bool messageHandler(Message msg);
|
||||||
virtual QString getName();
|
virtual QString getName();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setReady();
|
void setReady();
|
||||||
|
void setCursed(QString);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // POILAUMODULE_H
|
#endif // POILAUMODULE_H
|
||||||
|
@ -69,6 +69,9 @@ bool PunisherModule::messageHandler(Message msg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(msg.nick.compare("LadySparrow") == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
for(const QString &w : forbidden_words)
|
for(const QString &w : forbidden_words)
|
||||||
{
|
{
|
||||||
if(msg.args.contains(w, Qt::CaseInsensitive))
|
if(msg.args.contains(w, Qt::CaseInsensitive))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user