#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) { if(msg.command.compare(QString("PRIVMSG"), Qt::CaseInsensitive) != 0) return false; 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("ai", Qt::CaseInsensitive)) voy = VOY_AI; else if(msg.args.endsWith("i", Qt::CaseInsensitive)) voy = VOY_I; 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("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("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"; }