added funny module
This commit is contained in:
parent
58d369b018
commit
3a923dd675
@ -12,9 +12,11 @@ INCLUDEPATH += ../ircbot
|
|||||||
SOURCES = main.cpp \
|
SOURCES = main.cpp \
|
||||||
regismodule.cpp \
|
regismodule.cpp \
|
||||||
sparrowmodule.cpp \
|
sparrowmodule.cpp \
|
||||||
vocab.cpp
|
vocab.cpp \
|
||||||
|
poilaumodule.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
regismodule.h \
|
regismodule.h \
|
||||||
sparrowmodule.h \
|
sparrowmodule.h \
|
||||||
vocab.h
|
vocab.h \
|
||||||
|
poilaumodule.h
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "basemodule.h"
|
#include "basemodule.h"
|
||||||
#include "regismodule.h"
|
#include "regismodule.h"
|
||||||
#include "sparrowmodule.h"
|
#include "sparrowmodule.h"
|
||||||
|
#include "poilaumodule.h"
|
||||||
|
|
||||||
class HelloWorldModule : public Module
|
class HelloWorldModule : public Module
|
||||||
{
|
{
|
||||||
@ -32,5 +33,6 @@ int main(int argc, char *argv[])
|
|||||||
app.addModule(new HelloWorldModule());
|
app.addModule(new HelloWorldModule());
|
||||||
app.addModule(new RegisModule());
|
app.addModule(new RegisModule());
|
||||||
app.addModule(new SparrowModule());
|
app.addModule(new SparrowModule());
|
||||||
|
app.addModule(new PoilAuModule());
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
93
app/poilaumodule.cpp
Normal file
93
app/poilaumodule.cpp
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#include "poilaumodule.h"
|
||||||
|
#include "message.h"
|
||||||
|
|
||||||
|
#define VOY_NONE -1
|
||||||
|
enum{VOY_A, VOY_E, VOY_I, VOY_O, VOY_U, VOY_ET, VOY_AI, VOY_OU, VOY_IN, VOY_EN, VOY_OUILLE};
|
||||||
|
|
||||||
|
bool PoilAuModule::messageHandler(Message msg)
|
||||||
|
{
|
||||||
|
int voy = VOY_NONE;
|
||||||
|
|
||||||
|
if(msg.args.endsWith("eu", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_E;
|
||||||
|
else if(msg.args.endsWith("au", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_O;
|
||||||
|
else if(msg.args.endsWith("ou", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_OU;
|
||||||
|
else if(msg.args.endsWith("u", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_U;
|
||||||
|
|
||||||
|
if(msg.args.endsWith("oo", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_OU;
|
||||||
|
else if(msg.args.endsWith("o", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_O;
|
||||||
|
|
||||||
|
if(msg.args.endsWith("et", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_ET;
|
||||||
|
if(msg.args.endsWith("é", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_ET;
|
||||||
|
if(msg.args.endsWith("er", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_ET;
|
||||||
|
if(msg.args.endsWith("è", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_AI;
|
||||||
|
if(msg.args.endsWith("ai", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_AI;
|
||||||
|
if(msg.args.endsWith("an", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_EN;
|
||||||
|
if(msg.args.endsWith("en", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_EN;
|
||||||
|
if(msg.args.endsWith("in", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_IN;
|
||||||
|
if(msg.args.endsWith("a", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_A;
|
||||||
|
if(msg.args.endsWith("i", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_I;
|
||||||
|
if(msg.args.endsWith("ouille", Qt::CaseInsensitive))
|
||||||
|
voy = VOY_OUILLE;
|
||||||
|
|
||||||
|
if(voy == VOY_NONE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch(voy)
|
||||||
|
{
|
||||||
|
case VOY_A :
|
||||||
|
answer = say("Poil au bras.");
|
||||||
|
break;
|
||||||
|
case VOY_E :
|
||||||
|
answer = say("Poil aux cheveux.");
|
||||||
|
break;
|
||||||
|
case VOY_I :
|
||||||
|
answer = say("Poil à la vessie.");
|
||||||
|
break;
|
||||||
|
case VOY_O :
|
||||||
|
answer = say("Poil au dos.");
|
||||||
|
break;
|
||||||
|
case VOY_U :
|
||||||
|
answer = say("Poil au cul.");
|
||||||
|
break;
|
||||||
|
case VOY_ET :
|
||||||
|
answer = say("Poil au nez.");
|
||||||
|
break;
|
||||||
|
case VOY_AI :
|
||||||
|
answer = say("Poil au nez.");
|
||||||
|
break;
|
||||||
|
case VOY_OU :
|
||||||
|
answer = say("Poil au cou.");
|
||||||
|
break;
|
||||||
|
case VOY_IN :
|
||||||
|
answer = say("Poil aux mains.");
|
||||||
|
break;
|
||||||
|
case VOY_EN :
|
||||||
|
answer = say("Poil aux dents.");
|
||||||
|
break;
|
||||||
|
case VOY_OUILLE :
|
||||||
|
answer = say("Poil aux couilles.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PoilAuModule::getName()
|
||||||
|
{
|
||||||
|
return "poilau";
|
||||||
|
}
|
13
app/poilaumodule.h
Normal file
13
app/poilaumodule.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef POILAUMODULE_H
|
||||||
|
#define POILAUMODULE_H
|
||||||
|
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
class PoilAuModule : public Module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool messageHandler(Message msg);
|
||||||
|
virtual QString getName();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // POILAUMODULE_H
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "prompt.h"
|
#include "prompt.h"
|
||||||
|
|
||||||
Prompt::setChan(const QString& myChan)
|
void Prompt::setChan(const QString& myChan)
|
||||||
{
|
{
|
||||||
chan = myChan;
|
chan = myChan;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class Prompt : public QLineEdit
|
|||||||
public:
|
public:
|
||||||
Prompt(QWidget*& w) : QLineEdit(w), chan("epicsparrow") {}
|
Prompt(QWidget*& w) : QLineEdit(w), chan("epicsparrow") {}
|
||||||
|
|
||||||
setChan(const QString& myChan);
|
void setChan(const QString& myChan);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void advancedConfirmationPerformed();
|
void advancedConfirmationPerformed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user