All pastes #234611 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-11-02 18:44 UTC
rendered paste body
abstract class PluginBase
{
     abstract function Initialize($botControlInterface); // Called on loading
     abstract function Terminate(); // Called on shutdown or reload
     abstract function ReceiveEvent($eventStr); //this is the function called when an event 
                                                //the class was subscribe to arrives.
     abstract function SubscribeTo(); // This function returns an array of event numbers to subscribe to
     // anything else you want o add
}

class PluginForCTCP extends PluginBase
{
     private $text;
     private $botContol;
     function Initialize($botControlInterface) 
     { 
          $text = "Im initializing..."; 
          $botControl = $botControlInterface; 
          $botControl->say($text);
     }
     function Terminate() 
     { 
          $text = "Im terminating..."; 
          $botControl->say($text);
     }
     
     function ReceiveEvent($eventStr) 
     { 
          $text = "Receiverd event string: ". $eventStr; 
          $botControl->say($text);
     }
     function SubscribeTo()
     {
          $events = {"01","02"};
          return $events;
     }

}