3
[irbot.git] / sources / IRCMain-class.inc.php
blobae65b6c988acdc3d6d83e5e524f21ff1f1f0ce82
1 <?php
3 class IRCMain {
5 public $MyConn;
6 public $Plist = array();
7 public $msg;
9 // Constructeur de la classe
10 public function __construct($server, $port, $channel, $name, $myip, $mydomain) {
11 // Récupération d'une connexion unique
12 IRCConn::Init($server, $port, $channel, $name, $myip, $mydomain);
13 $this->MyConn = IRCConn::GetInstance();
14 // On charge le plugin de base indispensable
15 $this->AddPlug('plug_base');
18 public function run() {
19 while (true) {
20 $this->msg = $this->MyConn->get();
21 foreach ($this->Plist as $Plug) {
22 $Plug->start($this->msg);
27 public function AddPlug($Pname) {
28 if ( !array_key_exists ( $Pname, $this->Plist ) ) {
29 $this->Plist[$Pname] = new $Pname($this);
33 public function UnloadPlug($Pname) {
34 if ( array_key_exists ( $Pname, $this->Plist ) ) {
35 unset( $this->Plist[$Pname] );