From e4d4a5657c36231f3fc02b9def6ebb193cf95f15 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Fri, 5 Feb 2016 21:23:50 +1000 Subject: More Lua network messages clean ups. Highlights - Properly deal with ( and ). "return x" -> "return(x)". No more special casing. --- lib/LSL.lua | 8 +-- src/LuaSL/LuaSL_main.c | 103 ++++++++++++++-------------- src/extantz/extantz.c | 6 +- src/libraries/SledjHamr.c | 169 ++++++++++++++++++++++++++++------------------ src/love/love.c | 88 +++++++++++------------- 5 files changed, 202 insertions(+), 172 deletions(-) diff --git a/lib/LSL.lua b/lib/LSL.lua index 58620e7..434113d 100644 --- a/lib/LSL.lua +++ b/lib/LSL.lua @@ -1957,7 +1957,7 @@ function LSL.stateChange(x) Notably, it's not actually legal to do a state change from a function, only from handlers. There is a hack though, but it's unsupported, so I don't have to worry about it so much. - Write out "state new;" as "return _LSL.stateChange(newState);", with stateChange() returning new.state_entry()) which will force two tail calls. + Write out "state new;" as "return(_LSL.stateChange(newState));", with stateChange() returning new.state_entry()) which will force two tail calls. The caller of stateChange() might be a function rather than an event handler. Which will return to the event handler (possibly via other nested function calls) as if the state never changed. @@ -2003,7 +2003,7 @@ function waitAndProcess(returnWanted, name, ...) while running do local message = Runnr.receive() if message then ---print(" " .. SID .. "_" .. scriptName .. ' GOT MESSAGE - "' .. message .. '"') +-- print(" " .. SID .. "_" .. scriptName .. ' GOT MESSAGE - "' .. message .. '"') -- TODO - should we be discarding return values while paused? I don't think so, so we need to process those, if paused then if "start()" == message then paused = false end @@ -2027,7 +2027,7 @@ function waitAndProcess(returnWanted, name, ...) print(text) elseif result1 then -- Check if we are waiting for a return, and got it. - if returnWanted and string.match(message, "^return ") then + if returnWanted and string.match(message, "^return%(") then -- print("<" .. SID .. "_" .. scriptName, " - RETURNING " .. type(result1) .. " " .. message .. " TO " .. name) return result1 else @@ -2040,7 +2040,7 @@ function waitAndProcess(returnWanted, name, ...) -- msg("Error sending results from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg) -- end else - if string.match(message, "^return ") then + if string.match(message, "^return%(") then print("!" .. SID .. "_" .. scriptName, " - IN AN ODD PLACE!!!!!" .. message) else -- print("!" .. SID .. "_" .. scriptName, " - " .. message) diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index cf3c946..9a0f32f 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c @@ -41,7 +41,7 @@ static Eina_Bool _sleep_timer_cb(void *data) script *script = data; // PD("Waking up %s", script->name); - send2script(script->SID, "return 0.0"); + send2script(script->SID, "return(0.0)"); return ECORE_CALLBACK_CANCEL; } @@ -89,28 +89,28 @@ static boolean send2parser(void *data, Connection *connection, char *SID, char * return FALSE; } - sprintf(buf, "%s(%s", command, arguments); + sprintf(buf, "%s(%s)", command, arguments); //PD("GOT MESSAGE from script %s - '%s'", me->name, buf); - if (0 == strncmp(buf, "llSleep(", 8)) - ecore_timer_add(atof(&(buf)[8]), _sleep_timer_cb, me); - else if (0 == strncmp(buf, "llResetTime(", 12)) + if (0 == strcmp(command, "llSleep")) + ecore_timer_add(atof(arguments), _sleep_timer_cb, me); + else if (0 == strcmp(command, "llResetTime")) { takeScript(me); gettimeofday(&me->startTime, NULL); releaseScript(me); } - else if (0 == strncmp(buf, "llGetTime(", 10)) + else if (0 == strcmp(command, "llGetTime")) { struct timeval now; float time = timeDiff(&now, &me->startTime); char result[128]; - snprintf(result, sizeof(result), "return %f", time); + snprintf(result, sizeof(result), "return(%f)", time); send2script(me->SID, result); } - else if (0 == strncmp(buf, "llGetAndResetTime(", 18)) + else if (0 == strcmp(command, "llGetAndResetTime")) { struct timeval now; float time = timeDiff(&now, &me->startTime); @@ -120,13 +120,13 @@ static boolean send2parser(void *data, Connection *connection, char *SID, char * // Reset it before doing anything else once the result is known. gettimeofday(&me->startTime, NULL); releaseScript(me); - snprintf(result, sizeof(result), "return %f", time); + snprintf(result, sizeof(result), "return(%f)", time); send2script(me->SID, result); } - else if (0 == strncmp(buf, "llSetTimerEvent(", 16)) + else if (0 == strcmp(command, "llSetTimerEvent")) { takeScript(me); - me->timerTime = atof(&(buf)[16]); + me->timerTime = atof(arguments); if (0.0 == me->timerTime) { if (me->timer) @@ -137,14 +137,24 @@ static boolean send2parser(void *data, Connection *connection, char *SID, char * me->timer = ecore_timer_add(me->timerTime, _timer_timer_cb, me); releaseScript(me); } - else if (0 == strncmp(buf, "llSetScriptState(", 17)) + else if (0 == strcmp(command, "llSetScriptState")) { script *them; + char *temp = rindex(arguments, '"'), *ext = NULL; - if ((them = findThem(ourGlobals, me->fileName, &(buf[18])))) + if (temp) { - char *temp = rindex(&(buf[18]), ','); + *temp = '\0'; + ext = temp + 1; + } + + temp = arguments; + if ('"' == temp[0]) + temp = &temp[1]; + if ((them = findThem(ourGlobals, me->fileName, temp))) + { + temp = rindex(ext, ','); if (temp) { temp++; @@ -154,31 +164,39 @@ static boolean send2parser(void *data, Connection *connection, char *SID, char * send2script(them->SID, "start()"); else send2script(them->SID, "stop()"); -// PD("Stopped %s", them->name); +// PD("Started / stopped %s", them->name); } else PE("Missing script state in llSetScriptState(%s, )", them->name); } else - { - char *temp = rindex(&(buf[18]), '"'); - - if (temp) - *temp = '\0'; - PE("Can't stop script, can't find %s", &(buf[18])); - } + PE("Can't start / stop script, can't find %s", temp); } - else if (0 == strncmp(buf, "llResetOtherScript(", 19)) + else if (0 == strcmp(command, "llResetOtherScript")) { script *them; + char *temp = rindex(arguments, '"') ;//, *ext = NULL; - if ((them = findThem(ourGlobals, me->fileName, &(buf[20])))) + if (temp) + { + *temp = '\0'; +// ext = temp + 1; + } + + temp = arguments; + if ('"' == temp[0]) + temp = &temp[1]; + + + if ((them = findThem(ourGlobals, me->fileName, temp))) { PD("RESETTING OTHER %s", them->name); resetScript(them); } + else + PE("Can't reset script, can't find %s", temp); } - else if (0 == strncmp(buf, "llResetScript(", 14)) + else if (0 == strcmp(command, "llResetScript")) { PD("RESETTING %s", me->name); resetScript(me); @@ -239,38 +257,19 @@ static boolean parser(void *data, Connection *connection, char *SID, char *comma gameGlobals *ourGlobals = data; char buf[PATH_MAX]; -//PD("PARSE COMMAND %s - '%s' (%s", SID, command, arguments); +//PD("PARSE COMMAND %s - %s (%s)", SID, command, arguments); if (0 == strcmp(command, "compile")) { - char *temp; - char *file; LuaCompiler *compiler; - strcpy(buf, arguments); - temp = buf; - file = temp; - while (')' != temp[0]) - temp++; - temp[0] = '\0'; - - compiler = createCompiler(SID, file, (compileCb) compileLSL, _compileCb); + compiler = createCompiler(SID, arguments, (compileCb) compileLSL, _compileCb); compiler->client = connection; - PI("Compiling script %s", file); + PI("Compiling script %s", arguments); compileScript(compiler, TRUE); } else if (0 == strcmp(command, "run")) { - char *temp; - char *file; - script *me; - - strcpy(buf, arguments); - temp = buf; - file = temp; - while (')' != temp[0]) - temp++; - temp[0] = '\0'; - me = scriptAdd(file, SID, send2server, ourGlobals); + script *me = scriptAdd(arguments, SID, send2server, ourGlobals); me->client = connection; eina_hash_add(ourGlobals->names, me->fileName, me); @@ -293,10 +292,10 @@ static boolean parser(void *data, Connection *connection, char *SID, char *comma { // TODO - Even after moving the above into the command hash, this bit might still remain, unless script.return() can make it go away. // Though perhaps the "else" part stays? - if (0 == strcmp("return", command)) - snprintf(buf, sizeof(buf), "%s %s", command, arguments); - else - snprintf(buf, sizeof(buf), "%s(%s", command, arguments); +// if (0 == strcmp("return", command)) +// snprintf(buf, sizeof(buf), "%s(%s)", command, arguments); +// else + snprintf(buf, sizeof(buf), "%s(%s)", command, arguments); //PD("Sending -> script %s : %s", SID, buf); send2script(SID, buf); } diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 089cc41..f2c0a43 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c @@ -43,7 +43,7 @@ static boolean clientParser(void *data, Connection *connection, char *SID, char || (0 == strcmp(command, "llSay")) || (0 == strcmp(command, "llShout"))) { - sprintf(buf, "%s: %s(%s", SID, command, arguments); + sprintf(buf, "%s: %s(%s)", SID, command, arguments); if (ourGlobals->purkle) { int _P; @@ -65,11 +65,11 @@ static boolean clientParser(void *data, Connection *connection, char *SID, char _M = lua_gettop(ourGlobals->LSLGuiMess->L); // TODO - Somewhere in the chain the new lines that MLP likes to put into llDialog's message munge things. Fix that. - sprintf(buf, "%s(%s", command, arguments); + sprintf(buf, "%s(%s)", command, arguments); push_lua(ourGlobals->LSLGuiMess->L, "@ ( $ )", _M, "doLua", buf, 0); } else - PE("No LSLGuiMess to send - %s(%s", command, arguments); + PE("No LSLGuiMess to send - %s(%s)", command, arguments); } else if (0 == strcmp(command, "loadSim")) { diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c index 7092c10..1fae167 100644 --- a/src/libraries/SledjHamr.c +++ b/src/libraries/SledjHamr.c @@ -91,81 +91,122 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo typedef boolean (* notFoundCb)(Connection *conn, char *command, int len); -/* TODO - - It should loop through all lines, looking for the closing ) before dealing with it. - If we get to the end, and there's left over open ( or something, then return the length. - Bitch and move on if it's not well formed. -*/ static int _checkForCommand(Connection *conn, char *commands, notFoundCb notFound, boolean in) { int result = 0; boolean handled = FALSE; - char *ext, *ext2; + char *ext = NULL, *ext1 = NULL, *ext2 = NULL, *ext3 = NULL; - while ((ext = index(commands, '\n'))) - { - char SID[PATH_MAX * 3]; - int length = ext - commands; - strncpy(SID, commands, length + 1); + char *p = commands, name[64], command[32], arguments[PATH_MAX * 3]; - SID[length] = '\0'; + name[0] = 0; + command[0] = 0; + arguments[0] = 0; + ext = p; - ext = index(SID, '.'); - if (ext) + while (*p) + { + switch (*p) { - char *command = ext + 1; + case '.' : + if (NULL == ext1) + { + *p = 0; + strncpy(name, ext, sizeof(name)); + name[sizeof(name) - 1] = 0; + *p = '.'; + ext1 = p + 1; + } + break; - ext[0] = '\0'; - ext2 = index(command, '('); - if (NULL == ext2) - ext2 = index(command, ' '); - if (ext2) - { - ext2[0] = '\0'; - // TODO - Currently SID.command(arguments), should change that to nameSpace.command(arguments) - // Not sure what to do with SID, but there maybe some common parameters we can shift around differently. - // - First check if the connection has a hashtable of conn->commands. - //* Next check if "nameSpace.command(arguments)" runs as Lua. - // or even the return values from returnWanted calls like - - // SID, "return 1" - // SID, "result + 5" - // SID, "script.SID.return(1)" - // Finally pass it to conn->unknownCommand() - // * The Lua check can live in unknownCommand(). - // else bitch. - - // Check if it's in the connections hash table. - streamParser func = eina_hash_find(conn->commands, command); - - if (NULL == func) - { - // Check if the connection has a function for handling it. - if (in) - func = conn->unknownInCommand; - else - func = conn->unknownOutCommand; - } + case '(' : + if ((NULL != ext1) && (NULL == ext2)) + { + *p = 0; + strncpy(command, ext1, sizeof(command)); + command[sizeof(command) - 1] = 0; + *p = '('; + ext2 = p + 1; + } + break; - // Try it out if we have a function. - if (func) - { - handled = func(conn->pointer, conn, SID, command, ext2 + 1); - if (handled) - notFound = NULL; - } + case ')' : + if (NULL != ext2) // Keep scanning until we get the last one. + { + *p = 0; + strncpy(arguments, ext2, sizeof(arguments)); + arguments[sizeof(arguments) - 1] = 0; + *p = ')'; + ext3 = p + 1; + } + break; - // Last resort, let the caller deal with it. - if (notFound) - handled = notFound(conn, commands, length + 1); - if (!handled) - PE("No function found for command %s(%s!", command, ext2 + 1); + case '\n' : + if ((NULL != ext3) && (0 != name[0]) && (0 != command[0])) + { + int length = p - ext + 1; +//PD("name: %s command: %s arguments %s|", name, command, arguments); + // TODO - Currently SID.command(arguments), should change that to nameSpace.command(arguments) + // Not sure what to do with SID, but there maybe some common parameters we can shift around differently. + // - First check if the connection has a hashtable of conn->commands. + //* Next check if "nameSpace.command(arguments)" runs as Lua. + // or even the return values from returnWanted calls like - + // SID, "return(1)" + // SID, "result + 5" + // SID, "script.SID.return(1)" + // Finally pass it to conn->unknownCommand() + // * The Lua check can live in unknownCommand(). + // else bitch. + + // Check if it's in the connections hash table. + streamParser func = eina_hash_find(conn->commands, command); + + if (NULL == func) + { + // Check if the connection has a function for handling it. + if (in) + func = conn->unknownInCommand; + else + func = conn->unknownOutCommand; + } + + // Try it out if we have a function. + if (func) + { + handled = func(conn->pointer, conn, name, command, arguments); + if (handled) + notFound = NULL; + } + + // Last resort, let the caller deal with it. + if (notFound) + handled = notFound(conn, commands, length); + if (!handled) + PE("No function found for command %s.%s(%s)!", name, command, arguments); + + result += length; + + name[0] = 0; + command[0] = 0; + arguments[0] = 0; + ext = p + 1; + ext1 = NULL; + ext2 = NULL; + ext3 = NULL; + } + else if ((p != ext)) + { + *p = 0; + PE("ERROR scanning |%s|", ext); + *p = '\n'; + } + break; - result += length; - } + default : + break; } - - commands = &commands[length + 1]; + p++; } return result; @@ -178,13 +219,13 @@ static boolean _actuallySendIt(Connection *conn, char *command, int len) switch (conn->type) { case CT_CLIENT : -// PD("vvv send2(%*s", len, command); +//PD("vvv send2(%*s", len, command); ecore_con_client_send(conn->conn.client.client, strndup(command, len), len); ecore_con_client_flush(conn->conn.client.client); return TRUE; case CT_SERVER : -// PD("^^^ send2(%*s", len, command); +//PD("^^^ send2(%*s", len, command); ecore_con_server_send(conn->conn.server.server, strndup(command, len), len); ecore_con_server_flush(conn->conn.server.server); return TRUE; @@ -227,7 +268,7 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi conn->stream = eina_strbuf_new(); eina_strbuf_append_length(conn->stream, evData, evSize); -//PD("%s", (char *) eina_strbuf_string_get(conn->stream)); +//PD("****** %s", (char *) eina_strbuf_string_get(conn->stream)); eina_strbuf_remove(conn->stream, 0, _checkForCommand(conn, (char *) eina_strbuf_string_get(conn->stream), NULL, TRUE)); if (conn->_data) diff --git a/src/love/love.c b/src/love/love.c index 8d1bcd4..5549f54 100644 --- a/src/love/love.c +++ b/src/love/love.c @@ -217,9 +217,6 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman temp++; temp[0] = '\0'; text = ++temp; - while (')' != temp[0]) - temp++; - temp[0] = '\0'; PW("%s @ line %s, column %s.", text, line, column); if (me) me->warnings++; @@ -242,9 +239,6 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman temp++; temp[0] = '\0'; text = ++temp; - while (')' != temp[0]) - temp++; - temp[0] = '\0'; PE("%s @ line %s, column %s.", text, line, column); if (me) me->bugs++; @@ -276,55 +270,52 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman //PD("FAKING (maybe) %s", command); // Send back some random or fixed values for testing. if (0 == strcmp(command, "llGetKey")) - send2(ourGlobals->serverLuaSL, SID, "return \"%08lx-%04lx-%04lx-%04lx-%012lx\"", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); + send2(ourGlobals->serverLuaSL, SID, "return(\"%08lx-%04lx-%04lx-%04lx-%012lx\")", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); else if (0 == strcmp(command, "llGetOwner")) - send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); + send2(ourGlobals->serverLuaSL, SID, "return(\"%s\")", ownerKey); else if (0 == strcmp(command, "llGetPermissionsKey")) - send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); + send2(ourGlobals->serverLuaSL, SID, "return(\"%s\")", ownerKey); else if (0 == strcmp(command, "llRequestPermissions")) - PI("Faked %s(%s", command, arguments); + PI("Faked %s(%s)", command, arguments); else if (0 == strcmp(command, "llGetPos")) - send2(ourGlobals->serverLuaSL, SID, "return {x=128.0, y=128.0, z=128.0}"); + send2(ourGlobals->serverLuaSL, SID, "return({x=128.0, y=128.0, z=128.0})"); else if (0 == strcmp(command, "llGetRot")) - send2(ourGlobals->serverLuaSL, SID, "return {x=0.0, y=0.0, z=0.0, s=1.0}"); + send2(ourGlobals->serverLuaSL, SID, "return({x=0.0, y=0.0, z=0.0, s=1.0})"); else if (0 == strcmp(command, "llGetFreeMemory")) - send2(ourGlobals->serverLuaSL, SID, "return 654321"); + send2(ourGlobals->serverLuaSL, SID, "return(654321)"); else if (0 == strcmp(command, "llGetObjectDesc")) - send2(ourGlobals->serverLuaSL, SID, "return \"\""); + send2(ourGlobals->serverLuaSL, SID, "return(\"\")"); else if (0 == strcmp(command, "llGetAlpha")) - send2(ourGlobals->serverLuaSL, SID, "return 1.0"); - else if (0 == strcmp(command, "llGetInventoryNumber") && (0 == strcmp(arguments, "7)"))) - send2(ourGlobals->serverLuaSL, SID, "return 3"); + send2(ourGlobals->serverLuaSL, SID, "return(1.0)"); + else if (0 == strcmp(command, "llGetInventoryNumber") && (0 == strcmp(arguments, "7"))) + send2(ourGlobals->serverLuaSL, SID, "return(3)"); else if (0 == strcmp(command, "llGetLinkNumber")) - send2(ourGlobals->serverLuaSL, SID, "return 1"); - else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 2)"))) - send2(ourGlobals->serverLuaSL, SID, "return \".readme\""); - else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 1)"))) - send2(ourGlobals->serverLuaSL, SID, "return \".POSITIONS\""); - else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 0)"))) - send2(ourGlobals->serverLuaSL, SID, "return \".MENUITEMS\""); + send2(ourGlobals->serverLuaSL, SID, "return(1)"); + else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 2"))) + send2(ourGlobals->serverLuaSL, SID, "return(\".readme\")"); + else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 1"))) + send2(ourGlobals->serverLuaSL, SID, "return(\".POSITIONS\")"); + else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 0"))) + send2(ourGlobals->serverLuaSL, SID, "return(\".MENUITEMS\")"); else if (0 == strcmp(command, "llListen")) { - PI("Faked %s(%s", command, arguments); - send2(ourGlobals->serverLuaSL, SID, "return %d", random()); + PI("Faked %s(%s)", command, arguments); + send2(ourGlobals->serverLuaSL, SID, "return(%d)", random()); } else if (0 == strcmp(command, "llSameGroup")) - send2(ourGlobals->serverLuaSL, SID, "return true"); + send2(ourGlobals->serverLuaSL, SID, "return(true)"); else if (0 == strcmp(command, "llKey2Name")) { char *temp; strcpy(buf, arguments); temp = buf; - while (')' != temp[0]) - temp++; - temp[0] = '\0'; if (0 == strcmp(buf, ownerKey)) temp = ownerName; else temp = "Unknown User"; // TODO - Sanitize the name, no telling what weird shit people put in their names. - snprintf(buf, sizeof(buf), "return \"%s\"", temp); + snprintf(buf, sizeof(buf), "return(\"%s\")", temp); send2(ourGlobals->serverLuaSL, SID, buf); } // Send "back" stuff on to the one and only client. @@ -335,34 +326,34 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman // Dialogs, notifications, and other stuff goes through some other functions. else if (0 == strcmp(command, "llOwnerSay")) { - if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); - else PW("No where to send %s(%s", command, arguments); + if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments); + else PW("No where to send %s(%s)", command, arguments); } else if (0 == strcmp(command, "llWhisper")) { - if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); - else PW("No where to send %s(%s", command, arguments); + if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments); + else PW("No where to send %s(%s)", command, arguments); } else if (0 == strcmp(command, "llRegionSay")) { - if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); - else PW("No where to send %s(%s", command, arguments); + if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments); + else PW("No where to send %s(%s)", command, arguments); } else if (0 == strcmp(command, "llSay")) { - if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); - else PW("No where to send %s(%s", command, arguments); + if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments); + else PW("No where to send %s(%s)", command, arguments); } else if (0 == strcmp(command, "llShout")) { - if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); - else PW("No where to send %s(%s", command, arguments); + if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments); + else PW("No where to send %s(%s)", command, arguments); // TODO - Temporary so we have a place to log stuff from LSL. PD("SHOUTING %s", command); } else if (0 == strcmp(command, "llDialog")) { - if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); + if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments); } else if (0 == strcmp(command, "llMessageLinked")) { @@ -372,7 +363,7 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman scripts = eina_hash_iterator_data_new(ourGlobals->scripts); while(eina_iterator_next(scripts, (void **) &me)) { - send2(ourGlobals->serverLuaSL, me->SID, "events.link_message(%s", arguments); + send2(ourGlobals->serverLuaSL, me->SID, "events.link_message(%s)", arguments); } eina_iterator_free(scripts); } @@ -392,11 +383,9 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman while (' ' != temp[0]) temp++; line = temp; - while (')' != temp[0]) - temp++; - temp[0] = '\0'; lineNo = atoi(line); snprintf(key, sizeof(key), "%s/Test%%20sim/onefang%%27s%%20test%%20bed/%s", prefix_data_get(), notecard); +//PD("%s -> %s == %d, %s", notecard, line, lineNo, key); fd = open(key, O_RDONLY); if (-1 != fd) @@ -418,7 +407,7 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman } while (temp && (0 < lineNo--)); sprintf(key, FAKE_UUID); - send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", key); + send2(ourGlobals->serverLuaSL, SID, "return(\"%s\")", key); // TODO - For now, just send it to everyone. scripts = eina_hash_iterator_data_new(ourGlobals->scripts); @@ -438,7 +427,8 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman buf2[j++] = '\\'; buf2[j++] = temp[i]; } - send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", '%s')", key, buf2); +//PE("events.dataserver(\"%s\", \'%s\')", key, buf2); + send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \'%s\')", key, buf2); } else send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \"EndOfFuckingAround\")", key); @@ -513,7 +503,7 @@ static boolean clientParser(void *data, Connection *conn, char *SID, char *comma char buf[PATH_MAX]; // TODO - For now, just send it to everyone. - sprintf(buf, "%s(%s", command, arguments); + sprintf(buf, "%s(%s)", command, arguments); scripts = eina_hash_iterator_data_new(ourGlobals->scripts); while(eina_iterator_next(scripts, (void **) &me)) { -- cgit v1.1