summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authordeva <deva>2008-03-18 11:24:44 +0000
committerdeva <deva>2008-03-18 11:24:44 +0000
commit589fd5ffdeaae87410c31c497083e609e7ae1f53 (patch)
treec8c7eada1049e3ed256248200ec1e76345276e2e /server/src
parenta860976a62d206a1de5aa46f624bcac0036f47c2 (diff)
Added journal commit code.
Diffstat (limited to 'server/src')
-rw-r--r--server/src/Makefile.am2
-rw-r--r--server/src/macro_parser.cc7
-rw-r--r--server/src/server.cc13
3 files changed, 17 insertions, 5 deletions
diff --git a/server/src/Makefile.am b/server/src/Makefile.am
index 672b8e7..f145250 100644
--- a/server/src/Makefile.am
+++ b/server/src/Makefile.am
@@ -11,6 +11,7 @@ pracrod_SOURCES = \
database.cc \
configuration.cc \
exception.cc \
+ journal_commit.cc \
log.cc \
macro_parser.cc \
resumeparser.cc \
@@ -26,6 +27,7 @@ EXTRA_DIST = \
database.h \
debug.h \
exception.h \
+ journal_commit.h \
log.h \
macro.h \
macro_parser.h \
diff --git a/server/src/macro_parser.cc b/server/src/macro_parser.cc
index aeeb84f..7fc9609 100644
--- a/server/src/macro_parser.cc
+++ b/server/src/macro_parser.cc
@@ -70,6 +70,13 @@ static void start_hndl(void *p, const char *el, const char **attr)
// Do something reasonable with them...
+ if(name == "macro") {
+ printf("Macro %s %s\n", attributes["name"].c_str(), attributes["resume"].c_str());
+ parser->macro->name = attributes["name"];
+ parser->macro->format = attributes["resume"];
+ // return;
+ }
+
if(name == "include") {
Macro inc;
diff --git a/server/src/server.cc b/server/src/server.cc
index 815f0db..756539f 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -50,6 +50,8 @@
#include "tostring.h"
#include <time.h>
+#include "journal_commit.h"
+
static void send_macro_widget(Widget &widget, TCPSocket &socket, std::string tabs)
{
socket.write(tabs + "<" + widget.type);
@@ -113,14 +115,15 @@ static void connection(TCPSocket &socket)
Macro macro;
parse_macro(commit.macro, macro);
- //parse_macro("example", macro);
-
- macro.format = "Det koster 50$$\\n\\tLinse: ${linse}D\\n"
- "\\y${combo}\\\\\\nHævelse: ${radio}\\n\\n${spl_note}";
std::string resume = resume_parser(macro.format.c_str(), commit);
- printf("%s\n", resume.c_str());
+ std::string journal_commit_addr = config()->lookup("journal_commit_addr");
+ int journal_commit_port = config()->lookup("journal_commit_port");
+
+ journal_commit(transaction.cpr.c_str(), transaction.user.c_str(),
+ journal_commit_addr.c_str(), journal_commit_port,
+ resume.c_str(), resume.length());
i++;
}