summaryrefslogtreecommitdiff
path: root/src/messagehandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/messagehandler.cc')
-rw-r--r--src/messagehandler.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/messagehandler.cc b/src/messagehandler.cc
index 89b476a..18d5fed 100644
--- a/src/messagehandler.cc
+++ b/src/messagehandler.cc
@@ -28,10 +28,9 @@
#include "messagehandler.h"
#include "debug.h"
+// Defines global task_manager object
#include "taskmanager.h"
-TaskManager taskman;
-
MessageList handle_msg(MessageList msgList, clientid_t wsi) {
MessageList::iterator it;
@@ -44,11 +43,11 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
case cmd::add:
{
INFO(messagehandler, "Handling add command\n");
- task_t t = taskman.createTask();
+ task_t t = task_manager.createTask();
t.title = m.add.title;
t.desc = m.add.desc;
try {
- it->nodes = taskman.addTask(t, m.add.parentid);
+ it->nodes = task_manager.addTask(t, m.add.parentid);
}
catch (std::exception& e) {
DEBUG(messagehandler, "Error adding task\n");
@@ -59,7 +58,7 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
{
INFO(messagehandler, "Handling del command\n");
try {
- it->nodes = taskman.deleteTask(m.del.id);
+ it->nodes = task_manager.deleteTask(m.del.id);
}
catch (std::exception& e) {
DEBUG(messagehandler, "Error deleting task\n");
@@ -70,7 +69,7 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
{
INFO(messagehandler, "Handling move command\n");
try {
- it->nodes = taskman.moveTask(m.move.id, m.move.parentid);
+ it->nodes = task_manager.moveTask(m.move.id, m.move.parentid);
}
catch (std::exception& e) {
DEBUG(messagehandler, "Error moving task\n");
@@ -90,7 +89,7 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
task_t t;
t.title = m.update.title;
t.desc = m.update.desc;
- it->nodes = taskman.updateTask(m.update.id, t);
+ it->nodes = task_manager.updateTask(m.update.id, t);
}
catch (std::exception& e) {
DEBUG(messagehandler, "Error updating task\n");
@@ -101,7 +100,7 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
WARN(messagehandler, "!!! Unknown command\n");
break;
}
- taskman.tree.toStdOut();
+ task_manager.tree.toStdOut();
printf("%d affected nodes registered\n", m.nodes.size());
}