/source/eggdrop/joke-database.lsl |
@@ -478,6 +478,8 @@ |
} |
|
data = llDumpList2String(command, " "); |
if((integer)data == 0) |
data = ""; |
jump_state = "get"; |
state url; |
} |
@@ -497,6 +499,56 @@ |
state_entry() { |
// DEBUG |
llOwnerSay("[Joke] Retrieving from database."); |
if(data == "") { |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group LIMIT 1 OFFSET :id"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"id", |
(string)( |
(integer)llFrand( |
joke_counter |
) + 1 |
) |
] |
) |
), |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
return; |
} |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
@@ -519,7 +571,7 @@ |
), |
"SQL", wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group LIMIT 1 OFFSET :id"), |
"\" WHERE name=:group AND id=:id"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
@@ -531,11 +583,7 @@ |
) |
), |
"id", |
(string)( |
(integer)llFrand( |
joke_counter |
) + 1 |
) |
data |
] |
) |
), |
@@ -640,7 +688,7 @@ |
), |
"SQL", wasURLEscape("INSERT INTO \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" (name, data, firstname, lastname) VALUES (:name, :data, :firstname, :lastname)"), |
"\" (name, data, firstname, lastname, id) VALUES (:name, :data, :firstname, :lastname, :id)"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
@@ -656,7 +704,9 @@ |
"firstname", |
wasURLEscape(firstname), |
"lastname", |
wasURLEscape(lastname) |
wasURLEscape(lastname), |
"id", |
(string)(joke_counter + 1) |
] |
) |
), |
@@ -680,7 +730,7 @@ |
state listen_group; |
} |
++joke_counter; |
data = "Joke has been stored."; |
data = "Joke " + (string)joke_counter + " has been stored."; |
state tell; |
} |
timer() { |
@@ -740,7 +790,7 @@ |
) |
), |
"id", |
wasURLEscape(data) |
data |
] |
) |
), |