summaryrefslogtreecommitdiff
path: root/server/src/server.cc
diff options
context:
space:
mode:
authordeva <deva>2008-07-30 12:58:13 +0000
committerdeva <deva>2008-07-30 12:58:13 +0000
commit6c9a544e63e73c8aa3e990e9370ca9c582612f49 (patch)
tree76c2cdd65500116dc5b1539ef1baa0eedeacc01f /server/src/server.cc
parent0da554ba6a55bbc195a30afa8f154af2ec2107a7 (diff)
Reenabled support for upload server. Currently only tested against local print-to-screen version.
Diffstat (limited to 'server/src/server.cc')
-rw-r--r--server/src/server.cc44
1 files changed, 18 insertions, 26 deletions
diff --git a/server/src/server.cc b/server/src/server.cc
index 1bd0ccf..65fd782 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -83,28 +83,18 @@ static void connection(TCPSocket &socket)
while(i != transaction.commits.end()) {
Commit &commit = *i;
- /*
- Macro macro;
- MacroParser parser(commit.macro, macro);
- parser.parse();
- */
-
- Macro macro;
- macro.attributes["name"] = commit.macro;
- macro.attributes["version"] = "1.0";//commit.version;
-
- db.commit(transaction.user, transaction.cpr, macro, commit.fields);
+ MacroParser mp(commit.macro);
+ mp.parse();
+ Macro *macro = mp.getMacro();
+
+ db.commit(transaction.user, transaction.cpr, *macro, commit.fields);
- /*
- std::string resume = resume_parser(macro.format.c_str(), commit);
+ std::string resume = resume_parser(macro->attributes["resume"].c_str(), commit);
- 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());
- */
+ 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++;
}
}
@@ -175,20 +165,22 @@ static void connection(TCPSocket &socket)
answer += " <macro name=\"" + macro.attributes["name"] + "\" completed=";
if(db.checkMacro(transaction.cpr, macro.attributes["name"])) answer += "\"true\"";
else answer += "\"false\"";
+ // answer += " resume=\"" + macro.attributes["resume"] + "\"";
answer += ">\n";
if(macro.attributes["name"] == request.macro) {
// Handle lua programs
- if(m->luaprograms.size()) {
+ if(m->scripts.size()) {
answer += " <scripts>\n";
- std::vector< LUAProgram >::iterator lpi = m->luaprograms.begin();
- while(lpi != m->luaprograms.end()) {
- answer += " <script language=\"lua\" name=\"" + lpi->attributes["name"] + "\">\n";
- answer += xml_encode(lpi->attributes["lua"]);
+ std::vector< Script >::iterator spi = m->scripts.begin();
+ while(spi != m->scripts.end()) {
+ answer += " <script language=\"" + spi->attributes["language"]
+ + "\" name=\"" + spi->attributes["name"] + "\">\n";
+ answer += xml_encode(spi->attributes["code"]);
answer += "\n </script>\n";
- lpi++;
+ spi++;
}
answer += " </scripts>\n";
}