diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-10 08:55:01 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-10 08:55:01 +0200 |
commit | 33bfd025958e4485f4647d22fb9aec5d7d94db81 (patch) | |
tree | 3c9e3e2dfc1651ebd5c2e5895ab2825b39d948b1 /src | |
parent | c5fb4fd4d89086399762ac844b53564d98ff2d4e (diff) |
Ignore remove/move/update commands on protected taskids (root, Finished, etc...)
Diffstat (limited to 'src')
-rw-r--r-- | src/muniacli.cc | 2 | ||||
-rw-r--r-- | src/taskmanager.cc | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/muniacli.cc b/src/muniacli.cc index 3620a85..a84de65 100644 --- a/src/muniacli.cc +++ b/src/muniacli.cc @@ -34,7 +34,7 @@ #include <libwebsockets.h> enum demo_protocols { - PROTOCOL_TASK, + PROTOCOL_TASK }; static int callback_task(struct libwebsocket_context *me, diff --git a/src/taskmanager.cc b/src/taskmanager.cc index b50e9a6..87cf2b0 100644 --- a/src/taskmanager.cc +++ b/src/taskmanager.cc @@ -39,6 +39,11 @@ TaskManager task_manager; #define PROJECTS_ID 4 #define FIRST_TASK_ID 10 +static bool isProtected(taskid_t id) +{ + return id < FIRST_TASK_ID; +} + TaskManager::TaskManager() { idCount = FIRST_TASK_ID; @@ -79,6 +84,9 @@ taskid_t TaskManager::createId() { TaskIdList TaskManager::moveTask(taskid_t id, taskid_t to) throw (std::exception) { + + if(isProtected(id)) return TaskIdList(); + TaskIdList affectedTasks; try { @@ -93,6 +101,9 @@ TaskIdList TaskManager::moveTask(taskid_t id, taskid_t to) TaskIdList TaskManager::removeTask(taskid_t id) throw (std::exception) { + + if(isProtected(id)) return TaskIdList(); + TaskIdList affectedTasks; if(tree.bfs(id).size() > 1) throw std::exception(); @@ -110,6 +121,8 @@ TaskIdList TaskManager::removeTask(taskid_t id) TaskIdList TaskManager::updateTask(taskid_t id, task_t t) throw (std::exception) { + if(isProtected(id)) return TaskIdList(); + TaskIdList affectedTasks; try { |