5
[irbot.git] / sources / plug_admin-class.inc.php
blobc710cbd11fadde3274108e0fe45fa01003878ab0
1 <?php
3 class plug_admin implements plugin {
5 private $main;
6 public $auth = false;
8 public function __construct($main) {
9 $this->main = $main;
12 public function start($IRCtxt) {
13 $this->auth($IRCtxt);
16 public function help(){
17 $msg[] = 'connect <user> <password> : Vous authentifie au bot';
18 return $msg;
21 public function auth($IRCtext) {
22 if (preg_match('`^:(.*?)!.*?@.*? PRIVMSG '.$this->main->MyConn->myBotName." :connect ([^ ]+) ([^\n\r]+)\n\r`",$IRCtext,$T)) {
23 if ($T[2] == 'admin' && $T[3] == 'mypass') {
24 $this->auth = true;
25 $this->main->MyConn->put('PRIVMSG '.$T[1].' :Vous etes bien connecte.');
26 } else {
27 $this->main->MyConn->put('PRIVMSG '.$T[1].' :Erreur.');