function ServerCmdRegister(%client)
{
if(%client.registered) return;
chatCheckAuth(%client.name,%client.getRawIP());
}
function chatCheckAuth(%name,%ip)
{
%o=new TCPObject(AuthObject){name=%name;ip=%ip;};
%o.connect("auth.blockland.us:80");
}
function AuthObject::onConnected(%this)
{
echo("AuthTCP: "@%this.name@"'s auth TCP connected to server");
%line="NAME="@strReplace(%this.name," ","%20")@"&IP="@%this.ip;
echo("Line: "@%line);
%this.send("POST /authQuery.php?" @ %line @ " HTTP/1.1\r\nHost: auth.blockland.us\r\n\r\n");
}
function AuthObject::onConnectFailed(%this)
{
echo("AuthTCP: "@%this.name@"'s auth TCP failed to connect to server");
%this.schedule(10,delete);
}
function AuthObject::onDNSFailed(%this)
{
echo("AuthTCP: "@%this.name@"'s auth TCP failed to connect to server");
%this.schedule(10,delete);
}
function AuthObject::onLine(%t,%l)
{
echo("AuthTCP("@(%t.linedUp?"":"No")@"EmptyLine): "@%l);
if(%l $= "" && !%t.linedUp)
%t.linedUp=1;
if(%t.linedUp)
{
if(firstword(%l) $= "YES")
{
for(%i=0;%i<(%s=ChatServer).users;%i++)
if(%u.bl_id == getWord(%l,1))
{
%u.registered=1;
break;
}
}
%t.schedule(10,delete);
}
}