summaryrefslogtreecommitdiff
path: root/server/src/server.cc
diff options
context:
space:
mode:
authordeva <deva>2007-10-01 15:18:21 +0000
committerdeva <deva>2007-10-01 15:18:21 +0000
commitc09b06d5e765955ea41c6b02891390ed6a714e55 (patch)
treeb90a1a919fd086146256a4ef5ecc44faa2dd5c51 /server/src/server.cc
parent1890cff193f6e5c10c7581b0767bbb5ac91f8cc7 (diff)
Now the resume is generated using a format string.
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");