diff options
-rw-r--r-- | src/messagehandler.cc | 4 | ||||
-rw-r--r-- | src/taskmanager.cc | 3 |
2 files changed, 5 insertions, 2 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 cf7defc..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,6 +128,7 @@ TaskIdList TaskManager::createTask(taskid_t parentid) taskid_t id = createId(); t.title = ""; t.id = id; + if(pid) *pid = id; try { affectedTasks = tree.insertAsChild(parentid, id, t); |