diff options
author | David Walter Seikel | 2016-01-17 17:03:56 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-01-17 17:03:56 +1000 |
commit | 4e2030607818d83b4e5987df2d889f64f8dce3b3 (patch) | |
tree | 370625391b847bed4fa05c888448d1b9a18895b6 | |
parent | Bunch of debuggingnesses. (diff) | |
download | SledjHamr-4e2030607818d83b4e5987df2d889f64f8dce3b3.zip SledjHamr-4e2030607818d83b4e5987df2d889f64f8dce3b3.tar.gz SledjHamr-4e2030607818d83b4e5987df2d889f64f8dce3b3.tar.bz2 SledjHamr-4e2030607818d83b4e5987df2d889f64f8dce3b3.tar.xz |
Unify the message sending code a bit.
Diffstat (limited to '')
-rw-r--r-- | src/LuaSL/LuaSL_main.c | 10 | ||||
-rw-r--r-- | src/extantz/extantz.c | 6 | ||||
-rw-r--r-- | src/libraries/SledjHamr.c | 47 | ||||
-rw-r--r-- | src/libraries/SledjHamr.h | 3 | ||||
-rw-r--r-- | src/love/love.c | 68 | ||||
-rw-r--r-- | src/purkle/purkle.c | 2 |
6 files changed, 44 insertions, 92 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index f8931e6..664cdd1 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c | |||
@@ -168,7 +168,7 @@ void send2server(script *me, const char *message) | |||
168 | else | 168 | else |
169 | { | 169 | { |
170 | takeScript(me); | 170 | takeScript(me); |
171 | sendBack(me->client, me->SID, message); | 171 | send2(me->client, me->SID, message); |
172 | releaseScript(me); | 172 | releaseScript(me); |
173 | } | 173 | } |
174 | } | 174 | } |
@@ -181,9 +181,9 @@ static void _compileCb(LuaCompiler *compiler) | |||
181 | { | 181 | { |
182 | #if COMPILE_OUTPUT | 182 | #if COMPILE_OUTPUT |
183 | if (message->type) | 183 | if (message->type) |
184 | sendBack(compiler->client, compiler->SID, "compilerError(%d,%d,%s)", message->line, message->column, message->message); | 184 | send2(compiler->client, compiler->SID, "compilerError(%d,%d,%s)", message->line, message->column, message->message); |
185 | else | 185 | else |
186 | sendBack(compiler->client, compiler->SID, "compilerWarning(%d,%d,%s)", message->line, message->column, message->message); | 186 | send2(compiler->client, compiler->SID, "compilerWarning(%d,%d,%s)", message->line, message->column, message->message); |
187 | #endif | 187 | #endif |
188 | eina_clist_remove(&(message->node)); | 188 | eina_clist_remove(&(message->node)); |
189 | free(message); | 189 | free(message); |
@@ -191,9 +191,9 @@ static void _compileCb(LuaCompiler *compiler) | |||
191 | 191 | ||
192 | //PD("Compiled %s, bug count %d", compiler->file, compiler->bugCount); | 192 | //PD("Compiled %s, bug count %d", compiler->file, compiler->bugCount); |
193 | if (0 == compiler->bugCount) | 193 | if (0 == compiler->bugCount) |
194 | sendBack(compiler->client, compiler->SID, "compiled(true)"); | 194 | send2(compiler->client, compiler->SID, "compiled(true)"); |
195 | else | 195 | else |
196 | sendBack(compiler->client, compiler->SID, "compiled(false)"); | 196 | send2(compiler->client, compiler->SID, "compiled(false)"); |
197 | } | 197 | } |
198 | 198 | ||
199 | static void _compileCbSingle(LuaCompiler *compiler) | 199 | static void _compileCbSingle(LuaCompiler *compiler) |
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 840dfec..f9b638a 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -143,7 +143,7 @@ static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void | |||
143 | 143 | ||
144 | // CUBE_UUID.events.touch_start(1), but we just make one up for now. | 144 | // CUBE_UUID.events.touch_start(1), but we just make one up for now. |
145 | snprintf(SID, sizeof(SID), FAKE_UUID); | 145 | snprintf(SID, sizeof(SID), FAKE_UUID); |
146 | sendForth(ourGlobals.server, SID, "events.touch_start(1)"); | 146 | send2(ourGlobals.server, SID, "events.touch_start(1)"); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | } | 149 | } |
@@ -567,7 +567,7 @@ static Eina_Bool _makeMess(void *data) | |||
567 | ecore_job_add((Ecore_Cb) _makeLove, ourGlobals); | 567 | ecore_job_add((Ecore_Cb) _makeLove, ourGlobals); |
568 | // ecore_timer_add(0.1, _makeLove, ourGlobals); | 568 | // ecore_timer_add(0.1, _makeLove, ourGlobals); |
569 | 569 | ||
570 | ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); | 570 | // ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); |
571 | 571 | ||
572 | return ECORE_CALLBACK_CANCEL; | 572 | return ECORE_CALLBACK_CANCEL; |
573 | } | 573 | } |
@@ -615,7 +615,7 @@ static Eina_Bool _makePurkle(void *data) | |||
615 | 615 | ||
616 | woMan_add(ourGlobals); | 616 | woMan_add(ourGlobals); |
617 | ourGlobals->purkle = GuiLuaLoad("purkle", ourGlobals->mainWindow, ourGlobals->world); | 617 | ourGlobals->purkle = GuiLuaLoad("purkle", ourGlobals->mainWindow, ourGlobals->world); |
618 | // ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); | 618 | ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); |
619 | // ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | 619 | // ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); |
620 | 620 | ||
621 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | 621 | // Gotta do this after adding the windows, otherwise the menu renders under the window. |
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c index dff80ee..4d0efbc 100644 --- a/src/libraries/SledjHamr.c +++ b/src/libraries/SledjHamr.c | |||
@@ -88,31 +88,9 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo | |||
88 | return result; | 88 | return result; |
89 | } | 89 | } |
90 | 90 | ||
91 | void sendBack(Connection *conn, const char *SID, const char *message, ...) | 91 | void send2(Connection *conn, const char *SID, const char *message, ...) |
92 | { | ||
93 | va_list args; | ||
94 | // Ecore_Con_Client *client = conn->conn.client.client; | ||
95 | char buf[PATH_MAX * 2]; | ||
96 | int length = strlen(SID); | ||
97 | |||
98 | strncpy(buf, SID, length); | ||
99 | buf[length++] = '.'; | ||
100 | va_start(args, message); | ||
101 | length += vsprintf(&buf[length], message, args); | ||
102 | va_end(args); | ||
103 | buf[length++] = '\n'; | ||
104 | buf[length] = '\0'; | ||
105 | // PD("sendBack(%s", buf); | ||
106 | // ecore_con_client_send(client, buf, length); | ||
107 | // ecore_con_client_flush(client); | ||
108 | //Connection *conn = ecore_con_client_data_get(client); | ||
109 | if (conn) send2(conn, SID, buf); else PE("sendBack() can't find Connection!"); | ||
110 | } | ||
111 | |||
112 | void sendForth(Connection *conn, const char *SID, const char *message, ...) | ||
113 | { | 92 | { |
114 | va_list args; | 93 | va_list args; |
115 | // Ecore_Con_Server *server = conn->conn.server.server; | ||
116 | char buf[PATH_MAX * 2]; | 94 | char buf[PATH_MAX * 2]; |
117 | int length = strlen(SID); | 95 | int length = strlen(SID); |
118 | 96 | ||
@@ -123,29 +101,6 @@ void sendForth(Connection *conn, const char *SID, const char *message, ...) | |||
123 | va_end(args); | 101 | va_end(args); |
124 | buf[length++] = '\n'; | 102 | buf[length++] = '\n'; |
125 | buf[length] = '\0'; | 103 | buf[length] = '\0'; |
126 | // PD("sendForth(%s", buf); | ||
127 | // ecore_con_server_send(server, buf, length); | ||
128 | // ecore_con_server_flush(server); | ||
129 | //Connection *conn = ecore_con_server_data_get(server); | ||
130 | if (conn) send2(conn, SID, buf); else PE("sendForth() can't find Connection!"); | ||
131 | } | ||
132 | |||
133 | void send2(Connection *conn, const char *SID, const char *message, ...) | ||
134 | { | ||
135 | va_list args; | ||
136 | char buf[PATH_MAX * 2]; | ||
137 | int length = strlen(SID); | ||
138 | |||
139 | length = 0; | ||
140 | // strncpy(buf, SID, length); | ||
141 | // buf[length++] = '.'; | ||
142 | va_start(args, message); | ||
143 | // length += vsprintf(&buf[length], message, args); | ||
144 | va_end(args); | ||
145 | strcpy(buf, message); | ||
146 | length = strlen(buf); | ||
147 | // buf[length++] = '\n'; | ||
148 | buf[length] = '\0'; | ||
149 | 104 | ||
150 | // TODO - Should check if this is always gonna be local? Likely not. | 105 | // TODO - Should check if this is always gonna be local? Likely not. |
151 | if (checkConnection(conn, "send2", conn->type, FALSE)) | 106 | if (checkConnection(conn, "send2", conn->type, FALSE)) |
diff --git a/src/libraries/SledjHamr.h b/src/libraries/SledjHamr.h index 326e423..d5e0b1f 100644 --- a/src/libraries/SledjHamr.h +++ b/src/libraries/SledjHamr.h | |||
@@ -66,9 +66,6 @@ struct _Connection | |||
66 | 66 | ||
67 | 67 | ||
68 | void *addMessage(Eina_Clist *list, size_t size, const char *message, ...); | 68 | void *addMessage(Eina_Clist *list, size_t size, const char *message, ...); |
69 | void sendBack(Connection *conn, const char *SID, const char *message, ...); | ||
70 | void sendForth(Connection *conn, const char *SID, const char *message, ...); | ||
71 | |||
72 | void send2(Connection *conn, const char *SID, const char *message, ...); | 69 | void send2(Connection *conn, const char *SID, const char *message, ...); |
73 | Connection *openArms(char *name, const char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser); | 70 | Connection *openArms(char *name, const char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser); |
74 | Connection *reachOut(char *name, char *command, char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser); | 71 | Connection *reachOut(char *name, char *command, char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser); |
diff --git a/src/love/love.c b/src/love/love.c index f8ce522..e6f5b6e 100644 --- a/src/love/love.c +++ b/src/love/love.c | |||
@@ -142,7 +142,7 @@ static void dirList_compile(const char *name, const char *path, void *data) | |||
142 | snprintf(me->SID, sizeof(me->SID), FAKE_UUID); | 142 | snprintf(me->SID, sizeof(me->SID), FAKE_UUID); |
143 | snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); | 143 | snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); |
144 | eina_hash_add(ourGlobals->scripts, me->SID, me); | 144 | eina_hash_add(ourGlobals->scripts, me->SID, me); |
145 | sendForth(ourGlobals->serverLuaSL, me->SID, "compile(%s)", me->fileName); | 145 | send2(ourGlobals->serverLuaSL, me->SID, "compile(%s)", me->fileName); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | } | 148 | } |
@@ -278,47 +278,47 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm | |||
278 | } | 278 | } |
279 | } | 279 | } |
280 | //PD("About to run %s", me->fileName); | 280 | //PD("About to run %s", me->fileName); |
281 | sendForth(ourGlobals->serverLuaSL, SID, "run(%s)", me->fileName); | 281 | send2(ourGlobals->serverLuaSL, SID, "run(%s)", me->fileName); |
282 | } | 282 | } |
283 | else | 283 | else |
284 | { | 284 | { |
285 | //PD("FAKING (maybe) %s", command); | 285 | //PD("FAKING (maybe) %s", command); |
286 | // Send back some random or fixed values for testing. | 286 | // Send back some random or fixed values for testing. |
287 | if (0 == strcmp(command, "llGetKey()")) | 287 | if (0 == strcmp(command, "llGetKey()")) |
288 | sendForth(ourGlobals->serverLuaSL, SID, "return \"%08lx-%04lx-%04lx-%04lx-%012lx\"", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | 288 | send2(ourGlobals->serverLuaSL, SID, "return \"%08lx-%04lx-%04lx-%04lx-%012lx\"", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); |
289 | else if (0 == strcmp(command, "llGetOwner()")) | 289 | else if (0 == strcmp(command, "llGetOwner()")) |
290 | sendForth(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); | 290 | send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); |
291 | else if (0 == strcmp(command, "llGetPermissionsKey()")) | 291 | else if (0 == strcmp(command, "llGetPermissionsKey()")) |
292 | sendForth(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); | 292 | send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); |
293 | else if (0 == strncmp(command, "llRequestPermissions(", 21)) | 293 | else if (0 == strncmp(command, "llRequestPermissions(", 21)) |
294 | PI("Faked %s", command); | 294 | PI("Faked %s", command); |
295 | else if (0 == strcmp(command, "llGetPos()")) | 295 | else if (0 == strcmp(command, "llGetPos()")) |
296 | sendForth(ourGlobals->serverLuaSL, SID, "return {x=128.0, y=128.0, z=128.0}"); | 296 | send2(ourGlobals->serverLuaSL, SID, "return {x=128.0, y=128.0, z=128.0}"); |
297 | else if (0 == strcmp(command, "llGetRot()")) | 297 | else if (0 == strcmp(command, "llGetRot()")) |
298 | sendForth(ourGlobals->serverLuaSL, SID, "return {x=0.0, y=0.0, z=0.0, s=1.0}"); | 298 | send2(ourGlobals->serverLuaSL, SID, "return {x=0.0, y=0.0, z=0.0, s=1.0}"); |
299 | else if (0 == strcmp(command, "llGetFreeMemory()")) | 299 | else if (0 == strcmp(command, "llGetFreeMemory()")) |
300 | sendForth(ourGlobals->serverLuaSL, SID, "return 654321"); | 300 | send2(ourGlobals->serverLuaSL, SID, "return 654321"); |
301 | else if (0 == strcmp(command, "llGetObjectDesc()")) | 301 | else if (0 == strcmp(command, "llGetObjectDesc()")) |
302 | sendForth(ourGlobals->serverLuaSL, SID, "return \"\""); | 302 | send2(ourGlobals->serverLuaSL, SID, "return \"\""); |
303 | else if (0 == strncmp(command, "llGetAlpha(", 11)) | 303 | else if (0 == strncmp(command, "llGetAlpha(", 11)) |
304 | sendForth(ourGlobals->serverLuaSL, SID, "return 1.0"); | 304 | send2(ourGlobals->serverLuaSL, SID, "return 1.0"); |
305 | else if (0 == strcmp(command, "llGetInventoryNumber(7)")) | 305 | else if (0 == strcmp(command, "llGetInventoryNumber(7)")) |
306 | sendForth(ourGlobals->serverLuaSL, SID, "return 3"); | 306 | send2(ourGlobals->serverLuaSL, SID, "return 3"); |
307 | else if (0 == strcmp(command, "llGetLinkNumber()")) | 307 | else if (0 == strcmp(command, "llGetLinkNumber()")) |
308 | sendForth(ourGlobals->serverLuaSL, SID, "return 1"); | 308 | send2(ourGlobals->serverLuaSL, SID, "return 1"); |
309 | else if (0 == strcmp(command, "llGetInventoryName(7, 2)")) | 309 | else if (0 == strcmp(command, "llGetInventoryName(7, 2)")) |
310 | sendForth(ourGlobals->serverLuaSL, SID, "return \".readme\""); | 310 | send2(ourGlobals->serverLuaSL, SID, "return \".readme\""); |
311 | else if (0 == strcmp(command, "llGetInventoryName(7, 1)")) | 311 | else if (0 == strcmp(command, "llGetInventoryName(7, 1)")) |
312 | sendForth(ourGlobals->serverLuaSL, SID, "return \".POSITIONS\""); | 312 | send2(ourGlobals->serverLuaSL, SID, "return \".POSITIONS\""); |
313 | else if (0 == strcmp(command, "llGetInventoryName(7, 0)")) | 313 | else if (0 == strcmp(command, "llGetInventoryName(7, 0)")) |
314 | sendForth(ourGlobals->serverLuaSL, SID, "return \".MENUITEMS\""); | 314 | send2(ourGlobals->serverLuaSL, SID, "return \".MENUITEMS\""); |
315 | else if (0 == strncmp(command, "llListen(", 9)) | 315 | else if (0 == strncmp(command, "llListen(", 9)) |
316 | { | 316 | { |
317 | PI("Faked %s", command); | 317 | PI("Faked %s", command); |
318 | sendForth(ourGlobals->serverLuaSL, SID, "return %d", random()); | 318 | send2(ourGlobals->serverLuaSL, SID, "return %d", random()); |
319 | } | 319 | } |
320 | else if (0 == strncmp(command, "llSameGroup(", 12)) | 320 | else if (0 == strncmp(command, "llSameGroup(", 12)) |
321 | sendForth(ourGlobals->serverLuaSL, SID, "return true"); | 321 | send2(ourGlobals->serverLuaSL, SID, "return true"); |
322 | else if (0 == strncmp(command, "llKey2Name(", 11)) | 322 | else if (0 == strncmp(command, "llKey2Name(", 11)) |
323 | { | 323 | { |
324 | char *temp; | 324 | char *temp; |
@@ -334,7 +334,7 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm | |||
334 | temp = "Unknown User"; | 334 | temp = "Unknown User"; |
335 | // TODO - Sanitize the name, no telling what weird shit people put in their names. | 335 | // TODO - Sanitize the name, no telling what weird shit people put in their names. |
336 | snprintf(buf, sizeof(buf), "return \"%s\"", temp); | 336 | snprintf(buf, sizeof(buf), "return \"%s\"", temp); |
337 | sendForth(ourGlobals->serverLuaSL, SID, buf); | 337 | send2(ourGlobals->serverLuaSL, SID, buf); |
338 | } | 338 | } |
339 | // Send "back" stuff on to the one and only client. | 339 | // Send "back" stuff on to the one and only client. |
340 | // TODO - All of these output functions should just use one thing to append stuff to either local or an IM tab. | 340 | // TODO - All of these output functions should just use one thing to append stuff to either local or an IM tab. |
@@ -344,34 +344,34 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm | |||
344 | // Dialogs, notifications, and other stuff goes through some other functions. | 344 | // Dialogs, notifications, and other stuff goes through some other functions. |
345 | else if (0 == strncmp(command, "llOwnerSay(", 11)) | 345 | else if (0 == strncmp(command, "llOwnerSay(", 11)) |
346 | { | 346 | { |
347 | if (ourGlobals->client) sendBack(ourGlobals->client, SID, command); | 347 | if (ourGlobals->client) send2(ourGlobals->client, SID, command); |
348 | else PW("No where to send %s", command); | 348 | else PW("No where to send %s", command); |
349 | } | 349 | } |
350 | else if (0 == strncmp(command, "llWhisper(", 10)) | 350 | else if (0 == strncmp(command, "llWhisper(", 10)) |
351 | { | 351 | { |
352 | if (ourGlobals->client) sendBack(ourGlobals->client, SID, command); | 352 | if (ourGlobals->client) send2(ourGlobals->client, SID, command); |
353 | else PW("No where to send %s", command); | 353 | else PW("No where to send %s", command); |
354 | } | 354 | } |
355 | else if (0 == strncmp(command, "llRegionSay(", 12)) | 355 | else if (0 == strncmp(command, "llRegionSay(", 12)) |
356 | { | 356 | { |
357 | if (ourGlobals->client) sendBack(ourGlobals->client, SID, command); | 357 | if (ourGlobals->client) send2(ourGlobals->client, SID, command); |
358 | else PW("No where to send %s", command); | 358 | else PW("No where to send %s", command); |
359 | } | 359 | } |
360 | else if (0 == strncmp(command, "llSay(", 6)) | 360 | else if (0 == strncmp(command, "llSay(", 6)) |
361 | { | 361 | { |
362 | if (ourGlobals->client) sendBack(ourGlobals->client, SID, command); | 362 | if (ourGlobals->client) send2(ourGlobals->client, SID, command); |
363 | else PW("No where to send %s", command); | 363 | else PW("No where to send %s", command); |
364 | } | 364 | } |
365 | else if (0 == strncmp(command, "llShout(", 8)) | 365 | else if (0 == strncmp(command, "llShout(", 8)) |
366 | { | 366 | { |
367 | if (ourGlobals->client) sendBack(ourGlobals->client, SID, command); | 367 | if (ourGlobals->client) send2(ourGlobals->client, SID, command); |
368 | else PW("No where to send %s", command); | 368 | else PW("No where to send %s", command); |
369 | // TODO - Temporary so we have a place to log stuff from LSL. | 369 | // TODO - Temporary so we have a place to log stuff from LSL. |
370 | PD("SHOUTING %s", command); | 370 | PD("SHOUTING %s", command); |
371 | } | 371 | } |
372 | else if (0 == strncmp(command, "llDialog(", 9)) | 372 | else if (0 == strncmp(command, "llDialog(", 9)) |
373 | { | 373 | { |
374 | if (ourGlobals->client) sendBack(ourGlobals->client, SID, command); | 374 | if (ourGlobals->client) send2(ourGlobals->client, SID, command); |
375 | else PW("No where to send %s", command); | 375 | else PW("No where to send %s", command); |
376 | } | 376 | } |
377 | else if (0 == strncmp(command, "llMessageLinked(", 16)) | 377 | else if (0 == strncmp(command, "llMessageLinked(", 16)) |
@@ -383,7 +383,7 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm | |||
383 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); | 383 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); |
384 | while(eina_iterator_next(scripts, (void **) &me)) | 384 | while(eina_iterator_next(scripts, (void **) &me)) |
385 | { | 385 | { |
386 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.link_message%s", &command[15]); | 386 | send2(ourGlobals->serverLuaSL, me->SID, "events.link_message%s", &command[15]); |
387 | } | 387 | } |
388 | eina_iterator_free(scripts); | 388 | eina_iterator_free(scripts); |
389 | } | 389 | } |
@@ -429,7 +429,7 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm | |||
429 | } while (temp && (0 < lineNo--)); | 429 | } while (temp && (0 < lineNo--)); |
430 | 430 | ||
431 | sprintf(key, FAKE_UUID); | 431 | sprintf(key, FAKE_UUID); |
432 | sendForth(ourGlobals->serverLuaSL, SID, "return \"%s\"", key); | 432 | send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", key); |
433 | 433 | ||
434 | // TODO - For now, just send it to everyone. | 434 | // TODO - For now, just send it to everyone. |
435 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); | 435 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); |
@@ -449,10 +449,10 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm | |||
449 | buf2[j++] = '\\'; | 449 | buf2[j++] = '\\'; |
450 | buf2[j++] = temp[i]; | 450 | buf2[j++] = temp[i]; |
451 | } | 451 | } |
452 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", '%s')", key, buf2); | 452 | send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", '%s')", key, buf2); |
453 | } | 453 | } |
454 | else | 454 | else |
455 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \"EndOfFuckingAround\")", key); | 455 | send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \"EndOfFuckingAround\")", key); |
456 | } | 456 | } |
457 | eina_iterator_free(scripts); | 457 | eina_iterator_free(scripts); |
458 | free(temp); | 458 | free(temp); |
@@ -492,7 +492,7 @@ static Eina_Bool _addClient(void *data, int type, Ecore_Con_Event_Client_Add *ev | |||
492 | if (ourGlobals->client) | 492 | if (ourGlobals->client) |
493 | { | 493 | { |
494 | // TODO - Sending the currently hard coded ownerKey here, should actually deal with logging in / hypergrid TP style things instead. | 494 | // TODO - Sending the currently hard coded ownerKey here, should actually deal with logging in / hypergrid TP style things instead. |
495 | sendBack(ourGlobals->client, ownerKey, "loadSim('file://%s/Test%%20sim')", prefix_data_get()); | 495 | send2(ourGlobals->client, ownerKey, "loadSim('file://%s/Test%%20sim')", prefix_data_get()); |
496 | } | 496 | } |
497 | 497 | ||
498 | return ECORE_CALLBACK_RENEW; | 498 | return ECORE_CALLBACK_RENEW; |
@@ -511,9 +511,9 @@ static Eina_Bool clientParser(void *data, Connection *conn, char *SID, char *com | |||
511 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); | 511 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); |
512 | while(eina_iterator_next(scripts, (void **) &me)) | 512 | while(eina_iterator_next(scripts, (void **) &me)) |
513 | { | 513 | { |
514 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey); | 514 | send2(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey); |
515 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName); | 515 | send2(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName); |
516 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)"); | 516 | send2(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)"); |
517 | } | 517 | } |
518 | eina_iterator_free(scripts); | 518 | eina_iterator_free(scripts); |
519 | } | 519 | } |
@@ -528,7 +528,7 @@ static Eina_Bool clientParser(void *data, Connection *conn, char *SID, char *com | |||
528 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); | 528 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); |
529 | while(eina_iterator_next(scripts, (void **) &me)) | 529 | while(eina_iterator_next(scripts, (void **) &me)) |
530 | { | 530 | { |
531 | sendForth(ourGlobals->serverLuaSL, me->SID, buf); | 531 | send2(ourGlobals->serverLuaSL, me->SID, buf); |
532 | } | 532 | } |
533 | eina_iterator_free(scripts); | 533 | eina_iterator_free(scripts); |
534 | } | 534 | } |
@@ -543,7 +543,7 @@ static Eina_Bool _delClient(void *data, int type, Ecore_Con_Event_Client_Del *ev | |||
543 | gameGlobals *ourGlobals = data; | 543 | gameGlobals *ourGlobals = data; |
544 | 544 | ||
545 | // TODO - I could coax this into something generic, maybe. | 545 | // TODO - I could coax this into something generic, maybe. |
546 | sendForth(ourGlobals->serverLuaSL, ownerKey, "exit()"); | 546 | send2(ourGlobals->serverLuaSL, ownerKey, "exit()"); |
547 | 547 | ||
548 | return ECORE_CALLBACK_RENEW; | 548 | return ECORE_CALLBACK_RENEW; |
549 | } | 549 | } |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 9a21700..97253cf 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -56,7 +56,7 @@ static int say(lua_State *L) | |||
56 | gl = lua_touserdata(L, -1); | 56 | gl = lua_touserdata(L, -1); |
57 | lua_pop(L, 1); | 57 | lua_pop(L, 1); |
58 | if (gl && gl->server) | 58 | if (gl && gl->server) |
59 | sendForth(gl->server, id, buf); | 59 | send2(gl->server, id, buf); |
60 | else | 60 | else |
61 | PW("PURKLE NOT SAY, no where to send %s", buf); | 61 | PW("PURKLE NOT SAY, no where to send %s", buf); |
62 | } | 62 | } |