From 68436d0d50b10e0c10c8fa875bfc9e5f81e0c212 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 13 May 2014 22:06:19 -0400 Subject: [PATCH] TDB2 - Integrated hooks to TF2::add_task and TF2::modify_task. --- src/TDB2.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 475e86568..a6428d250 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -134,10 +134,13 @@ bool TF2::get (const std::string& uuid, Task& task) //////////////////////////////////////////////////////////////////////////////// void TF2::add_task (const Task& task) { - _tasks.push_back (task); // For subsequent queries - _added_tasks.push_back (task); // For commit/synch + Task hookTask (task); + context.hooks.onAdd (hookTask); -/* TODO handle 'add' and 'log'. + _tasks.push_back (hookTask); // For subsequent queries + _added_tasks.push_back (hookTask); // For commit/synch + +/* TODO handle 'add' and 'log'? int id = context.tdb2.next_id (); _I2U[id] = task.get ("uuid"); _U2I[task.get ("uuid")] = id; @@ -156,9 +159,13 @@ bool TF2::modify_task (const Task& task) { if (i->get ("uuid") == uuid) { - *i = task; - _modified_tasks.push_back (task); + Task hookTask (task); + context.hooks.onModify (*i, hookTask); + + *i = hookTask; + _modified_tasks.push_back (hookTask); _dirty = true; + return true; } }