aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/love
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/love/love.c88
1 files changed, 39 insertions, 49 deletions
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
217 temp++; 217 temp++;
218 temp[0] = '\0'; 218 temp[0] = '\0';
219 text = ++temp; 219 text = ++temp;
220 while (')' != temp[0])
221 temp++;
222 temp[0] = '\0';
223 PW("%s @ line %s, column %s.", text, line, column); 220 PW("%s @ line %s, column %s.", text, line, column);
224 if (me) 221 if (me)
225 me->warnings++; 222 me->warnings++;
@@ -242,9 +239,6 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman
242 temp++; 239 temp++;
243 temp[0] = '\0'; 240 temp[0] = '\0';
244 text = ++temp; 241 text = ++temp;
245 while (')' != temp[0])
246 temp++;
247 temp[0] = '\0';
248 PE("%s @ line %s, column %s.", text, line, column); 242 PE("%s @ line %s, column %s.", text, line, column);
249 if (me) 243 if (me)
250 me->bugs++; 244 me->bugs++;
@@ -276,55 +270,52 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman
276//PD("FAKING (maybe) %s", command); 270//PD("FAKING (maybe) %s", command);
277 // Send back some random or fixed values for testing. 271 // Send back some random or fixed values for testing.
278 if (0 == strcmp(command, "llGetKey")) 272 if (0 == strcmp(command, "llGetKey"))
279 send2(ourGlobals->serverLuaSL, SID, "return \"%08lx-%04lx-%04lx-%04lx-%012lx\"", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); 273 send2(ourGlobals->serverLuaSL, SID, "return(\"%08lx-%04lx-%04lx-%04lx-%012lx\")", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random());
280 else if (0 == strcmp(command, "llGetOwner")) 274 else if (0 == strcmp(command, "llGetOwner"))
281 send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); 275 send2(ourGlobals->serverLuaSL, SID, "return(\"%s\")", ownerKey);
282 else if (0 == strcmp(command, "llGetPermissionsKey")) 276 else if (0 == strcmp(command, "llGetPermissionsKey"))
283 send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", ownerKey); 277 send2(ourGlobals->serverLuaSL, SID, "return(\"%s\")", ownerKey);
284 else if (0 == strcmp(command, "llRequestPermissions")) 278 else if (0 == strcmp(command, "llRequestPermissions"))
285 PI("Faked %s(%s", command, arguments); 279 PI("Faked %s(%s)", command, arguments);
286 else if (0 == strcmp(command, "llGetPos")) 280 else if (0 == strcmp(command, "llGetPos"))
287 send2(ourGlobals->serverLuaSL, SID, "return {x=128.0, y=128.0, z=128.0}"); 281 send2(ourGlobals->serverLuaSL, SID, "return({x=128.0, y=128.0, z=128.0})");
288 else if (0 == strcmp(command, "llGetRot")) 282 else if (0 == strcmp(command, "llGetRot"))
289 send2(ourGlobals->serverLuaSL, SID, "return {x=0.0, y=0.0, z=0.0, s=1.0}"); 283 send2(ourGlobals->serverLuaSL, SID, "return({x=0.0, y=0.0, z=0.0, s=1.0})");
290 else if (0 == strcmp(command, "llGetFreeMemory")) 284 else if (0 == strcmp(command, "llGetFreeMemory"))
291 send2(ourGlobals->serverLuaSL, SID, "return 654321"); 285 send2(ourGlobals->serverLuaSL, SID, "return(654321)");
292 else if (0 == strcmp(command, "llGetObjectDesc")) 286 else if (0 == strcmp(command, "llGetObjectDesc"))
293 send2(ourGlobals->serverLuaSL, SID, "return \"\""); 287 send2(ourGlobals->serverLuaSL, SID, "return(\"\")");
294 else if (0 == strcmp(command, "llGetAlpha")) 288 else if (0 == strcmp(command, "llGetAlpha"))
295 send2(ourGlobals->serverLuaSL, SID, "return 1.0"); 289 send2(ourGlobals->serverLuaSL, SID, "return(1.0)");
296 else if (0 == strcmp(command, "llGetInventoryNumber") && (0 == strcmp(arguments, "7)"))) 290 else if (0 == strcmp(command, "llGetInventoryNumber") && (0 == strcmp(arguments, "7")))
297 send2(ourGlobals->serverLuaSL, SID, "return 3"); 291 send2(ourGlobals->serverLuaSL, SID, "return(3)");
298 else if (0 == strcmp(command, "llGetLinkNumber")) 292 else if (0 == strcmp(command, "llGetLinkNumber"))
299 send2(ourGlobals->serverLuaSL, SID, "return 1"); 293 send2(ourGlobals->serverLuaSL, SID, "return(1)");
300 else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 2)"))) 294 else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 2")))
301 send2(ourGlobals->serverLuaSL, SID, "return \".readme\""); 295 send2(ourGlobals->serverLuaSL, SID, "return(\".readme\")");
302 else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 1)"))) 296 else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 1")))
303 send2(ourGlobals->serverLuaSL, SID, "return \".POSITIONS\""); 297 send2(ourGlobals->serverLuaSL, SID, "return(\".POSITIONS\")");
304 else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 0)"))) 298 else if (0 == strcmp(command, "llGetInventoryName") && (0 == strcmp(arguments, "7, 0")))
305 send2(ourGlobals->serverLuaSL, SID, "return \".MENUITEMS\""); 299 send2(ourGlobals->serverLuaSL, SID, "return(\".MENUITEMS\")");
306 else if (0 == strcmp(command, "llListen")) 300 else if (0 == strcmp(command, "llListen"))
307 { 301 {
308 PI("Faked %s(%s", command, arguments); 302 PI("Faked %s(%s)", command, arguments);
309 send2(ourGlobals->serverLuaSL, SID, "return %d", random()); 303 send2(ourGlobals->serverLuaSL, SID, "return(%d)", random());
310 } 304 }
311 else if (0 == strcmp(command, "llSameGroup")) 305 else if (0 == strcmp(command, "llSameGroup"))
312 send2(ourGlobals->serverLuaSL, SID, "return true"); 306 send2(ourGlobals->serverLuaSL, SID, "return(true)");
313 else if (0 == strcmp(command, "llKey2Name")) 307 else if (0 == strcmp(command, "llKey2Name"))
314 { 308 {
315 char *temp; 309 char *temp;
316 310
317 strcpy(buf, arguments); 311 strcpy(buf, arguments);
318 temp = buf; 312 temp = buf;
319 while (')' != temp[0])
320 temp++;
321 temp[0] = '\0';
322 if (0 == strcmp(buf, ownerKey)) 313 if (0 == strcmp(buf, ownerKey))
323 temp = ownerName; 314 temp = ownerName;
324 else 315 else
325 temp = "Unknown User"; 316 temp = "Unknown User";
326 // TODO - Sanitize the name, no telling what weird shit people put in their names. 317 // TODO - Sanitize the name, no telling what weird shit people put in their names.
327 snprintf(buf, sizeof(buf), "return \"%s\"", temp); 318 snprintf(buf, sizeof(buf), "return(\"%s\")", temp);
328 send2(ourGlobals->serverLuaSL, SID, buf); 319 send2(ourGlobals->serverLuaSL, SID, buf);
329 } 320 }
330 // Send "back" stuff on to the one and only client. 321 // 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
335 // Dialogs, notifications, and other stuff goes through some other functions. 326 // Dialogs, notifications, and other stuff goes through some other functions.
336 else if (0 == strcmp(command, "llOwnerSay")) 327 else if (0 == strcmp(command, "llOwnerSay"))
337 { 328 {
338 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); 329 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments);
339 else PW("No where to send %s(%s", command, arguments); 330 else PW("No where to send %s(%s)", command, arguments);
340 } 331 }
341 else if (0 == strcmp(command, "llWhisper")) 332 else if (0 == strcmp(command, "llWhisper"))
342 { 333 {
343 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); 334 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments);
344 else PW("No where to send %s(%s", command, arguments); 335 else PW("No where to send %s(%s)", command, arguments);
345 } 336 }
346 else if (0 == strcmp(command, "llRegionSay")) 337 else if (0 == strcmp(command, "llRegionSay"))
347 { 338 {
348 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); 339 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments);
349 else PW("No where to send %s(%s", command, arguments); 340 else PW("No where to send %s(%s)", command, arguments);
350 } 341 }
351 else if (0 == strcmp(command, "llSay")) 342 else if (0 == strcmp(command, "llSay"))
352 { 343 {
353 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); 344 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments);
354 else PW("No where to send %s(%s", command, arguments); 345 else PW("No where to send %s(%s)", command, arguments);
355 } 346 }
356 else if (0 == strcmp(command, "llShout")) 347 else if (0 == strcmp(command, "llShout"))
357 { 348 {
358 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); 349 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments);
359 else PW("No where to send %s(%s", command, arguments); 350 else PW("No where to send %s(%s)", command, arguments);
360 // TODO - Temporary so we have a place to log stuff from LSL. 351 // TODO - Temporary so we have a place to log stuff from LSL.
361 PD("SHOUTING %s", command); 352 PD("SHOUTING %s", command);
362 } 353 }
363 else if (0 == strcmp(command, "llDialog")) 354 else if (0 == strcmp(command, "llDialog"))
364 { 355 {
365 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s", command, arguments); 356 if (ourGlobals->client) send2(ourGlobals->client, SID, "%s(%s)", command, arguments);
366 } 357 }
367 else if (0 == strcmp(command, "llMessageLinked")) 358 else if (0 == strcmp(command, "llMessageLinked"))
368 { 359 {
@@ -372,7 +363,7 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman
372 scripts = eina_hash_iterator_data_new(ourGlobals->scripts); 363 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
373 while(eina_iterator_next(scripts, (void **) &me)) 364 while(eina_iterator_next(scripts, (void **) &me))
374 { 365 {
375 send2(ourGlobals->serverLuaSL, me->SID, "events.link_message(%s", arguments); 366 send2(ourGlobals->serverLuaSL, me->SID, "events.link_message(%s)", arguments);
376 } 367 }
377 eina_iterator_free(scripts); 368 eina_iterator_free(scripts);
378 } 369 }
@@ -392,11 +383,9 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman
392 while (' ' != temp[0]) 383 while (' ' != temp[0])
393 temp++; 384 temp++;
394 line = temp; 385 line = temp;
395 while (')' != temp[0])
396 temp++;
397 temp[0] = '\0';
398 lineNo = atoi(line); 386 lineNo = atoi(line);
399 snprintf(key, sizeof(key), "%s/Test%%20sim/onefang%%27s%%20test%%20bed/%s", prefix_data_get(), notecard); 387 snprintf(key, sizeof(key), "%s/Test%%20sim/onefang%%27s%%20test%%20bed/%s", prefix_data_get(), notecard);
388//PD("%s -> %s == %d, %s", notecard, line, lineNo, key);
400 389
401 fd = open(key, O_RDONLY); 390 fd = open(key, O_RDONLY);
402 if (-1 != fd) 391 if (-1 != fd)
@@ -418,7 +407,7 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman
418 } while (temp && (0 < lineNo--)); 407 } while (temp && (0 < lineNo--));
419 408
420 sprintf(key, FAKE_UUID); 409 sprintf(key, FAKE_UUID);
421 send2(ourGlobals->serverLuaSL, SID, "return \"%s\"", key); 410 send2(ourGlobals->serverLuaSL, SID, "return(\"%s\")", key);
422 411
423 // TODO - For now, just send it to everyone. 412 // TODO - For now, just send it to everyone.
424 scripts = eina_hash_iterator_data_new(ourGlobals->scripts); 413 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
@@ -438,7 +427,8 @@ static boolean LuaSLParser(void *data, Connection *conn, char *SID, char *comman
438 buf2[j++] = '\\'; 427 buf2[j++] = '\\';
439 buf2[j++] = temp[i]; 428 buf2[j++] = temp[i];
440 } 429 }
441 send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", '%s')", key, buf2); 430//PE("events.dataserver(\"%s\", \'%s\')", key, buf2);
431 send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \'%s\')", key, buf2);
442 } 432 }
443 else 433 else
444 send2(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \"EndOfFuckingAround\")", key); 434 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
513 char buf[PATH_MAX]; 503 char buf[PATH_MAX];
514 504
515 // TODO - For now, just send it to everyone. 505 // TODO - For now, just send it to everyone.
516 sprintf(buf, "%s(%s", command, arguments); 506 sprintf(buf, "%s(%s)", command, arguments);
517 scripts = eina_hash_iterator_data_new(ourGlobals->scripts); 507 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
518 while(eina_iterator_next(scripts, (void **) &me)) 508 while(eina_iterator_next(scripts, (void **) &me))
519 { 509 {