/source/eggdrop/version.lsl |
@@ -1,5 +1,5 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 // |
// Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
// |
// A module that sends the current Corrade version to group chat. |
@@ -19,7 +19,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
string wasKeyValueEncode(list data) { |
list k = llList2ListStrided(data, 0, -1, 2); |
@@ -34,7 +34,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
// http://was.fm/secondlife/wanderer |
vector wasCirclePoint(float radius) { |
@@ -46,7 +46,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
// escapes a string in conformance with RFC1738 |
string wasURLEscape(string i) { |
@@ -70,7 +70,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
list wasCSVToList(string csv) { |
list l = []; |
@@ -109,7 +109,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
string wasListToCSV(list l) { |
list v = []; |
@@ -138,7 +138,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
// unescapes a string in conformance with RFC1738 |
string wasURLUnescape(string i) { |
@@ -162,7 +162,7 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: CC BY 2.0 // |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
list wasSetIntersect(list a, list b) { |
if(llGetListLength(a) == 0) return []; |
@@ -175,8 +175,6 @@ |
|
// configuration data |
string configuration = ""; |
// callback URL |
string URL = ""; |
// store message over state. |
string data = ""; |
|
@@ -221,7 +219,10 @@ |
return; |
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group") |
if(wasKeyValueGet("type", message) != "group" || |
(wasKeyValueGet("type", message) == "group" && |
wasURLUnescape(wasKeyValueGet("group", message)) != |
wasKeyValueGet("group", configuration))) |
return; |
|
// Get the sent message. |
@@ -246,32 +247,7 @@ |
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
// 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..."); |
// Get version. |
state version; |
} |
on_rez(integer num) { |
@@ -310,17 +286,23 @@ |
configuration |
) |
), |
"callback", wasURLEscape(URL) |
"callback", wasURLEscape( |
wasKeyValueGet( |
"URL", |
configuration |
) |
) |
] |
) |
); |
llSetTimerEvent(60); |
} |
http_request(key id, string method, string body) { |
llHTTPResponse(id, 200, "OK"); |
llReleaseURL(URL); |
if(wasKeyValueGet("command", body) != "version" || |
wasKeyValueGet("success", body) != "True") { |
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") { |
// DEBUG |
llOwnerSay("[Version] Unable to get version: " + |
wasURLUnescape( |
@@ -335,7 +317,6 @@ |
state tell; |
} |
timer() { |
llReleaseURL(URL); |
state listen_group; |
} |
on_rez(integer num) { |