//=-- PingPlugin.h - Remote Daily Ping Plugin --------------------------------=
//
//  PingPlugin Class:
//
//  This class is used to ping the Ping.MagicStats.com server once a day.
//  This allows user tracking and should be an optional component. 
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-2000 Chris Lattner
//=---------------------------------------------------------------------------=

#include "PagePlugin.h"

class PingPlugin : public PluginTemplate<PagePlugin,PingPlugin> {
public:
  inline static unsigned int GetCurrentVersion() {
    return 100;                       // Version 1.00
  }

  inline static const char *GetPluginName() {
    return "Pinger Plugin";
  }

  inline PingPlugin() { 
    UpdateFreq = Plugin::UpdateDaily;
  }

  void OutputHTML(ostream &, Table<CSString,String> &) {}
  void GetFullName(Table<CSString,String> &, String &FN, int) { 
    FN = GetPluginName(); 
  }

  // Called daily... this pings the server...
  void ResetState();

  String GetMessageToSend() {
    return "Version=2\n";
  }

private :
  char *ErrorMessage;

  int EstablishConnection(const char *Host, unsigned short Port);
};

