first commit of unfinished todo module
This commit is contained in:
parent
1e683c05f6
commit
52eb067cd9
@ -15,7 +15,8 @@ SOURCES = main.cpp \
|
|||||||
vocab.cpp \
|
vocab.cpp \
|
||||||
poilaumodule.cpp \
|
poilaumodule.cpp \
|
||||||
fourasmodule.cpp \
|
fourasmodule.cpp \
|
||||||
riddles.cpp
|
riddles.cpp \
|
||||||
|
todomodule.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
regismodule.h \
|
regismodule.h \
|
||||||
@ -23,4 +24,5 @@ HEADERS += \
|
|||||||
vocab.h \
|
vocab.h \
|
||||||
poilaumodule.h \
|
poilaumodule.h \
|
||||||
fourasmodule.h \
|
fourasmodule.h \
|
||||||
riddles.h
|
riddles.h \
|
||||||
|
todomodule.h
|
||||||
|
@ -31,6 +31,11 @@ bool SparrowModule::messageHandler(Message msg)
|
|||||||
answer = say("sparrowModule v1.0");
|
answer = say("sparrowModule v1.0");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(msg.args.compare("re", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
answer = say("Re");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if(msg.args.startsWith("!devzone"))
|
else if(msg.args.startsWith("!devzone"))
|
||||||
{
|
{
|
||||||
QStringList paramList = msg.args.split(' ');
|
QStringList paramList = msg.args.split(' ');
|
||||||
|
41
app/todomodule.cpp
Normal file
41
app/todomodule.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include "todomodule.h"
|
||||||
|
#include "message.h"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
TodoModule::TodoModule()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TodoModule::messageHandler(Message msg)
|
||||||
|
{
|
||||||
|
if(msg.command.compare(QString("PRIVMSG"), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
if(msg.args.startsWith("!todo "))
|
||||||
|
{
|
||||||
|
Task t;
|
||||||
|
t.isPrivate = !msg.target.contains(getChan());
|
||||||
|
t.emitter = msg.nick;
|
||||||
|
t.date = time(NULL);
|
||||||
|
QStringList splitter = msg.args.split(' ');
|
||||||
|
// !todo [target] durée/date [every durée_repeat] text
|
||||||
|
// date(jour/mois-[heure[:minutes[:secondes]]])
|
||||||
|
// every day / every month / every heures[:minutes[:secondes]]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TodoModule::addTask(unsigned long date, unsigned long repeat, QString description, QString emitter, QString recipient, bool isPrivate)
|
||||||
|
{
|
||||||
|
Task t;
|
||||||
|
t.date = date;
|
||||||
|
t.description = description;
|
||||||
|
t.emitter = emitter;
|
||||||
|
t.recipient = recipient;
|
||||||
|
t.repeat = repeat;
|
||||||
|
t.isPrivate = isPrivate;
|
||||||
|
tasks.push_back(t);
|
||||||
|
// TODO -> append it to save file
|
||||||
|
}
|
31
app/todomodule.h
Normal file
31
app/todomodule.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef TODOMODULE_H
|
||||||
|
#define TODOMODULE_H
|
||||||
|
|
||||||
|
#include "module.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class TodoModule : public Module
|
||||||
|
{
|
||||||
|
typedef struct s_task
|
||||||
|
{
|
||||||
|
unsigned long date;
|
||||||
|
unsigned long repeat;
|
||||||
|
QString description;
|
||||||
|
QString emitter;
|
||||||
|
QString recipient;
|
||||||
|
bool isPrivate;
|
||||||
|
} Task;
|
||||||
|
|
||||||
|
std::vector<Task> tasks;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TodoModule();
|
||||||
|
|
||||||
|
virtual bool messageHandler(Message msg);
|
||||||
|
virtual QString getName() {return "todo";}
|
||||||
|
|
||||||
|
void addTask(unsigned long date, unsigned long repeat, QString description, QString emitter, QString recipient, bool isPrivate);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TODOMODULE_H
|
Loading…
x
Reference in New Issue
Block a user