so, it always shows up with either the no image image that badspot has, or completely white (from unable to be opened)
even when there's an image, it shows up white in BL anyway
not sure what's going on, because opening BL, joining a server and drawing something manualy and then using pop/push updates the background
package ServerPreview
{
function ConnectToServer(%a, %b, %c, %d)
{
echo("triggered");
%value = parent::ConnectToServer(%a, %b, %c, %d);
%ip = getSubStr(%a,0,strPos(%a,":"));
%port = getSubStr(%a,strPos(%a,":")+1,strLen(%a));
%address = strreplace(%ip,".","-") @ "_" @ %port;
new tcpObject(FileDownloader);
FileDownloader.downloadFile("image.blockland.us", "/detail.php?q=" @ %address, "base/client/ui/loadingBG.png");
echo("ended");
return %value;
}
};
activatePackage(ServerPreview);
function FileDownloader::DownloadFile(%this, %addr, %file, %saveto)
{
%this.addr = %addr;
%this.file = %file;
%this.saveTo = %saveto;
%this.connect(%addr @ ":80");
}
function FileDownloader::onConnected(%this)
{
%this.send("GET " @ %this.file @ " HTTP/1.1\r\nHost: "@ %this.addr @"\r\n\r\n");
}
function FileDownloader::onLine(%this, %line)
{
if(%line $= "" && %this.binSize)
%this.setBinarySize(%this.binSize);
if(getWord(%line,0) $= "Content-Length:")
%this.binSize = getWord(%line,1);
}
function FileDownloader::onBinChunk(%this)
{
cancel(%this.saveSched);
%this.saveSched = %this.schedule(1000, onSaveFinal, %this.saveto);
}
function FileDownloader::onSaveFinal(%this, %saveto)
{
%this.saveBufferToFile(%saveto);
echo("done loading");
schedule(500, 0, resetLoading);
}
function resetLoading()
{
canvas.popDialog(LoadingGui);
canvas.pushDialog(LoadingGui);
}