SparrowBot/app/todomodule.cpp
2015-08-24 17:42:15 +02:00

42 lines
1.1 KiB
C++

#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
}