/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. |
@@ -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 caller. |
// 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("[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) { |
@@ -303,23 +327,14 @@ |
), |
"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 |
@@ -328,6 +343,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -348,6 +364,7 @@ |
) |
) == 0) { |
data = "You ain't got the cojones!"; |
llReleaseURL(URL); |
state tell; |
} |
|
@@ -374,6 +391,7 @@ |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -417,23 +435,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("[Ban] User not in group, but proceeding anyway..."); |
@@ -445,6 +456,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -455,6 +467,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; |
} |
|
@@ -461,6 +474,7 @@ |
state ban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -512,22 +526,15 @@ |
) |
), |
"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 |
@@ -544,6 +551,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/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. |
@@ -19,50 +19,8 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// 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) { |
@@ -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 = []; |
@@ -152,45 +110,6 @@ |
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; |
|
@@ -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( |
@@ -476,7 +394,7 @@ |
); |
llResetScript(); |
} |
state version_check; |
state serve_configuration; |
} |
timer() { |
llOwnerSay("[Control] Timeout binding notifications"); |
@@ -497,7 +415,7 @@ |
} |
} |
|
state version_check { |
state serve_configuration { |
state_entry() { |
// DEBUG |
llOwnerSay("[Control] Checking version..."); |
@@ -530,6 +448,10 @@ |
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..."); |
@@ -563,110 +485,23 @@ |
" 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; |
} |
timer() { |
llOwnerSay("[Control] Timeout checking version..."); |
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); |
} |
} |
|
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"); |
//llReleaseURL(URL); |
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"); |
} |
timer() { |
llOwnerSay("[Control] Timeout checking version..."); |
llResetScript(); |
} |
on_rez(integer num) { |
llResetScript(); |
} |
/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. |
@@ -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) { |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -207,10 +209,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. |
/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. |
@@ -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) { |
@@ -326,6 +326,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -375,10 +377,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. |
/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. |
@@ -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) { |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -207,10 +209,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; |
|
string firstname = wasURLUnescape( |
/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. |
@@ -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) { |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
string firstname = ""; |
@@ -209,10 +211,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. |
@@ -240,7 +239,32 @@ |
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Search for agent. |
// 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("[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) { |
@@ -289,23 +313,16 @@ |
] |
) |
),*/ |
"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: " + |
wasURLUnescape( |
@@ -312,6 +329,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -344,6 +362,7 @@ |
) |
) != llToUpper(lastname)) { |
data = "Agent not found."; |
llReleaseURL(URL); |
state tell; |
} |
|
@@ -350,6 +369,7 @@ |
state invite; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -395,23 +415,17 @@ |
"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: " + |
wasURLUnescape( |
@@ -426,6 +440,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/source/eggdrop/joke-database.lsl |
@@ -163,16 +163,16 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string firstname = ""; |
string lastname = ""; |
string group = ""; |
string data = ""; |
string action = ""; |
string jump_state = ""; |
integer joke_counter = 0; |
|
string statement = ""; |
string parameters = ""; |
|
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..."); |
@@ -204,161 +204,102 @@ |
} |
} |
|
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; |
// 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; |
|
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; |
// DEBUG |
llOwnerSay("[Joke] Jump table corrupted, please contact creator..."); |
llResetScript(); |
} |
on_rez(integer num) { |
llResetScript(); |
} |
changed(integer change) { |
if((change & CHANGED_INVENTORY) || |
(change & CHANGED_REGION_START) || |
(change & CHANGED_OWNER)) { |
llResetScript(); |
} |
} |
} |
|
if(action == "id") { |
statement = wasURLEscape("SELECT * FROM \"" + |
wasKeyValueGet("joke table", configuration) + |
"\" WHERE name=:group AND id=:id"); |
parameters = wasURLEscape( |
wasListToCSV( |
[ |
"group", |
wasURLEscape( |
state create_database { |
state_entry() { |
// DEBUG |
llOwnerSay("[Joke] Creating database: " + wasKeyValueGet("joke table", configuration)); |
llInstantMessage( |
wasKeyValueGet( |
"group", |
"corrade", |
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( |
wasKeyValueEncode( |
[ |
"group", |
wasURLEscape( |
"command", "database", |
"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( |
"password", wasURLEscape( |
wasKeyValueGet( |
"group", |
"password", |
configuration |
) |
), |
"id", |
data |
"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) |
] |
) |
); |
state query; |
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) |
) |
|
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; |
llResetScript(); |
} |
|
if(action == "get_joke_id") { |
statement = wasURLEscape("SELECT MAX(id) AS LAST FROM \"" + |
wasKeyValueGet("joke table", configuration) + "\""); |
state query; |
llOwnerSay("[Joke] Database created!"); |
jump_state = "count_jokes"; |
state url; |
} |
|
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] Jump table corrupted, please contact creator..."); |
timer() { |
llResetScript(); |
} |
on_rez(integer num) { |
@@ -371,12 +312,21 @@ |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
state query { |
state count_jokes { |
state_entry() { |
// Check messge length. |
string message = wasKeyValueEncode( |
// DEBUG |
llOwnerSay("[Joke] Counting jokes in database: " + wasKeyValueGet("joke table", configuration)); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
wasKeyValueEncode( |
[ |
"command", "database", |
"group", wasURLEscape( |
@@ -391,110 +341,33 @@ |
configuration |
) |
), |
"SQL", statement, |
"data", parameters, |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
"SQL", wasURLEscape("SELECT COUNT(*) AS count FROM \"" + |
wasKeyValueGet("joke table", 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("[Joke] Executing action: " + action); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
configuration |
), |
message |
); |
// 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; |
} |
|
if(action == "add") { |
action = "get_joke_id"; |
data = body; |
state trampoline; |
} |
|
if(action == "get_joke_id") { |
list result = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet("data", body) |
@@ -501,21 +374,16 @@ |
) |
); |
|
data = llList2String( |
joke_counter = llList2Integer( |
result, |
llListFindList(result, ["LAST"]) + 1 |
); |
llListFindList(result, ["count"]) + 1 |
) + 1; |
|
data = "Joke " + data + " has been stored."; |
state tell; |
} |
|
// DEBUG |
llOwnerSay("[Joke] Jump table corrupted, please contact creator..."); |
llOwnerSay("[Joke] There are " + (string)joke_counter + " jokes in the database."); |
state listen_group; |
} |
timer() { |
state listen_group; |
llResetScript(); |
} |
on_rez(integer num) { |
llResetScript(); |
@@ -587,7 +455,7 @@ |
command = llDeleteSubList(command, 0, 0); |
|
// Remove action. |
action = llList2String(command, 0); |
string action = llList2String(command, 0); |
// Jump to the "add" state for adding |
if(action == "add") { |
command = llDeleteSubList(command, 0, 0); |
@@ -596,8 +464,8 @@ |
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 |
@@ -608,47 +476,354 @@ |
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((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(llStringLength(firstname) == 0 || |
llStringLength(lastname) == 0) { |
data = "First and Last name is required."; |
state tell; |
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; |
} |
|
action = "by"; |
state trampoline; |
list result = wasCSVToList( |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
); |
|
if(llGetListLength(result) != 10) { |
data = "No joke found. . ."; |
state tell; |
} |
|
string index = llList2String(command, 0); |
command = llDeleteSubList(command, 0, 0); |
data = llList2String( |
result, |
llListFindList(result, ["data"]) + 1 |
); |
|
data = llDumpList2String(command, " "); |
string firstname = llList2String( |
result, |
llListFindList(result, ["firstname"]) + 1 |
); |
|
if(index == "search") { |
action = "search"; |
state trampoline; |
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); |
} |
} |
|
if((integer)index <= 0) { |
action = "random"; |
state trampoline; |
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(); |
} |
@@ -659,7 +834,10 @@ |
llResetScript(); |
} |
} |
state_exit() { |
llSetTimerEvent(0); |
} |
} |
|
state tell { |
state_entry() { |
/source/eggdrop/motd.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 MOTD module for Corrade Eggdrop. |
@@ -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) { |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string firstname = ""; |
string lastname = ""; |
@@ -169,7 +171,6 @@ |
string group = ""; |
string data = ""; |
string jump_state = ""; |
integer membershipFee; |
|
default { |
state_entry() { |
@@ -181,7 +182,7 @@ |
llOwnerSay("[MOTD] Got configuration..."); |
configuration = message; |
jump_state = "create_database"; |
state trampoline; |
state url; |
} |
timer() { |
llOwnerSay("[MOTD] Requesting configuration..."); |
@@ -202,8 +203,17 @@ |
} |
} |
|
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,10 +222,6 @@ |
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; |
|
@@ -262,23 +268,17 @@ |
"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: " + |
wasURLUnescape( |
@@ -296,6 +296,7 @@ |
state listen_group; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -332,14 +333,6 @@ |
) |
); |
|
// 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,15 +348,13 @@ |
message |
) |
); |
|
if(wasKeyValueGet("pay back", configuration) != "true") { |
jump_state = "greet"; |
state trampoline; |
state url; |
} |
|
jump_state = "fee"; |
state trampoline; |
} |
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
// Get the sent message. |
data = wasURLUnescape( |
@@ -390,18 +381,14 @@ |
// 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(); |
@@ -418,7 +405,7 @@ |
state greet { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Retrieving MOTD..."); |
llOwnerSay("[MOTD] Member joined, retrieving MOTD..."); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
@@ -450,23 +437,17 @@ |
] |
) |
), |
"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: " + |
wasURLUnescape( |
@@ -496,6 +477,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -553,23 +535,17 @@ |
] |
) |
), |
"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: " + |
wasURLUnescape( |
@@ -600,6 +576,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -617,183 +594,10 @@ |
} |
} |
|
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", |
@@ -816,11 +620,11 @@ |
), |
"SQL", wasURLEscape("REPLACE INTO \"" + |
wasKeyValueGet("motd table", configuration) + |
"\" (name, data) VALUES (:group, :message)"), |
"\" (name, data) VALUES (:name, :data)"), |
"data", wasURLEscape( |
wasListToCSV( |
[ |
"group", |
"name", |
wasURLEscape( |
wasKeyValueGet( |
"group", |
@@ -827,28 +631,22 @@ |
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: " + |
wasURLUnescape( |
@@ -861,6 +659,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/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. |
@@ -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 |
@@ -222,10 +224,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. |
@@ -261,7 +260,32 @@ |
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Get roles of caller. |
// 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("[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) { |
@@ -302,23 +326,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("[Softunban] Unable to get member roles: " + |
wasURLUnescape( |
@@ -325,6 +342,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -345,6 +363,7 @@ |
) |
) == 0) { |
data = "You ain't got the cojones!"; |
llReleaseURL(URL); |
state tell; |
} |
|
@@ -363,6 +382,7 @@ |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -406,23 +426,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("[Softunban] User not in group, but proceeding anyway..."); |
@@ -434,6 +447,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -443,6 +457,7 @@ |
|
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; |
} |
|
@@ -451,6 +466,7 @@ |
state unban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -500,23 +516,17 @@ |
] |
) |
), |
"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: " + |
wasURLUnescape( |
@@ -531,6 +541,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/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. . . |
@@ -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) { |
@@ -163,6 +163,8 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -207,10 +209,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. |
@@ -238,7 +237,32 @@ |
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
// Search for member. |
// 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("[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) { |
@@ -285,23 +309,17 @@ |
] |
) |
), |
"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: " + |
wasURLUnescape( |
@@ -321,7 +339,7 @@ |
// Limit to two people to spank. |
if(llGetListLength(spankees) > 2) { |
data = "So many people, so few hands!"; |
state tell; |
return; |
} |
|
data = llList2CSV(spankees); |
@@ -336,6 +354,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/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. |
@@ -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 caller. |
// 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("[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) { |
@@ -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("[Unban] 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; |
} |
|
@@ -372,6 +391,7 @@ |
state get_banee_roles; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -415,23 +435,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("[Unban] User not in group, but proceeding anyway..."); |
@@ -443,7 +456,7 @@ |
wasKeyValueGet("error", body) |
) |
); |
|
llReleaseURL(URL); |
state listen_group; |
} |
|
@@ -453,6 +466,7 @@ |
|
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; |
} |
|
@@ -461,6 +475,7 @@ |
state unban; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
@@ -511,23 +526,17 @@ |
] |
) |
), |
"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: " + |
wasURLUnescape( |
@@ -542,6 +551,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/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. |
@@ -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 = ""; |
|
@@ -219,10 +221,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. |
@@ -247,7 +246,32 @@ |
// 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) { |
@@ -286,23 +310,17 @@ |
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: " + |
wasURLUnescape( |
@@ -317,6 +335,7 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |
/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,7 +7,7 @@ |
/////////////////////////////////////////////////////////////////////////// |
|
/////////////////////////////////////////////////////////////////////////// |
// 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; |
@@ -30,7 +30,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); |
@@ -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 = []; |
@@ -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) { |
@@ -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..."); |
@@ -200,8 +202,18 @@ |
} |
} |
|
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) + |
@@ -348,10 +360,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. |
@@ -424,7 +433,8 @@ |
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
state trampoline; |
// Get an URL. |
state url; |
} |
on_rez(integer num) { |
llResetScript(); |
@@ -458,25 +468,16 @@ |
), |
"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( |
@@ -490,12 +491,11 @@ |
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: " + |
wasURLUnescape( |
@@ -506,6 +506,7 @@ |
} |
|
// Process actions. |
|
if(action == "set") { |
if(data == "") { |
data = "Deleted from " + path; |
@@ -635,6 +636,7 @@ |
state listen_group; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |