diff options
Diffstat (limited to 'server/src/server.cc')
-rw-r--r-- | server/src/server.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/server/src/server.cc b/server/src/server.cc index 92afbd0..2f2ee69 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -94,16 +94,20 @@ static std::string handleTransaction(Transaction *transaction, db->commit(transaction->user, transaction->cpr, *macro, commit.fields); - std::string resume = resume_parser(macro->attributes["resume"].c_str(), commit); - - // if(resume != "") { + std::string resume = resume_parser(macro->resume.attributes["format"].c_str(), commit); + + bool store_in_journal = + macro->resume.attributes.find("store_in_journal") != macro->resume.attributes.end() && + macro->resume.attributes["store_in_journal"] == "true"; + + if(resume != "" && store_in_journal) { journal_commit(transaction->cpr.c_str(), transaction->user.c_str(), Conf::journal_commit_addr.c_str(), Conf::journal_commit_port, resume.c_str(), resume.length()); - - db->putJournal(transaction->user, transaction->cpr, - *macro, resume, time(NULL)); - // } + } + + db->putResume(transaction->user, transaction->cpr, + *macro, resume, time(NULL), store_in_journal); i++; } @@ -205,7 +209,7 @@ static std::string handleTransaction(Transaction *transaction, if(completed) { answer += " <resume>"; answer += db->getResume(transaction->cpr, macro.attributes["name"], time(NULL) - Conf::db_max_ttl); - answer += " </resume>\n"; + answer += "</resume>\n"; } answer += " </macro>\n"; |