summaryrefslogtreecommitdiff
path: root/server/src/server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/server.cc')
-rw-r--r--server/src/server.cc42
1 files changed, 25 insertions, 17 deletions
diff --git a/server/src/server.cc b/server/src/server.cc
index 064d8b9..815f0db 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -45,6 +45,11 @@
#include "macro.h"
#include "macro_parser.h"
+#include "resumeparser.h"
+
+#include "tostring.h"
+#include <time.h>
+
static void send_macro_widget(Widget &widget, TCPSocket &socket, std::string tabs)
{
socket.write(tabs + "<" + widget.type);
@@ -97,26 +102,29 @@ static void connection(TCPSocket &socket)
// Handle commits
if(transaction.commits.size() > 0) {
- Database db;
- db.post(transaction);
- }
+ std::string now = toString((unsigned int)time(NULL));
- /*
- Commits::iterator j = transaction.commits.begin();
- while(j != transaction.commits.end()) {
- Commit &commit = *j;
- printf("Commit %s\n", commit.macro.c_str());
-
- Fields::iterator k = commit.fields.begin();
- while(k != commit.fields.end()) {
- Field &val = *k;
- printf("\t%s=%s\n", val.name.c_str(), val.value.c_str());
- k++;
- }
+ Commits::iterator i = transaction.commits.begin();
+ while(i != transaction.commits.end()) {
+ Commit &commit = *i;
+
+ Database db;
+ db.post(transaction.user, transaction.cpr, now, commit);
- j++;
+ 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());
+
+ i++;
+ }
}
- */
socket.write("</pracro>\n");