diff options
-rw-r--r-- | src/messagehandler.cc | 4 | ||||
-rw-r--r-- | src/taskmanager.cc | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/messagehandler.cc b/src/messagehandler.cc index 0b63da1..8217bde 100644 --- a/src/messagehandler.cc +++ b/src/messagehandler.cc @@ -48,7 +48,9 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) { { INFO(messagehandler, "Handling create command\n"); try { - m.nodes = task_manager.createTask(m.create.parentid); + taskid_t id; + m.nodes = task_manager.createTask(m.create.parentid, &id); + m.create.id = id; outmsgs.push_back(m); } catch (std::exception& e) { diff --git a/src/taskmanager.cc b/src/taskmanager.cc index 479299c..2dda0e0 100644 --- a/src/taskmanager.cc +++ b/src/taskmanager.cc @@ -120,7 +120,7 @@ TaskIdList TaskManager::updateTask(taskid_t id, task_t t) return affectedTasks; } -TaskIdList TaskManager::createTask(taskid_t parentid) +TaskIdList TaskManager::createTask(taskid_t parentid, taskid_t *pid) throw (std::exception) { TaskIdList affectedTasks; @@ -128,8 +128,8 @@ TaskIdList TaskManager::createTask(taskid_t parentid) taskid_t id = createId(); t.title = ""; t.id = id; + if(pid) *pid = id; -// printf("Created node with id %d\n", t.id); try { affectedTasks = tree.insertAsChild(parentid, id, t); } |