/source/eggdrop/ban.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that bans group members using fuzzy name matching. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -162,7 +162,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasSetIntersect(list a, list b) { |
if(llGetListLength(a) == 0) return []; |
@@ -175,6 +175,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
// banee |
@@ -201,8 +203,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -221,48 +223,70 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "ban") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
firstname = wasKeyValueGet("firstname", message); |
lastname = wasKeyValueGet("lastname", message); |
|
|
if(firstname == "" || lastname == "") { |
data = "And who would yarr be?"; |
state tell; |
} |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
// Get roles of caller. |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Ban] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Ban] Got URL..."); |
state get_caller_roles; |
} |
on_rez(integer num) { |
@@ -269,8 +293,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -283,54 +307,46 @@ |
llOwnerSay("[Ban] Searching for caller..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmemberroles", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
|
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Ban] Unable to get member roles: " + |
llOwnerSay("[Ban] Unable to get member roles: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
|
// Dump the roles to a list. |
list roles = wasCSVToList( |
wasURLUnescape( |
@@ -337,9 +353,9 @@ |
wasKeyValueGet("data", body) |
) |
); |
|
|
if(llGetListLength( |
wasSetIntersect(roles, |
wasSetIntersect(roles, |
wasCSVToList( |
wasKeyValueGet( |
"admin roles", configuration |
@@ -348,32 +364,34 @@ |
) |
) == 0) { |
data = "You ain't got the cojones!"; |
llReleaseURL(URL); |
state tell; |
} |
|
|
list banee = llParseString2List(data, [" "], []); |
|
|
firstname = llList2String(banee, 0); |
banee = llDeleteSubList(banee, 0, 0); |
lastname = llList2String(banee, 0); |
banee = llDeleteSubList(banee, 0, 0); |
|
|
if(firstname == "" || lastname == "") { |
data = "Full name required."; |
state tell; |
} |
|
if(llGetListLength(banee) != 0 && |
|
if(llGetListLength(banee) != 0 && |
llToLower(llList2String(banee, 0)) == "nosoft") { |
soft = "False"; |
banee = llDeleteSubList(banee, 0, 0); |
} |
|
|
// GC |
banee = []; |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -380,8 +398,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -397,43 +415,36 @@ |
llOwnerSay("[Ban] Searching for banee..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmemberroles", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
if(wasKeyValueGet("status", body) == "19862") { |
// DEBUG |
llOwnerSay("[Ban] User not in group, but proceeding anyway..."); |
@@ -440,27 +451,30 @@ |
jump continue; |
} |
// DEBUG |
llOwnerSay("[Ban] Unable to get member roles: " + |
llOwnerSay("[Ban] Unable to get member roles: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
|
@continue; |
string result = wasURLUnescape( |
wasKeyValueGet("data", body) |
); |
|
|
if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
data = "Ejectee is an owner. I'm not gunna open the pod bay doors."; |
llReleaseURL(URL); |
state tell; |
} |
|
|
state ban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -467,8 +481,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -484,21 +498,21 @@ |
llOwnerSay("[Ban] Banning..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "ban", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -512,26 +526,19 @@ |
) |
), |
"eject", "True", |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "ban") |
return; |
|
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "ban" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Ban] Unable to ban member: " + |
llOwnerSay("[Ban] Unable to ban member: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -538,12 +545,13 @@ |
); |
state listen_group; |
} |
|
|
data = "Hasta la vista, baby!"; |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -550,8 +558,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -567,21 +575,21 @@ |
llOwnerSay("[Ban] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -590,10 +598,10 @@ |
] |
) |
); |
|
|
// reset variables. |
soft = "True"; |
|
|
state listen_group; |
} |
} |
/source/eggdrop/control.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// An eggdrop-like group bot using Corrade. |
@@ -17,52 +17,10 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueDelete(string k, string data) { |
if(llStringLength(data) == 0) return ""; |
if(llStringLength(k) == 0) return ""; |
integer i = llListFindList( |
llList2ListStrided( |
llParseString2List(data, ["&", "="], []), |
0, -1, 2 |
), |
[ k ]); |
if(i != -1) return llDumpList2String( |
llDeleteSubList( |
llParseString2List(data, ["&"], []), |
i, i), |
"&"); |
return data; |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueSet(string k, string v, string data) { |
if(llStringLength(k) == 0) return ""; |
if(llStringLength(v) == 0) return ""; |
if(llStringLength(data) == 0) return k + "=" + v; |
integer i = llListFindList( |
llList2ListStrided( |
llParseString2List(data, ["&", "="], []), |
0, -1, 2 |
), |
[ k ]); |
if(i != -1) return llDumpList2String( |
llListReplaceList( |
llParseString2List(data, ["&"], []), |
[ k + "=" + v ], |
i, i), |
"&"); |
return data + "&" + k + "=" + v; |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); |
@@ -76,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -100,7 +58,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -109,15 +67,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -124,7 +82,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -132,18 +90,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -152,48 +110,9 @@ |
return llDumpList2String(v, ","); |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
list s = []; |
string m = ""; |
do { |
string a = llGetSubString(csv, 0, 0); |
csv = llDeleteSubString(csv, 0, 0); |
if(a == ",") { |
if(llList2String(s, -1) != "\"") { |
l += m; |
m = ""; |
jump continue; |
} |
m += a; |
jump continue; |
} |
if(a == "\"" && llGetSubString(csv, 0, 0) == a) { |
m += a; |
csv = llDeleteSubString(csv, 0, 0); |
jump continue; |
} |
if(a == "\"") { |
if(llList2String(s, -1) != a) { |
s += a; |
jump continue; |
} |
s = llDeleteSubList(s, -1, -1); |
jump continue; |
} |
m += a; |
@continue; |
} while(csv != ""); |
// postcondition: length(s) = 0 |
return l + m; |
} |
|
// for notecard reading |
integer line = 0; |
|
|
// key-value data will be read into this list |
list tuples = []; |
string configuration = ""; |
@@ -225,7 +144,7 @@ |
key CORRADE = llList2Key( |
tuples, |
llListFindList( |
tuples, |
tuples, |
[ |
"corrade" |
] |
@@ -238,7 +157,7 @@ |
string GROUP = llList2String( |
tuples, |
llListFindList( |
tuples, |
tuples, |
[ |
"group" |
] |
@@ -251,7 +170,7 @@ |
string PASSWORD = llList2String( |
tuples, |
llListFindList( |
tuples, |
tuples, |
[ |
"password" |
] |
@@ -264,7 +183,7 @@ |
string VERSION = llList2String( |
tuples, |
llListFindList( |
tuples, |
tuples, |
[ |
"version" |
] |
@@ -282,9 +201,8 @@ |
state request_url_notifications; |
} |
if(data == "") jump continue; |
// No support for inline comments for this one! Needs parsing! |
integer i = llSubStringIndex(data, "#"); |
if(i == 0) data = llDeleteSubString(data, i, -1); |
if(i != -1) data = llDeleteSubString(data, i, -1); |
list o = llParseString2List(data, ["="], []); |
// get rid of starting and ending quotes |
string k = llDumpList2String( |
@@ -291,10 +209,10 @@ |
llParseString2List( |
llStringTrim( |
llList2String( |
o, |
o, |
0 |
), |
STRING_TRIM), |
), |
STRING_TRIM), |
["\""], [] |
), "\""); |
string v = llDumpList2String( |
@@ -301,10 +219,10 @@ |
llParseString2List( |
llStringTrim( |
llList2String( |
o, |
o, |
1 |
), |
STRING_TRIM), |
), |
STRING_TRIM), |
["\""], [] |
), "\""); |
if(k == "" || v == "") jump continue; |
@@ -343,8 +261,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -357,21 +275,21 @@ |
llOwnerSay("[Control] Releasing notifications..."); |
llInstantMessage( |
(key)wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "notify", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -378,7 +296,7 @@ |
"action", "remove", |
"tag", wasURLEscape( |
wasKeyValueGet( |
"notification tag", |
"notification tag", |
configuration |
) |
), |
@@ -393,7 +311,7 @@ |
if(wasKeyValueGet("command", body) != "notify" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Control] Unable to release tag: " + |
llOwnerSay("[Control] Unable to release tag: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -410,8 +328,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -427,21 +345,21 @@ |
llOwnerSay("[Control] Binding to notifications..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "notify", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -454,7 +372,7 @@ |
"URL", wasURLEscape(URL), |
"tag", wasURLEscape( |
wasKeyValueGet( |
"notification tag", |
"notification tag", |
configuration |
) |
), |
@@ -469,7 +387,7 @@ |
if(wasKeyValueGet("command", body) != "notify" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Control] Unable to bind notifications: " + |
llOwnerSay("[Control] Unable to bind notifications: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -476,7 +394,7 @@ |
); |
llResetScript(); |
} |
state version_check; |
state serve_configuration; |
} |
timer() { |
llOwnerSay("[Control] Timeout binding notifications"); |
@@ -486,8 +404,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -497,7 +415,7 @@ |
} |
} |
|
state version_check { |
state serve_configuration { |
state_entry() { |
// DEBUG |
llOwnerSay("[Control] Checking version..."); |
@@ -511,13 +429,13 @@ |
"command", "version", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -530,12 +448,16 @@ |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llSetTimerEvent(0); |
|
if(wasKeyValueGet("command", body) != "version") { |
llMessageLinked(LINK_THIS, 0, body, "notification"); |
return; |
} |
|
if(wasKeyValueGet("success", body) != "True") { |
llOwnerSay("[Control] Version check failed..."); |
return; |
} |
|
|
list v = llParseString2List( |
wasKeyValueGet( |
"data", |
@@ -563,18 +485,19 @@ |
" for this template." |
); |
compatible = FALSE; |
//llReleaseURL(URL); |
return; |
} |
|
// Add the URL to the configuration so it can be used for all components. |
configuration = wasKeyValueSet("URL", URL, configuration); |
|
// DEBUG |
llOwnerSay("[Control] Version is compatible!"); |
compatible = TRUE; |
|
state serve_configuration; |
//llReleaseURL(URL); |
return; |
} |
link_message(integer sender, integer num, string message, key id) { |
if(message != "configuration") return; |
llMessageLinked(LINK_THIS, 0, configuration, "configuration"); |
} |
timer() { |
llOwnerSay("[Control] Timeout checking version..."); |
llResetScript(); |
@@ -583,8 +506,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -593,91 +516,3 @@ |
llSetTimerEvent(0); |
} |
} |
|
state serve_configuration { |
state_entry() { |
// DEBUG |
llOwnerSay("[Control] Serving configuration and passing callbacks..."); |
} |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
|
if(wasKeyValueGet("command", body) != "") { |
llMessageLinked(LINK_THIS, 0, body, "callback"); |
return; |
} |
|
// Check if this group message is from Corrade and passed through Discord. |
if(wasKeyValueGet("type", body) == "group" && |
llToUpper(wasKeyValueGet("agent", body)) == llToUpper(wasKeyValueGet("corrade", configuration)) && |
llSubStringIndex(wasURLUnescape(wasKeyValueGet("message", body)), "[Discord]:") != -1) { |
|
// Split message in Discord discriminator and message body. |
list messageSplit = llParseString2List( |
wasURLUnescape( |
wasKeyValueGet("message", body) |
), |
["[Discord]:"], |
[] |
); |
|
// Retrive the Discord discriminator. |
string did = llStringTrim( |
llList2String( |
messageSplit, |
0 |
), |
STRING_TRIM |
); |
|
|
// Retrieve a list of Discord discriminator that are allowed to send administrative commands. |
list admins = wasCSVToList(wasKeyValueGet("discord admin", configuration)); |
|
// If the sender is not amongst the administrative Discord discriminators, then strip the agent details. |
if(llListFindList(admins, [ did ]) == -1) { |
// DEBUG |
llOwnerSay("[Control] Non admin, issuing command, strip the agent details from the command."); |
|
body = wasKeyValueDelete("firstname", body); |
body = wasKeyValueDelete("lastname", body); |
body = wasKeyValueDelete("agent", body); |
} |
|
// Pack the message back without the Discord discriminator identifier. |
body = wasKeyValueSet( |
"message", |
wasURLEscape( |
llStringTrim( |
llList2String( |
messageSplit, |
1 |
), |
STRING_TRIM |
) |
), |
body |
); |
} |
|
llMessageLinked(LINK_THIS, 0, body, "notification"); |
} |
link_message(integer sender, integer num, string message, key id) { |
if(message != "configuration") return; |
|
llMessageLinked(LINK_THIS, 0, configuration, "configuration"); |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
/source/eggdrop/dice.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A dice roll with a configurable range. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -185,8 +187,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -205,61 +207,58 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "roll") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
list range = wasCSVToList( |
wasKeyValueGet("roll range", configuration) |
); |
|
|
integer roll = llList2Integer(command, 0); |
if(roll < llList2Integer(range, 0) || roll > llList2Integer(range, 1)) { |
data = "Value should be within bounds [" + |
llList2String(range, 0) + |
"," + |
data = "Value should be within bounds [" + |
llList2String(range, 0) + |
"," + |
llList2String(range, 1) + |
"]."; |
state tell; |
} |
|
|
data = wasKeyValueGet( |
"firstname", |
"firstname", |
message |
) + |
" " + |
wasKeyValueGet( |
"lastname", |
"lastname", |
message |
) + " rolls a " + |
) + " rolls a " + |
(string)((integer)(llFrand(roll + 1))); |
|
|
state tell; |
} |
on_rez(integer num) { |
@@ -266,8 +265,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -280,21 +279,21 @@ |
llOwnerSay("[Dice] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/eval.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that evaluates a mathematical expression for Corrade Eggdrop. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -168,7 +168,7 @@ |
if(llGetListLength(lst)<=1) return lst; |
return wasListReverse(llList2List(lst, 1, llGetListLength(lst))) + llList2List(lst,0,0); |
} |
|
|
////////////////////////////////////////////////////////// |
// Deletes elements delete from list input. |
////////////////////////////////////////////////////////// |
@@ -185,7 +185,7 @@ |
} while(delete = llDeleteSubList(delete, 0, 0)); |
return input; |
} |
|
|
////////////////////////////////////////////////////////// |
// Returns a list of operators and operands. |
////////////////////////////////////////////////////////// |
@@ -194,7 +194,7 @@ |
list result = llParseString2List(input, [], op); |
return wasSubtractSubList(result, [" "]); |
} |
|
|
////////////////////////////////////////////////////////// |
// Transforms an infix expression to a postfix expression. |
////////////////////////////////////////////////////////// |
@@ -235,9 +235,9 @@ |
@continue; |
} while(llGetListLength(infix) != 0); |
result += wasListReverse(opStack); |
return result; |
return result; |
} |
|
|
////////////////////////////////////////////////////////// |
// Evaluate a postfix expression. |
////////////////////////////////////////////////////////// |
@@ -326,6 +326,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -353,8 +355,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -373,36 +375,33 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "eval") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Dump the rest of the message. |
data = (string)wasPostfixEval( |
wasInfixToPostfix( |
@@ -414,7 +413,7 @@ |
) |
) |
); |
|
|
state tell; |
} |
on_rez(integer num) { |
@@ -421,8 +420,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -435,21 +434,21 @@ |
llOwnerSay("[Eval] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/fortune.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A fortune module for Corrade Eggdrop. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -192,8 +192,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -229,8 +229,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -246,44 +246,41 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "fortune") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
data = llList2String( |
nList, |
nList, |
(integer) |
llFrand( |
llGetListLength(nList) |
) |
); |
|
|
state tell; |
} |
on_rez(integer num) { |
@@ -290,8 +287,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -304,21 +301,21 @@ |
llOwnerSay("[Fortune] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/heartbeat.lsl |
@@ -17,7 +17,7 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -199,8 +199,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -219,45 +219,45 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "heartbeat") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
// Get heartbeat. |
state heartbeat; |
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -264,27 +264,52 @@ |
} |
} |
|
state heartbeat { |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Heartbeat] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Heartbeat] Got URL..."); |
state version; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
state version { |
state_entry() { |
// DEBUG |
llOwnerSay("[Heartbeat] Getting heartbeat data..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getheartbeatdata", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -292,29 +317,22 @@ |
[ |
"AverageCPUUsage", |
"AverageRAMUsage", |
"AverageNETUsage", |
"Uptime" |
] |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getheartbeatdata") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "getheartbeatdata" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Heartbeat] Unable to get heartbeat data: " + |
llOwnerSay("[Heartbeat] Unable to get heartbeat data: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -321,7 +339,7 @@ |
); |
state listen_group; |
} |
|
|
list stats = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet( |
@@ -330,15 +348,15 @@ |
) |
) |
); |
|
|
string CPU = llList2String( |
stats, |
llListFindList( |
stats, |
stats, |
["AverageCPUUsage"] |
) + 1 |
); |
|
|
// AverageRAMUsage is returned in bytes, |
// so convert the value to MiB and round. |
string RAM = (string)llRound( |
@@ -345,37 +363,26 @@ |
llList2Float( |
stats, |
llListFindList( |
stats, |
stats, |
["AverageRAMUsage"] |
) + 1 |
) / 1024 / 1024 |
); |
|
// AverageNETUsage is returned in bytes, |
// so convert the value to MiB and round. |
string NET = (string)llRound( |
llList2Float( |
stats, |
llListFindList( |
stats, |
["AverageNETUsage"] |
) + 1 |
) / 1024 / 1024 |
); |
|
|
string uptime = llList2String( |
stats, |
llListFindList( |
stats, |
stats, |
["Uptime"] |
) + 1 |
); |
|
data = "RAM: " + RAM + "MiB" + " CPU: " + CPU + "%" + " NET: " + NET + "MiB" + " Uptime: " + uptime; |
|
|
data = "RAM: " + RAM + "MiB" + " CPU: " + CPU + "%" + " Uptime: " + uptime; |
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -382,8 +389,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -399,21 +406,21 @@ |
llOwnerSay("[Heartbeat] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/help.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// Help message for Corrade eggdrop. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -185,8 +187,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -205,61 +207,58 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
string firstname = wasURLUnescape( |
wasKeyValueGet( |
"firstname", |
"firstname", |
message |
) |
); |
|
|
string agent = (key)wasURLUnescape( |
wasKeyValueGet( |
"agent", |
"agent", |
message |
) |
); |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "help") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
if(llGetInventoryType(wasKeyValueGet("help card", configuration)) |
|
if(llGetInventoryType(wasKeyValueGet("help card", configuration)) |
!= INVENTORY_NOTECARD) { |
data = "Hmm. I have not notecard to hand out - contact my owner please?"; |
state tell; |
} |
|
|
// Hand out the notecard. |
llGiveInventory(agent, |
llGiveInventory(agent, |
wasKeyValueGet("help card", configuration) |
); |
|
|
data = "Sent you a help notecard " + firstname + ". Please check your inventory."; |
|
state tell; |
@@ -268,8 +267,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -282,21 +281,21 @@ |
llOwnerSay("[Help] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/invite.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that invites people to the group members. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
string firstname = ""; |
@@ -187,8 +189,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -207,40 +209,62 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "invite") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
// Search for agent. |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Invite] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Invite] Got URL..."); |
state search; |
} |
on_rez(integer num) { |
@@ -247,8 +271,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -261,21 +285,21 @@ |
llOwnerSay("[Invite] Searching for agent."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "directorysearch", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -289,47 +313,41 @@ |
] |
) |
),*/ |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "directorysearch") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "directorysearch" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Invite] Unable to search for agent: " + |
llOwnerSay("[Invite] Unable to search for agent: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
|
list first_last = llParseString2List(data, [" "], []); |
firstname = llList2String(first_last, 0); |
lastname = llList2String(first_last, 1); |
|
|
list found_agent = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
); |
|
|
if(llToUpper( |
llList2String( |
found_agent, |
llListFindList( |
found_agent, |
found_agent, |
(list)"FirstName" |
) + 1 |
) |
@@ -344,12 +362,14 @@ |
) |
) != llToUpper(lastname)) { |
data = "Agent not found."; |
llReleaseURL(URL); |
state tell; |
} |
|
|
state invite; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -356,8 +376,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -373,21 +393,21 @@ |
llOwnerSay("[Invite] inviting..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "invite", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -395,25 +415,19 @@ |
"lastname", lastname, |
"soft", "True", |
"verify", "False", |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "invite") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "invite" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Eject] Unable to invite agent: " + |
llOwnerSay("[Eject] Unable to invite agent: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -420,12 +434,13 @@ |
); |
state listen_group; |
} |
|
|
data = "Butters (Jym) was sent to pick them up!"; |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -432,8 +447,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -449,21 +464,21 @@ |
llOwnerSay("[Invite] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/joke-database.lsl |
@@ -5,7 +5,7 @@ |
// A database-based joke module for Corrade Eggdrop. |
// |
/////////////////////////////////////////////////////////////////////////// |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -17,7 +17,7 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -32,7 +32,7 @@ |
} while(llGetListLength(k) != 0); |
return llDumpList2String(data, "&"); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -44,7 +44,7 @@ |
return <x, y, 0>; |
return wasCirclePoint(radius); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -68,7 +68,7 @@ |
} while(i != ""); |
return o; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -107,7 +107,7 @@ |
// postcondition: length(s) = 0 |
return l + m; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -136,7 +136,7 @@ |
} while(l != []); |
return llDumpList2String(v, ","); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -147,32 +147,32 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
} |
|
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string firstname = ""; |
string lastname = ""; |
string group = ""; |
string data = ""; |
string action = ""; |
|
string statement = ""; |
string parameters = ""; |
|
string jump_state = ""; |
integer joke_counter = 0; |
|
default { |
state_entry() { |
llOwnerSay("[Joke] Starting module..."); |
@@ -182,8 +182,8 @@ |
if(id != "configuration") return; |
llOwnerSay("[Joke] Got configuration..."); |
configuration = message; |
action = "create_database"; |
state trampoline; |
jump_state = "create_database"; |
state url; |
} |
timer() { |
llOwnerSay("[Joke] Requesting configuration..."); |
@@ -193,8 +193,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -203,161 +203,32 @@ |
llSetTimerEvent(0); |
} |
} |
|
state trampoline { |
|
state url { |
state_entry() { |
if(action == "create_database") { |
statement = wasURLEscape("CREATE TABLE IF NOT EXISTS \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" (data text(1023), name text(35), firstname text(31), lastname text(31), id integer NOT NULL PRIMARY KEY)"); |
state query; |
} |
|
if(action == "random") { |
statement = wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group ORDER BY RANDOM() LIMIT 1"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
) |
] |
) |
); |
|
state query; |
} |
|
if(action == "id") { |
statement = wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group AND id=:id"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"id", |
data |
] |
) |
); |
state query; |
} |
|
if(action == "search") { |
statement = wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group AND data LIKE :data COLLATE NOCASE ORDER BY RANDOM() LIMIT 1"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"data", |
wasURLEscape("%" + llDumpList2String(llParseString2List(data, [" "], []), "%") + "%") |
] |
) |
); |
state query; |
} |
|
if(action == "remove") { |
statement = wasURLEscape("DELETE FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:name AND id=:id"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"name", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"id", |
data |
] |
) |
); |
state query; |
} |
|
if(action == "add") { |
statement = wasURLEscape("INSERT INTO \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" (name, data, firstname, lastname) VALUES (:name, :data, :firstname, :lastname)"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"name", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"data", |
wasURLEscape(data), |
"firstname", |
wasURLEscape(firstname), |
"lastname", |
wasURLEscape(lastname) |
] |
) |
); |
state query; |
} |
|
if(action == "get_joke_id") { |
statement = wasURLEscape("SELECT MAX(id) AS LAST FROM \"" + |
wasKeyValueGet("joke table", configuration) + "\""); |
state query; |
} |
|
if(action == "by") { |
statement = wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group AND firstname=:firstname AND lastname=:lastname ORDER BY RANDOM() LIMIT 1"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"firstname", |
wasURLEscape(firstname), |
"lastname", |
wasURLEscape(lastname) |
] |
) |
); |
|
state query; |
} |
|
// DEBUG |
llOwnerSay("[Joke] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Joke] Got URL..."); |
if(jump_state == "create_database") |
state create_database; |
if(jump_state == "get") |
state get; |
if(jump_state == "add") |
state add; |
if(jump_state == "remove") |
state remove; |
if(jump_state == "count_jokes") |
state count_jokes; |
if(jump_state == "listen_group") |
state listen_group; |
|
// DEBUG |
llOwnerSay("[Joke] Jump table corrupted, please contact creator..."); |
llResetScript(); |
} |
@@ -365,164 +236,161 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
state query { |
|
state create_database { |
state_entry() { |
// Check messge length. |
string message = wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"SQL", statement, |
"data", parameters, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
] |
); |
|
// GC - none of these are needed anymore. |
statement = ""; |
parameters = ""; |
|
// Message length check. |
if(llStringLength(message) > 1023) { |
data = "Message length exceeded 1023 characters."; |
state tell; |
} |
|
// DEBUG |
llOwnerSay("[Joke] Executing action: " + action); |
llOwnerSay("[Joke] Creating database: " + wasKeyValueGet("joke table", configuration)); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
message |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("CREATE TABLE IF NOT EXISTS \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" (data text(1023), name text(35), firstname text(31), lastname text(31), id integer NOT NULL PRIMARY KEY)"), |
"callback", wasURLEscape(URL) |
] |
) |
); |
// GC |
message = ""; |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "database") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Joke] Unable query database: " + |
llOwnerSay("[Joke] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
state listen_group; |
} |
|
if(action == "create_database") { |
llOwnerSay("[Joke] Database created!"); |
state listen_group; |
} |
|
if(action == "random" || action == "id" || action == "search" || action == "by") { |
list result = wasCSVToList( |
) + |
" " + |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
|
); |
|
if(llGetListLength(result) != 10) { |
data = "No joke found. . ."; |
state tell; |
} |
|
data = llList2String( |
result, |
llListFindList(result, ["data"]) + 1 |
); |
|
firstname = llList2String( |
result, |
llListFindList(result, ["firstname"]) + 1 |
); |
|
lastname = llList2String( |
result, |
llListFindList(result, ["lastname"]) + 1 |
); |
|
string id = llList2String( |
result, |
llListFindList(result, ["id"]) + 1 |
); |
|
// Build data to be sent. |
data += " " + "[" + firstname + " " + lastname + "/" + id + "]"; |
|
state tell; |
llResetScript(); |
} |
|
if(action == "remove") { |
data = "Joke " + data + " has been removed."; |
state tell; |
llOwnerSay("[Joke] Database created!"); |
jump_state = "count_jokes"; |
state url; |
} |
timer() { |
llResetScript(); |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
if(action == "add") { |
action = "get_joke_id"; |
data = body; |
state trampoline; |
} |
|
if(action == "get_joke_id") { |
list result = wasCSVToList( |
state count_jokes { |
state_entry() { |
// DEBUG |
llOwnerSay("[Joke] Counting jokes in database: " + wasKeyValueGet("joke table", configuration)); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("SELECT COUNT(*) AS count FROM \"" + |
wasKeyValueGet("joke table", configuration) + "\""), |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Joke] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) + |
" " + |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
|
); |
|
data = llList2String( |
result, |
llListFindList(result, ["LAST"]) + 1 |
); |
|
data = "Joke " + data + " has been stored."; |
state tell; |
llResetScript(); |
} |
|
// DEBUG |
llOwnerSay("[Joke] Jump table corrupted, please contact creator..."); |
|
list result = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
); |
|
joke_counter = llList2Integer( |
result, |
llListFindList(result, ["count"]) + 1 |
) + 1; |
|
llOwnerSay("[Joke] There are " + (string)joke_counter + " jokes in the database."); |
state listen_group; |
} |
timer() { |
state listen_group; |
llResetScript(); |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -531,7 +399,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state listen_group { |
state_entry() { |
// DEBUG |
@@ -541,54 +409,54 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
return; |
|
|
// Get the message sender. |
firstname = wasURLUnescape( |
wasKeyValueGet( |
"firstname", |
"firstname", |
message |
) |
); |
|
|
lastname = wasURLUnescape( |
wasKeyValueGet( |
"lastname", |
"lastname", |
message |
) |
); |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "joke") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Remove action. |
action = llList2String(command, 0); |
// Jump to the "add" state for adding |
string action = llList2String(command, 0); |
// Jump to the "add" state for adding |
if(action == "add") { |
command = llDeleteSubList(command, 0, 0); |
data = llDumpList2String(command, " "); |
@@ -596,11 +464,11 @@ |
data = "The joke's too short to be funny."; |
state tell; |
} |
action = "add"; |
state trampoline; |
jump_state = "add"; |
state url; |
} |
|
// Jump to the "remove" state for removing |
|
// Jump to the "remove" state for removing |
if(action == "remove") { |
command = llDeleteSubList(command, 0, 0); |
data = llDumpList2String(command, " "); |
@@ -608,59 +476,369 @@ |
data = "Which one though? Please provide a joke id."; |
state tell; |
} |
action = "remove"; |
state trampoline; |
jump_state = "remove"; |
state url; |
} |
|
if(action == "by") { |
command = llDeleteSubList(command, 0, 0); |
firstname = llList2String(command, 0); |
command = llDeleteSubList(command, 0, 0); |
lastname = llList2String(command, 0); |
command = llDeleteSubList(command, 0, 0); |
data = llDumpList2String(command, " "); |
|
if(llStringLength(firstname) == 0 || |
llStringLength(lastname) == 0) { |
data = "First and Last name is required."; |
state tell; |
} |
|
action = "by"; |
state trampoline; |
} |
|
string index = llList2String(command, 0); |
command = llDeleteSubList(command, 0, 0); |
|
|
data = llDumpList2String(command, " "); |
|
if(index == "search") { |
action = "search"; |
state trampoline; |
if((integer)data <= 0) |
data = ""; |
jump_state = "get"; |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
|
if((integer)index <= 0) { |
action = "random"; |
state trampoline; |
} |
} |
|
state get { |
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", |
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 AND id=:id"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"id", |
data |
] |
) |
), |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Joke] Unable retrieve from database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
state listen_group; |
} |
|
list result = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
); |
|
if(llGetListLength(result) != 10) { |
data = "No joke found. . ."; |
state tell; |
} |
|
data = llList2String( |
result, |
llListFindList(result, ["data"]) + 1 |
); |
|
string firstname = llList2String( |
result, |
llListFindList(result, ["firstname"]) + 1 |
); |
|
string lastname = llList2String( |
result, |
llListFindList(result, ["lastname"]) + 1 |
); |
|
string id = llList2String( |
result, |
llListFindList(result, ["id"]) + 1 |
); |
|
// Build data to be sent. |
data += " " + "[" + firstname + " " + lastname + "/" + id + "]"; |
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
state add { |
state_entry() { |
// DEBUG |
llOwnerSay("[Joke] Adding to database: " + (string)(joke_counter + 1)); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("INSERT INTO \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" (name, data, firstname, lastname, id) VALUES (:name, :data, :firstname, :lastname, :id)"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
"name", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"data", |
wasURLEscape(data), |
"firstname", |
wasURLEscape(firstname), |
"lastname", |
wasURLEscape(lastname), |
"id", |
(string)(joke_counter + 1) |
] |
) |
), |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Joke] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
); |
state listen_group; |
} |
++joke_counter; |
data = "Joke " + (string)joke_counter + " has been stored."; |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
data = index; |
action = "id"; |
state trampoline; |
state remove { |
state_entry() { |
// DEBUG |
llOwnerSay("[Joke] Removing from database."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("DELETE FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:name AND id=:id"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
"name", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"id", |
data |
] |
) |
), |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Joke] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
state listen_group; |
} |
--joke_counter; |
data = "Joke " + data + " has been removed."; |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
|
state tell { |
state_entry() { |
// DEBUG |
@@ -667,21 +845,21 @@ |
llOwnerSay("[Joke] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/motd.lsl |
@@ -1,11 +1,11 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A MOTD module for Corrade Eggdrop. |
// |
/////////////////////////////////////////////////////////////////////////// |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -32,9 +32,9 @@ |
} while(llGetListLength(k) != 0); |
return llDumpList2String(data, "&"); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -44,9 +44,9 @@ |
return <x, y, 0>; |
return wasCirclePoint(radius); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -68,9 +68,9 @@ |
} while(i != ""); |
return o; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -107,9 +107,9 @@ |
// postcondition: length(s) = 0 |
return l + m; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -136,9 +136,9 @@ |
} while(l != []); |
return llDumpList2String(v, ","); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,22 +147,24 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
} |
|
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string firstname = ""; |
string lastname = ""; |
@@ -169,8 +171,7 @@ |
string group = ""; |
string data = ""; |
string jump_state = ""; |
integer membershipFee; |
|
|
default { |
state_entry() { |
llOwnerSay("[MOTD] Starting module..."); |
@@ -181,7 +182,7 @@ |
llOwnerSay("[MOTD] Got configuration..."); |
configuration = message; |
jump_state = "create_database"; |
state trampoline; |
state url; |
} |
timer() { |
llOwnerSay("[MOTD] Requesting configuration..."); |
@@ -191,8 +192,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -201,9 +202,18 @@ |
llSetTimerEvent(0); |
} |
} |
|
state trampoline { |
|
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[MOTD] Got URL..."); |
if(jump_state == "create_database") |
state create_database; |
if(jump_state == "greet") |
@@ -212,13 +222,9 @@ |
state get; |
if(jump_state == "set") |
state set; |
if(jump_state == "fee") |
state fee; |
if(jump_state == "pay") |
state pay; |
if(jump_state == "listen_group") |
state listen_group; |
|
|
// DEBUG |
llOwnerSay("[MOTD] Jump table corrupted, please contact creator..."); |
llResetScript(); |
@@ -227,14 +233,14 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
|
state create_database { |
state_entry() { |
// DEBUG |
@@ -241,54 +247,48 @@ |
llOwnerSay("[MOTD] Creating database: " + wasKeyValueGet("motd table", configuration)); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("CREATE TABLE IF NOT EXISTS \"" + |
wasKeyValueGet("motd table", configuration) + |
"SQL", wasURLEscape("CREATE TABLE IF NOT EXISTS \"" + |
wasKeyValueGet("motd table", configuration) + |
"\" (name text unique collate nocase, data text)"), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "database") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[MOTD] Unable modify database: " + |
llOwnerSay("[MOTD] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) + |
" " + |
) + |
" " + |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
|
|
); |
llResetScript(); |
} |
@@ -296,6 +296,7 @@ |
state listen_group; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -302,8 +303,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -312,8 +313,8 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
|
|
state listen_group { |
state_entry() { |
// DEBUG |
@@ -323,7 +324,7 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// Get the group. |
group = wasURLUnescape( |
wasKeyValueGet( |
@@ -331,15 +332,7 @@ |
message |
) |
); |
|
// This script only processes group and membership notifications. |
// Esnure that the notification is meant for the configured group. |
if((wasKeyValueGet("type", message) != "membership" && wasKeyValueGet("type", message) != "group") || |
((wasKeyValueGet("type", message) == "membership" || wasKeyValueGet("type", message) == "group") && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
return; |
|
|
// Retrieve the membership notification. |
if(wasKeyValueGet("type", message) == "membership" && |
wasKeyValueGet("action", message) == "joined") { |
@@ -355,92 +348,86 @@ |
message |
) |
); |
|
if(wasKeyValueGet("pay back", configuration) != "true") { |
jump_state = "greet"; |
state trampoline; |
} |
|
jump_state = "fee"; |
state trampoline; |
jump_state = "greet"; |
state url; |
} |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "motd") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// DEBUG |
//llOwnerSay("Remaining data: " + data); |
|
|
// Get the sent message. |
if(data == "") { |
jump_state = "get"; |
state trampoline; |
state url; |
} |
|
data = wasURLEscape(data); |
|
jump_state = "set"; |
state trampoline; |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
|
state greet { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Retrieving MOTD..."); |
llOwnerSay("[MOTD] Member joined, retrieving MOTD..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("SELECT data FROM \"" + |
wasKeyValueGet("motd table", configuration) + |
wasKeyValueGet("motd table", configuration) + |
"\" WHERE name=:group"), |
"data", wasURLEscape( |
wasListToCSV( |
@@ -450,25 +437,19 @@ |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "database") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[MOTD] Unable retrieve from database: " + |
llOwnerSay("[MOTD] Unable retrieve from database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -475,7 +456,7 @@ |
); |
state listen_group; |
} |
|
|
data = llDumpList2String( |
llDeleteSubList( |
wasCSVToList( |
@@ -488,14 +469,15 @@ |
), |
"" |
); |
|
|
if(data == "") |
state listen_group; |
|
|
data = "Hello " + firstname + " " + lastname + "!" + " " + data; |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -502,8 +484,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -512,7 +494,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state get { |
state_entry() { |
// DEBUG |
@@ -519,26 +501,26 @@ |
llOwnerSay("[MOTD] Retrieving from database."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("SELECT data FROM \"" + |
wasKeyValueGet("motd table", configuration) + |
wasKeyValueGet("motd table", configuration) + |
"\" WHERE name=:group"), |
"data", wasURLEscape( |
wasListToCSV( |
@@ -546,7 +528,7 @@ |
"group", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
) |
@@ -553,25 +535,19 @@ |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "database") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[MOTD] Unable retrieve from database: " + |
llOwnerSay("[MOTD] Unable retrieve from database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -578,7 +554,7 @@ |
); |
state listen_group; |
} |
|
|
data = llDumpList2String( |
llDeleteSubList( |
wasCSVToList( |
@@ -591,15 +567,16 @@ |
), |
"" |
); |
|
|
if(data == "") { |
data = "Sorry, no MOTD is currently set."; |
state tell; |
} |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -606,8 +583,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -616,241 +593,62 @@ |
llSetTimerEvent(0); |
} |
} |
|
state fee { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Member joined, getting group membership fee..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "getgroupdata", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"data", "MembershipFee", |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getgroupdata") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[MOTD] Unable to get group data: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
state listen_group; |
} |
|
list membership = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet( |
"data", |
body |
) |
) |
); |
|
membershipFee = llList2Integer( |
membership, |
llListFindList( |
membership, |
[ "MembershipFee" ] |
) + 1 |
); |
|
if(membershipFee <= 0) { |
// DEBUG |
llOwnerSay("The configured group does not have a membership fee!"); |
state listen_group; |
} |
|
jump_state = "pay"; |
state trampoline; |
} |
timer() { |
state listen_group; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
state pay { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Paying back the entrance fee..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "pay", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
configuration |
) |
), |
"amount", membershipFee, |
"entity", "avatar", |
"firstname", wasURLEscape(firstname), |
"lastname", wasURLEscape(lastname), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "pay") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[MOTD] Unable to pay the entrance fee: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
state listen_group; |
} |
|
// DEBUG |
llOwnerSay("[MOTD] Paid back the entrance fee."); |
|
jump_state = "greet"; |
state trampoline; |
} |
timer() { |
state listen_group; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
|
state set { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Adding to database..."); |
llOwnerSay("[MOTD] Adding to database."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"SQL", wasURLEscape("REPLACE INTO \"" + |
wasKeyValueGet("motd table", configuration) + |
"\" (name, data) VALUES (:group, :message)"), |
wasKeyValueGet("motd table", configuration) + |
"\" (name, data) VALUES (:name, :data)"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
"group", |
"name", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"message", |
data |
"data", |
wasURLEscape(data) |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "database") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[MOTD] Unable modify database: " + |
llOwnerSay("[MOTD] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -861,6 +659,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -867,8 +666,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -877,7 +676,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state tell { |
state_entry() { |
// DEBUG |
@@ -884,21 +683,21 @@ |
llOwnerSay("[MOTD] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/softban.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that bans group members using fuzzy name matching. |
@@ -12,7 +12,7 @@ |
string wasKeyValueGet(string k, string data) { |
if(llStringLength(data) == 0) return ""; |
if(llStringLength(k) == 0) return ""; |
list a = llParseString2List(data, ["&", "="], []); |
list a = llParseStringKeepNulls(data, ["&", "="], []); |
integer i = llListFindList(llList2ListStrided(a, 0, -1, 2), [ k ]); |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
@@ -19,7 +19,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -162,7 +162,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasSetIntersect(list a, list b) { |
if(llGetListLength(a) == 0) return []; |
@@ -175,6 +175,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
// banee |
@@ -223,10 +225,7 @@ |
return; |
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
// Get the sent message. |
@@ -262,7 +261,32 @@ |
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get roles of callers. |
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Softban] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Softban] Got URL..."); |
state get_caller_roles; |
} |
on_rez(integer num) { |
@@ -303,23 +327,16 @@ |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Softban] Unable to get member roles: " + |
wasURLUnescape( |
@@ -326,6 +343,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -346,6 +364,7 @@ |
) |
) == 0) { |
data = "You ain't got the cojones!"; |
llReleaseURL(URL); |
state tell; |
} |
|
@@ -371,6 +390,7 @@ |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -414,23 +434,16 @@ |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
if(wasKeyValueGet("status", body) == "19862") { |
// DEBUG |
llOwnerSay("[Softban] User not in group, but proceeding anyway..."); |
@@ -442,6 +455,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -452,6 +466,7 @@ |
|
if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
data = "Ejectee is an owner. I'm not gunna open the pod bay doors."; |
llReleaseURL(URL); |
state tell; |
} |
|
@@ -458,6 +473,7 @@ |
state ban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -514,22 +530,15 @@ |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "softban") |
return; |
|
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "softban" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
@@ -546,6 +555,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/source/eggdrop/softunban.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that unbans group members using fuzzy name matching. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -162,7 +162,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasSetIntersect(list a, list b) { |
if(llGetListLength(a) == 0) return []; |
@@ -175,6 +175,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
// banee |
@@ -200,8 +202,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -220,48 +222,70 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "softunban") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
firstname = wasKeyValueGet("firstname", message); |
lastname = wasKeyValueGet("lastname", message); |
|
|
if(firstname == "" || lastname == "") { |
data = "And who would yarr be?"; |
state tell; |
} |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
// Get roles of caller. |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Softunban] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Softunban] Got URL..."); |
state get_caller_roles; |
} |
on_rez(integer num) { |
@@ -268,8 +292,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -282,52 +306,46 @@ |
llOwnerSay("[Softunban] Searching for caller..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmemberroles", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Softunban] Unable to get member roles: " + |
llOwnerSay("[Softunban] Unable to get member roles: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
|
// Dump the roles to a list. |
list roles = wasCSVToList( |
wasURLUnescape( |
@@ -334,9 +352,9 @@ |
wasKeyValueGet("data", body) |
) |
); |
|
|
if(llGetListLength( |
wasSetIntersect(roles, |
wasSetIntersect(roles, |
wasCSVToList( |
wasKeyValueGet( |
"admin roles", configuration |
@@ -345,24 +363,26 @@ |
) |
) == 0) { |
data = "You ain't got the cojones!"; |
llReleaseURL(URL); |
state tell; |
} |
|
|
list banee = llParseString2List(data, [" "], []); |
|
|
firstname = llList2String(banee, 0); |
lastname = llList2String(banee, 1); |
|
|
if(firstname == "" || lastname == "") { |
data = "Full name required."; |
state tell; |
} |
|
|
// GC |
banee = []; |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -369,8 +389,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -386,43 +406,36 @@ |
llOwnerSay("[Softunban] Searching for banee..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmemberroles", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
if(wasKeyValueGet("status", body) == "19862") { |
// DEBUG |
llOwnerSay("[Softunban] User not in group, but proceeding anyway..."); |
@@ -429,28 +442,31 @@ |
jump continue; |
} |
// DEBUG |
llOwnerSay("[Softunban] Unable to get member roles: " + |
llOwnerSay("[Softunban] Unable to get member roles: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
|
string result = wasURLUnescape( |
wasKeyValueGet("data", body) |
); |
|
|
if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
data = "Ejectee is an owner. I'm not gonna open the pod bay doors."; |
llReleaseURL(URL); |
state tell; |
} |
|
|
@continue; |
|
state unban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -457,8 +473,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -474,21 +490,21 @@ |
llOwnerSay("[Softunban] Unbanning..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "softban", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -500,25 +516,19 @@ |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "softban") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "softban" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Softunban] Unable to ban member: " + |
llOwnerSay("[Softunban] Unable to ban member: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -525,12 +535,13 @@ |
); |
state listen_group; |
} |
|
|
data = "They'll be bak!"; |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -537,8 +548,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -554,21 +565,21 @@ |
llOwnerSay("[Softunban] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -577,7 +588,7 @@ |
] |
) |
); |
|
|
state listen_group; |
} |
} |
/source/eggdrop/spank.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that spanks group members using fuzzy name matching. . . |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -185,8 +187,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -205,40 +207,62 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "spank") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
// Search for member. |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Spank] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Spank] Got URL..."); |
state search; |
} |
on_rez(integer num) { |
@@ -245,8 +269,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -259,21 +283,21 @@ |
llOwnerSay("[Spank] Searching for agent."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmembers", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -285,25 +309,19 @@ |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmembers") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "getmembers" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Spank] Unable to get members: " + |
llOwnerSay("[Spank] Unable to get members: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -310,7 +328,7 @@ |
); |
state listen_group; |
} |
|
|
// Dump the members to a list. |
list spankees = wasCSVToList( |
wasURLUnescape( |
@@ -317,25 +335,26 @@ |
wasKeyValueGet("data", body) |
) |
); |
|
|
// Limit to two people to spank. |
if(llGetListLength(spankees) > 2) { |
data = "So many people, so few hands!"; |
state tell; |
return; |
} |
|
|
data = llList2CSV(spankees); |
|
|
if(data == "") { |
data = "I could not find anyone to spank (story of my life)."; |
state tell; |
} |
|
|
data = "/me spanks " + data; |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -342,8 +361,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -359,21 +378,21 @@ |
llOwnerSay("[Spank] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/unban.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that unbans group members using fuzzy name matching. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -162,7 +162,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasSetIntersect(list a, list b) { |
if(llGetListLength(a) == 0) return []; |
@@ -175,6 +175,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
// banee |
@@ -201,8 +203,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -221,48 +223,70 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "unban") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
firstname = wasKeyValueGet("firstname", message); |
lastname = wasKeyValueGet("lastname", message); |
|
|
if(firstname == "" || lastname == "") { |
data = "And who would yarr be?"; |
state tell; |
} |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
// Get roles of caller. |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Unban] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Unban] Got URL..."); |
state get_caller_roles; |
} |
on_rez(integer num) { |
@@ -269,8 +293,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -283,52 +307,46 @@ |
llOwnerSay("[Unban] Searching for caller..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmemberroles", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Unban] Unable to get member roles: " + |
llOwnerSay("[Unban] Unable to get member roles: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
|
// Dump the roles to a list. |
list roles = wasCSVToList( |
wasURLUnescape( |
@@ -335,9 +353,9 @@ |
wasKeyValueGet("data", body) |
) |
); |
|
|
if(llGetListLength( |
wasSetIntersect(roles, |
wasSetIntersect(roles, |
wasCSVToList( |
wasKeyValueGet( |
"admin roles", configuration |
@@ -346,32 +364,34 @@ |
) |
) == 0) { |
data = "You ain't got the cojones!"; |
llReleaseURL(URL); |
state tell; |
} |
|
|
list banee = llParseString2List(data, [" "], []); |
|
|
firstname = llList2String(banee, 0); |
banee = llDeleteSubList(banee, 0, 0); |
lastname = llList2String(banee, 0); |
banee = llDeleteSubList(banee, 0, 0); |
|
|
if(firstname == "" || lastname == "") { |
data = "Full name required."; |
state tell; |
} |
|
if(llGetListLength(banee) != 0 && |
|
if(llGetListLength(banee) != 0 && |
llToLower(llList2String(banee, 0)) == "nosoft") { |
soft = "False"; |
banee = llDeleteSubList(banee, 0, 0); |
} |
|
|
// GC |
banee = []; |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -378,8 +398,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -395,43 +415,36 @@ |
llOwnerSay("[Unban] Searching for banee..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "getmemberroles", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"firstname", firstname, |
"lastname", lastname, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "getmemberroles") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
if(wasKeyValueGet("command", body) != "getmemberroles" || |
wasKeyValueGet("success", body) != "True") { |
if(wasKeyValueGet("status", body) == "19862") { |
// DEBUG |
llOwnerSay("[Unban] User not in group, but proceeding anyway..."); |
@@ -438,29 +451,31 @@ |
jump continue; |
} |
// DEBUG |
llOwnerSay("[Unban] Unable to get member roles: " + |
llOwnerSay("[Unban] Unable to get member roles: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
); |
|
llReleaseURL(URL); |
state listen_group; |
} |
|
|
string result = wasURLUnescape( |
wasKeyValueGet("data", body) |
); |
|
|
if(result != "" && llListFindList(wasCSVToList(result), (list)"Owners") != -1) { |
data = "Ejectee is an owner. I'm not gonna open the pod bay doors."; |
llReleaseURL(URL); |
state tell; |
} |
|
|
@continue; |
|
state unban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -467,8 +482,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -484,21 +499,21 @@ |
llOwnerSay("[Unban] Unbanning..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "ban", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -511,25 +526,19 @@ |
] |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "ban") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "ban" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Unban] Unable to ban member: " + |
llOwnerSay("[Unban] Unable to ban member: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -536,12 +545,13 @@ |
); |
state listen_group; |
} |
|
|
data = "They'll be bak!"; |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -548,8 +558,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -565,21 +575,21 @@ |
llOwnerSay("[Unban] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
@@ -588,10 +598,10 @@ |
] |
) |
); |
|
|
// reset variables. |
soft = "True"; |
|
|
state listen_group; |
} |
} |
/source/eggdrop/version.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that sends the current Corrade version to group chat. |
@@ -17,9 +17,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -117,18 +117,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -147,15 +147,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -162,7 +162,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasSetIntersect(list a, list b) { |
if(llGetListLength(a) == 0) return []; |
@@ -175,6 +175,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -197,8 +199,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -217,37 +219,59 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "version") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
// Get version. |
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Version] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Version] Got URL..."); |
state version; |
} |
on_rez(integer num) { |
@@ -254,8 +278,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -268,43 +292,37 @@ |
llOwnerSay("[Version] Getting version..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "version", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
) |
); |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "version") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "version" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Version] Unable to get version: " + |
llOwnerSay("[Version] Unable to get version: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -311,12 +329,13 @@ |
); |
state listen_group; |
} |
|
|
data = "I'm a " + wasKeyValueGet("data", body); |
|
|
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -323,8 +342,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -340,21 +359,21 @@ |
llOwnerSay("[Version] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
/source/eggdrop/wiki.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A wiki module that can memorize strings and recall them by path. |
@@ -7,11 +7,11 @@ |
/////////////////////////////////////////////////////////////////////////// |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
// Copyright (C) Wizardry and Steamworks 2014 - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
integer wasIsAlNum(string a) { |
if(a == "") return FALSE; |
integer x = llBase64ToInteger("AAAA" + |
integer x = llBase64ToInteger("AAAA" + |
llStringToBase64(llGetSubString(a, 0, 0))); |
return (x >= 65 && x <= 90) || (x >= 97 && x <= 122) || |
(x >= 48 && x <= 57); |
@@ -28,9 +28,9 @@ |
if(i != -1) return llList2String(a, 2*i+1); |
return ""; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -45,7 +45,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -69,7 +69,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -108,7 +108,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -116,18 +116,18 @@ |
string a = llDumpList2String( |
llParseStringKeepNulls( |
llList2String( |
l, |
l, |
0 |
), |
["\""], |
), |
["\""], |
[] |
), |
"\"\"" |
); |
if(llParseStringKeepNulls( |
a, |
a, |
[" ", ",", "\n", "\""], [] |
) != |
) != |
(list) a |
) a = "\"" + a + "\""; |
v += a; |
@@ -137,7 +137,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -146,15 +146,15 @@ |
llParseString2List( |
llDumpList2String( |
llParseString2List( |
i, |
["+"], |
i, |
["+"], |
[] |
), |
), |
" " |
), |
["%0D%0A"], |
), |
["%0D%0A"], |
[] |
), |
), |
"\n" |
) |
); |
@@ -162,6 +162,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string path = ""; |
string data = ""; |
@@ -179,7 +181,7 @@ |
llOwnerSay("[Wiki] Got configuration..."); |
configuration = message; |
action = "create"; |
state trampoline; |
state url; |
} |
timer() { |
llOwnerSay("[Wiki] Requesting configuration..."); |
@@ -189,8 +191,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -200,18 +202,28 @@ |
} |
} |
|
state trampoline { |
state url { |
state_entry() { |
// DEBUG |
llOwnerSay("[Wiki] Requesting URL..."); |
llRequestURL(); |
} |
http_request(key id, string method, string body) { |
if(method != URL_REQUEST_GRANTED) return; |
URL = body; |
// DEBUG |
llOwnerSay("[Wiki] Got URL."); |
|
if(action == "create") { |
statement = wasURLEscape("CREATE TABLE IF NOT EXISTS \"" + |
wasKeyValueGet("wiki table", configuration) + |
statement = wasURLEscape("CREATE TABLE IF NOT EXISTS \"" + |
wasKeyValueGet("wiki table", configuration) + |
"\" (path text unique collate nocase, data text)"); |
state query; |
} |
|
|
if(action == "get") { |
statement = wasURLEscape("SELECT data FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
wasKeyValueGet("wiki table", configuration) + |
"\" WHERE path=:path"); |
parameters = wasURLEscape( |
wasListToCSV( |
@@ -223,11 +235,11 @@ |
); |
state query; |
} |
|
|
if(action == "set") { |
if(data == "") { |
statement = wasURLEscape("DELETE FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
statement = wasURLEscape("DELETE FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"\" WHERE path=:path"); |
parameters = wasURLEscape( |
wasListToCSV( |
@@ -240,7 +252,7 @@ |
state query; |
} |
statement = wasURLEscape("REPLACE INTO \"" + |
wasKeyValueGet("wiki table", configuration) + |
wasKeyValueGet("wiki table", configuration) + |
"\" (path, data) VALUES (:path, :data)"); |
parameters = wasURLEscape( |
wasListToCSV( |
@@ -254,13 +266,13 @@ |
); |
state query; |
} |
|
|
if(action == "dir") { |
if(path == "/") { |
path = ""; |
statement = wasURLEscape( |
"SELECT DISTINCT SUBSTR(path, 1, LENGTH(path) - LENGTH(LTRIM(SUBSTR(path,2), 'abcdefghijklmnopqrstuvwxyz'))) AS path FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"SELECT DISTINCT SUBSTR(path, 1, LENGTH(path) - LENGTH(LTRIM(SUBSTR(path,2), 'abcdefghijklmnopqrstuvwxyz'))) AS path FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"\" WHERE path LIKE '/%' LIMIT " + |
wasKeyValueGet("wiki results limit", configuration) |
); |
@@ -267,8 +279,8 @@ |
state query; |
} |
statement = wasURLEscape( |
"SELECT DISTINCT SUBSTR(REPLACE(path, :base, ''),1, LENGTH(REPLACE(path, :base, '')) - LENGTH(LTRIM(REPLACE(path, :base, ''), 'abcdefghijklmnopqrstuvwxyz'))) AS path FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"SELECT DISTINCT SUBSTR(REPLACE(path, :base, ''),1, LENGTH(REPLACE(path, :base, '')) - LENGTH(LTRIM(REPLACE(path, :base, ''), 'abcdefghijklmnopqrstuvwxyz'))) AS path FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"\" WHERE path LIKE :path LIMIT " + |
wasKeyValueGet("wiki results limit", configuration) |
); |
@@ -278,7 +290,7 @@ |
"path", |
wasURLEscape(path + "/" + "%"), |
"base", |
wasURLEscape("/" + |
wasURLEscape("/" + |
llDumpList2String( |
llParseString2List( |
path, |
@@ -286,7 +298,7 @@ |
[] |
), |
"/" |
) + |
) + |
"/" |
) |
] |
@@ -294,7 +306,7 @@ |
); |
state query; |
} |
|
|
if(action == "find") { |
if(data == "") { |
data = "Command requires two parameters: a path followed by a search term."; |
@@ -301,10 +313,10 @@ |
state tell; |
} |
if(path == "/") |
path = ""; |
path = ""; |
statement = wasURLEscape( |
"SELECT DISTINCT path FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"SELECT DISTINCT path FROM \"" + |
wasKeyValueGet("wiki table", configuration) + |
"\" WHERE path LIKE :path AND ( data LIKE :data OR path LIKE :data ) COLLATE NOCASE LIMIT " + |
wasKeyValueGet("wiki search limit", configuration) |
); |
@@ -320,7 +332,7 @@ |
); |
state query; |
} |
|
|
// DEBUG |
llOwnerSay("[Wiki] Jump table corrupted, please contact creator..."); |
llResetScript(); |
@@ -329,8 +341,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -346,38 +358,35 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
"message", |
"message", |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "wiki") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Check for supported sub-commands. |
if(llList2String(command, 0) != "set" && |
if(llList2String(command, 0) != "set" && |
llList2String(command, 0) != "get" && |
llList2String(command, 0) != "dir" && |
llList2String(command, 0) != "find") { |
@@ -384,27 +393,27 @@ |
data = "Subcommands are: get, set, dir or find"; |
state tell; |
} |
|
|
// Get the sub-command and store it as a jump state. |
action = llList2String(command, 0); |
|
|
// Remove sub-command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Get the path parts. |
list path_parts = llParseString2List( |
llList2String(command, 0), ["/"], [] |
); |
|
|
// Dump the path and store it over states. |
path = llStringTrim( |
llDumpList2String( |
path_parts, |
path_parts, |
"/" |
), |
), |
STRING_TRIM |
); |
|
|
if(path != "") { |
integer i = llStringLength(path) - 1; |
do { |
@@ -415,23 +424,24 @@ |
} |
} while(--i > -1); |
} |
|
|
path = "/" + path; |
|
|
// Remove path. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
state trampoline; |
|
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -446,44 +456,35 @@ |
"command", "database", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |
"SQL", statement, |
"data", parameters, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
"callback", wasURLEscape(URL) |
] |
); |
|
// GC - none of these are needed anymore. |
statement = ""; |
parameters = ""; |
|
// Message length check. |
if(llStringLength(message) > 1023) { |
data = "Message length exceeded 1023 characters."; |
state tell; |
} |
|
// DEBUG |
llOwnerSay("[Wiki] Executing action: " + action); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
message |
); |
// GC |
@@ -490,14 +491,13 @@ |
message = ""; |
llSetTimerEvent(60); |
} |
link_message(integer sender, integer num, string body, key id) { |
// Only process callbacks for the database command. |
if(id != "callback" || wasKeyValueGet("command", body) != "database") |
return; |
|
if(wasKeyValueGet("success", body) != "True") { |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "database" || |
wasKeyValueGet("success", body) != "True") { |
// DEBUG |
llOwnerSay("[Wiki] Unable query database: " + |
llOwnerSay("[Wiki] Unable query database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) |
@@ -504,8 +504,9 @@ |
); |
state listen_group; |
} |
|
|
// Process actions. |
|
if(action == "set") { |
if(data == "") { |
data = "Deleted from " + path; |
@@ -553,16 +554,16 @@ |
), |
"" |
); |
|
|
if(data == "") { |
data = "Sorry, that path contains no data."; |
state tell; |
} |
|
|
data = path + ": " + data; |
state tell; |
} |
|
|
if(action == "dir") { |
list paths = llList2ListStrided( |
llDeleteSubList( |
@@ -578,35 +579,35 @@ |
-1, |
2 |
); |
|
|
if(llGetListLength(paths) == 0) { |
data = "Sorry, that path contains no sub-paths."; |
state tell; |
} |
|
|
// Eliminate path component. |
if(path == "/") |
path = ""; |
|
|
list sibling = []; |
do { |
// Get the path part. |
string part = llList2String(paths, 0); |
|
|
// Remove the path component. |
string child = llStringTrim( |
llDumpList2String( |
llParseString2List( |
part, |
[path, "/"], |
[path, "/"], |
[] |
), |
"/" |
), |
STRING_TRIM |
|
|
); |
|
|
integer i = llSubStringIndex(child, "/"); |
if(i == -1) { |
sibling += path + "/" + child; |
@@ -618,23 +619,24 @@ |
@continue_dir; |
paths = llDeleteSubList(paths, 0, 0); |
} while(llGetListLength(paths) != 0); |
|
|
data = llList2CSV(sibling); |
// GC |
sibling = []; |
|
|
state tell; |
} |
|
|
// Don't announce creating table. |
if(action == "create") |
state listen_group; |
|
|
// DEBUG |
llOwnerSay("[Wiki] Jump table corrupted, please contact creator..."); |
state listen_group; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -641,8 +643,8 @@ |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
@@ -658,21 +660,21 @@ |
llOwnerSay("[Wiki] Sending to group."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
"corrade", |
configuration |
), |
), |
wasKeyValueEncode( |
[ |
"command", "tell", |
"group", wasURLEscape( |
wasKeyValueGet( |
"group", |
"group", |
configuration |
) |
), |
"password", wasURLEscape( |
wasKeyValueGet( |
"password", |
"password", |
configuration |
) |
), |