Adds another helper function

This commit is contained in:
zontreck 2025-02-22 21:10:17 -07:00
parent 69db9248c3
commit a56a54b88d

View file

@ -9,6 +9,10 @@ string DecipherService(string payload, string ident)
return llJsonGetValue(payload, [ident,"protocol"]) + "://" + llJsonGetValue(payload,[ident,"host"]) + ":" + llJsonGetValue(payload,[ident,"port"]);
}
ReadAPIServer(string payload) {
API_SERVER = DecipherService(payload, "api" ) + "/zni";
}
initBasicSupport()
{
g_lSupport = [RED_QUEEN, R_ADMIN|R_DEVELOPER|R_SUPPORT,
@ -32,7 +36,12 @@ integer checkSupportUser(key kID, integer minAccessRights)
checkSupport()
{
UpdateDSRequest(NULL, llHTTPRequest(API_SERVER + "/zni/Get_Support.php", [], ""), SetDSMeta(["get_support"]));
UpdateDSRequest(NULL, llHTTPRequest(API_SERVER + "/Get_Support.php", [], ""), SetDSMeta(["get_support"]));
}
parseSupport(string sValue) {
list lParse = llParseString2List(sValue, [";;", ";"], []);
g_lSupport = llParseString2List(llList2String(lParse,1), ["~"], []);
}
string MakeTimeNotation(integer iSec)
@ -401,3 +410,24 @@ integer mask(integer states, integer source, integer mask)
return source;
}
}
string stripMetatags(string sInput)
{
list lTmp = llParseString2List(sInput,[], ["<",">"]);
integer iIndex = llListFindList(lTmp,[">"]);
while(iIndex!=-1){
lTmp = llDeleteSubList(lTmp, iIndex-2, iIndex);
iIndex=llListFindList(lTmp,[">"]);
}
return llDumpList2String(lTmp, "");
}
integer timeAsSeconds(string sInput)
{
// Converts a string like 02:00 into its seconds equivalent (ie. 120)
list lTmp = llParseString2List(stripMetatags(sInput), [":"],[]);
integer iMin = (integer)llList2String(lTmp,0);
integer iSec = (integer)llList2String(lTmp,1);
return (iSec+(iMin*60));
}