From 33bfd025958e4485f4647d22fb9aec5d7d94db81 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 10 May 2012 08:55:01 +0200 Subject: Ignore remove/move/update commands on protected taskids (root, Finished, etc...) --- src/muniacli.cc | 2 +- src/taskmanager.cc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') 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 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 { -- cgit v1.2.3