Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

Kalandra SLN check in

function TSLNDaemon.CheckIn: Boolean;
var
  Request:  TString;
  Response: TString;
begin
  Log(Self, ['check in']);

  Time := GetTickCount + Cardinal(Interval);

  Request := SLNURL +
             '?software=Kalandra'+
             '&retry=' + TString(Interval div 1000) +
             '&port='  + TString(Server.Daemon.Port) +
             '&name='  + TString(Server.Name);

  if length(Server.Host) > 0 then Request := Request + '&host=' + TString(Server.Host).URLEncode;
  if length(Server.URL)  > 0 then Request := Request + '&url='  + TString(Server.URL);
  if length(Zone)        > 0 then Request := Request + '&zone=' + TString(Zone).URLEncode;
  //if Server.PvP.Global      then Request := Request + '&pk=1';
  //if Server.Death.Drop      then Request := Request + '&deadly=1';

  Response := HTTPGet(Request, 'kalandra', TString(Server.Daemon.Binding));
  if length(Response) = 0 then
    Log(Self, ['error connecting to SLN'])
  else
    repeat
      Request := Response.Split(#13).Replace(#9, ' ');
      if length(Request) > 0 then
      begin
        Log(Self, [Request]);

        if (Request[1] = '3') or (Request[1] = '4') then Server.SayAdmin('<sln>', Request);
      end;{if length(Request)}

    until length(Response) = 0;

  Result := True;
end;{TSLNDaemon.CheckIn}