refactor(nuserver): finish updating and porting pkgserver
NuServer has been fixed up and ported Signed-off-by: zontreck <tarapiccari@gmail.com>
This commit is contained in:
parent
4dc3939eb4
commit
d26025457c
2 changed files with 28 additions and 11 deletions
12
src/preproc/Updater/NuServer [AC].lsl
Normal file
12
src/preproc/Updater/NuServer [AC].lsl
Normal file
|
@ -0,0 +1,12 @@
|
|||
/\*
|
||||
|
||||
This file is a part of NuSystem (https://git.zontreck.com/AriasCreations/NuSystem)
|
||||
|
||||
NuSystem is licensed under the GPL.
|
||||
Please see the Git Source Tree for structured information on changes to indivudual files
|
||||
|
||||
Initial Author: Aria (aria@zontreck.com)
|
||||
|
||||
\*/
|
||||
|
||||
#include "../raw/pkg_server/server.lsl"
|
|
@ -1,4 +1,9 @@
|
|||
#include "includes/common.lsl"
|
||||
#include "Variables.lsl"
|
||||
#include "Functions.lsl"
|
||||
#include "Version.lsl"
|
||||
#include "../external/AriasCreations/Common.lsl"
|
||||
#include "../external/AriasCreations/Helpers.lsl"
|
||||
|
||||
|
||||
#define MSGS_0 "Server startup in progress... reading manifest"
|
||||
#define MSGS_1 "Server startup completed with "
|
||||
|
@ -23,10 +28,10 @@ default
|
|||
listen(integer c,string n,key i,string m)
|
||||
{
|
||||
llWhisper(0, m);
|
||||
if(llJsonGetValue(m, ["operation"]) == "check_package_servers")
|
||||
if(llJsonGetValue(m, ["op"]) == "check_package_servers")
|
||||
{
|
||||
llRegionSayTo(i,c,Build("package_server_reply", ["server", g_sServerName]));
|
||||
}else if(llJsonGetValue(m,["operation"]) == "connect")
|
||||
llRegionSayTo(i,c,BuildPacket("package_server_reply", ["server", g_sServerName]));
|
||||
}else if(llJsonGetValue(m,["op"]) == "connect")
|
||||
{
|
||||
// This is always going to be successful in reality, so what we do is we send back all package names
|
||||
// Anything beyond that is package specific
|
||||
|
@ -36,17 +41,17 @@ default
|
|||
list lNames= StrideOfList(lPackages, 2,0,-1);
|
||||
lPackages=[];// Mark for GC
|
||||
|
||||
llRegionSayTo(i,c,Build("package_list", ["packages", llList2Json(JSON_ARRAY, lNames)]));
|
||||
} else if(llJsonGetValue(m,["operation"]) == "check_package")
|
||||
llRegionSayTo(i,c,BuildPacket("package_list", ["packages", llList2Json(JSON_ARRAY, lNames)]));
|
||||
} else if(llJsonGetValue(m,["op"]) == "check_package")
|
||||
{
|
||||
string sPackage = llJsonGetValue(m,["pkg"]);
|
||||
|
||||
list lPkgDef = llJson2List(llJsonGetValue(g_sPackages,[sPackage]));
|
||||
lPkgDef=StrideOfList(lPkgDef,2,0,-1);
|
||||
|
||||
llRegionSayTo(i,c,Build("package_versions", [sPackage, llList2Json(JSON_ARRAY, lPkgDef)])); // Send all versions
|
||||
llRegionSayTo(i,c,BuildPacket("package_versions", [sPackage, llList2Json(JSON_ARRAY, lPkgDef)])); // Send all versions
|
||||
|
||||
} else if(llJsonGetValue(m,["operation"]) == "check_version")
|
||||
} else if(llJsonGetValue(m,["op"]) == "check_version")
|
||||
{
|
||||
string sPackage = llJsonGetValue(m,["pkg"]);
|
||||
string sVer = llJsonGetValue(m,["ver"]);
|
||||
|
@ -72,8 +77,8 @@ default
|
|||
if(iRes <= 0)iCompat=1;
|
||||
else iCompat=0;
|
||||
|
||||
llRegionSayTo(i,c,Build("version_back", ["same", iSame, "newer", iNewer, "compatible", iCompat]));
|
||||
} else if(llJsonGetValue(m,["operation"]) == "send")
|
||||
llRegionSayTo(i,c,BuildPacket("version_back", ["same", iSame, "newer", iNewer, "compatible", iCompat]));
|
||||
} else if(llJsonGetValue(m,["op"]) == "send")
|
||||
{
|
||||
string sPackage = llJsonGetValue(m,["pkg"]);
|
||||
string sRequest = llJsonGetValue(m,["ver"]);
|
||||
|
@ -83,7 +88,7 @@ default
|
|||
|
||||
llGiveInventory(llJsonGetValue(m,["dest"]), sItem);
|
||||
|
||||
llRegionSayTo(i,c,Build("send_back", ["item", sItem]));
|
||||
llRegionSayTo(i,c,BuildPacket("send_back", ["item", sItem]));
|
||||
}
|
||||
}
|
||||
dataserver( key queryid, string data )
|
||||
|
|
Loading…
Reference in a new issue