continued working on todo module
This commit is contained in:
parent
52eb067cd9
commit
085d5cd193
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,4 +6,5 @@ release/*
|
||||
*.Release
|
||||
Makefile
|
||||
ui_*
|
||||
bin/*
|
||||
bin/*
|
||||
build*
|
@ -1,6 +1,7 @@
|
||||
#include "todomodule.h"
|
||||
#include "message.h"
|
||||
#include <time.h>
|
||||
#include <QStringList>
|
||||
|
||||
TodoModule::TodoModule()
|
||||
{
|
||||
@ -13,18 +14,48 @@ bool TodoModule::messageHandler(Message msg)
|
||||
{
|
||||
if(msg.args.startsWith("!todo "))
|
||||
{
|
||||
answer = usage(TODO);
|
||||
Task t;
|
||||
int deltaIndex = 1;
|
||||
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]]
|
||||
if(splitter[deltaIndex].compare("to") == 0)
|
||||
{
|
||||
deltaIndex += 2;
|
||||
t.emitter = splitter[2];
|
||||
}
|
||||
if(splitter.size() < deltaIndex+2)
|
||||
return true;
|
||||
QString dateString = splitter[deltaIndex];
|
||||
if(dateString.startsWith("date("))
|
||||
{
|
||||
//t.date += dateString;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString TodoModule::usage(int type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TODO:
|
||||
return say("usage = !todo [to TARGET] DATE | DURATION [every DURATION] DESCRIPTION");
|
||||
case DURATION:
|
||||
return say("DURATION = HOURS[:MINUTES[:SECONDS]]");
|
||||
case DATE:
|
||||
return say("DATE = date(DAY/MONTH-[HOUR[:MINUTE[:SECOND]]])");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TodoModule::addTask(unsigned long date, unsigned long repeat, QString description, QString emitter, QString recipient, bool isPrivate)
|
||||
|
@ -19,6 +19,9 @@ class TodoModule : public Module
|
||||
|
||||
std::vector<Task> tasks;
|
||||
|
||||
enum {TODO, DURATION, DATE};
|
||||
QString usage(int);
|
||||
|
||||
public:
|
||||
TodoModule();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user