From 775021103ccd27d8be5aa92cc3cd21ce6c547c48 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 9 Jun 2008 13:48:06 +0000 Subject: Added xml encoding of the lua programs to make sure they are not interrupting the xml. --- client/lua.cc | 2 ++ server/src/Makefile.am | 13 ++++++++++--- server/src/server.cc | 10 ++-------- server/src/templateparser.cc | 2 ++ 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 += " attributes["name"] + "\">\n"; - - answer += lpi->attributes["lua"]; - + answer += xml_encode(lpi->attributes["lua"]); answer += "\n \n"; - lpi++; } - answer += " \n"; } - answer += widgetgenerator(*m, lqm, db); } - answer += " \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) -- cgit v1.2.3