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.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/server/src/server.cc b/server/src/server.cc
index 65fd782..27a6b9d 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -78,7 +78,7 @@ static void connection(TCPSocket &socket)
//
// Handle commits
//
- if(transaction.commits.size() > 0) {
+ {
Commits::iterator i = transaction.commits.begin();
while(i != transaction.commits.end()) {
Commit &commit = *i;
@@ -90,15 +90,15 @@ static void connection(TCPSocket &socket)
db.commit(transaction.user, transaction.cpr, *macro, commit.fields);
std::string resume = resume_parser(macro->attributes["resume"].c_str(), commit);
-
+
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());
-
+
i++;
}
}
-
+
//
// Handle requests
//
@@ -108,12 +108,9 @@ static void connection(TCPSocket &socket)
std::string answer;
- MacroParser mp(request.macro);
- mp.parse();
- Macro *m = mp.getMacro();
-
- printf("Handling request - macro: %s, course: %s\n", request.macro.c_str(), request.course.c_str());
-
+ printf("Handling request - macro: %s, course: %s\n",
+ request.macro.c_str(), request.course.c_str());
+
// Read and parse the template file.
TemplateParser tp(request.course);
tp.parse();
@@ -170,6 +167,10 @@ static void connection(TCPSocket &socket)
if(macro.attributes["name"] == request.macro) {
+ MacroParser mp(request.macro);
+ mp.parse();
+ Macro *m = mp.getMacro();
+
// Handle lua programs
if(m->scripts.size()) {
answer += " <scripts>\n";