summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2008-06-09 13:48:06 +0000
committerdeva <deva>2008-06-09 13:48:06 +0000
commit775021103ccd27d8be5aa92cc3cd21ce6c547c48 (patch)
treed19599a96933b812549d90d6a6da6fbaad4d5c8d
parent4d39f5e52e1ca9e26a397eb4bcc2fe7bad18cdfe (diff)
Added xml encoding of the lua programs to make sure they are not interrupting the xml.
-rw-r--r--client/lua.cc2
-rw-r--r--server/src/Makefile.am13
-rw-r--r--server/src/server.cc10
-rw-r--r--server/src/templateparser.cc2
4 files changed, 16 insertions, 11 deletions
diff --git a/client/lua.cc b/client/lua.cc
index abd834d..1be850c 100644
--- a/client/lua.cc
+++ b/client/lua.cc
@@ -136,6 +136,8 @@ bool LUA::run(QString program, QString name, QString value)
if(macrowindow->luaprograms.contains(program) == false) return false;
+ printf("%s\n", macrowindow->luaprograms.value(program).toStdString().c_str());
+
lua_pushstring(L, value.toStdString().c_str());
lua_setglobal(L, "value");
diff --git a/server/src/Makefile.am b/server/src/Makefile.am
index abf9da7..594bfdb 100644
--- a/server/src/Makefile.am
+++ b/server/src/Makefile.am
@@ -23,7 +23,8 @@ pracrod_SOURCES = \
templateparser.cc \
transactionparser.cc \
tcpsocket.cc \
- widgetgenerator.cc
+ widgetgenerator.cc \
+ xml_encode_decode.cc
EXTRA_DIST = \
configuration.h \
@@ -43,7 +44,8 @@ EXTRA_DIST = \
templateparser.h \
transactionparser.h \
tcpsocket.h \
- widgetgenerator.h
+ widgetgenerator.h \
+ xml_encode_decode.h
TESTFILES = \
test_queryhandler \
@@ -52,7 +54,9 @@ TESTFILES = \
test_templateparser \
test_server \
test_database \
- test_macroparser
+ test_macroparser \
+ test_xml_encode_decode
+
TESTLOGS = `for F in ${TESTFILES}; do echo $$F.log; done`
@@ -85,4 +89,7 @@ test_server: server.cc
test_database: database.cc
@../../tools/test database.cc $(PQXX_LIBS) $(PQXX_CXXFLAGS)
+test_xml_encode_decode: xml_encode_decode.cc
+ @../../tools/test xml_encode_decode.cc
+
CLEANFILES = $(TESTFILES) $(TESTLOGS) *~
diff --git a/server/src/server.cc b/server/src/server.cc
index 2ea782d..a94a0f8 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -47,6 +47,7 @@
#include "widgetgenerator.h"
#include "resumeparser.h"
#include "journal_commit.h"
+#include "xml_encode_decode.h"
static std::string error_box(std::string message)
{
@@ -178,22 +179,15 @@ static void connection(TCPSocket &socket)
std::vector< LUAProgram >::iterator lpi = m->luaprograms.begin();
while(lpi != m->luaprograms.end()) {
answer += " <luaprogram name=\"" + lpi->attributes["name"] + "\">\n";
-
- answer += lpi->attributes["lua"];
-
+ answer += xml_encode(lpi->attributes["lua"]);
answer += "\n </luaprogram>\n";
-
lpi++;
}
-
answer += " </luaprograms>\n";
}
-
answer += widgetgenerator(*m, lqm, db);
}
-
answer += " </macro>\n";
-
mi2++;
}
diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc
index 969b4bd..1fecc20 100644
--- a/server/src/templateparser.cc
+++ b/server/src/templateparser.cc
@@ -87,6 +87,7 @@ TemplateParser::~TemplateParser()
void TemplateParser::characterData(std::string &data)
{
+ /*
if(state == MAP) {
assert(current_map); // No map present!
current_map->attributes["lua"].append(data);
@@ -96,6 +97,7 @@ void TemplateParser::characterData(std::string &data)
assert(current_luaprogram); // No lua program present!
current_luaprogram->attributes["lua"].append(data);
}
+ */
}
void TemplateParser::startTag(std::string name, std::map< std::string, std::string> attributes)