summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/muniacli.cc2
-rw-r--r--src/taskmanager.cc13
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 {