5 protected $current_msg_info = false;
7 private $msg, $msg_info;
9 function __construct() {
10 $this->ircmain
= bot
::GetInstance();
13 function parse_get($msg) {
16 if (preg_match("`^ERROR :(Closing Link: )?(.*)\r?$`i", $this->msg
))
18 @fclose
($this->ircmain
->C
);
20 throw new Exception('Closing Link.',1);
23 elseif (preg_match("`^PING :(.*)\r?\n`", $this->msg
, $T))
25 $this->ircmain
->put('PONG '.$T[1]);
26 echo "PING :{$T[1]}\nPONG {$T[1]}\n\n";
28 // Bot kicked, thanks kicker !
29 elseif (preg_match('`^:(.*?)!.*?@.*? KICK '.bot
::$channel.' '.preg_quote(bot
::$myBotName, '`').' :`', $this->msg
, $T))
32 $this->ircmain
->joinChannel(bot
::$channel);
33 $this->ircmain
->privmsg(bot
::$channel,'Merci '.$T[1].' !');
36 // Illegals characters in Nickname : 432
37 // Nick already in use : 433
38 elseif (preg_match('`^:[^ ]+ (001|432|433) (.*?)\r?\n`', $this->msg
,$T))
42 $this->ircmain
->joinChannel(bot
::$channel);
46 $this->ircmain
->newNick('NoNameBot'.rand(0,9).rand(0,9));
49 echo "Nick already in use\n\n";
50 $this->ircmain
->newNick(false);
52 echo "Geeeh, I do not known what this mean ...\n";
53 echo "DEBUG :>".$this->msg
;
58 // :<Owner:T1> PRIVMSG <recever:T2> :<msg:T3>
59 if (preg_match('`^:(.*?)!.*?@.*? PRIVMSG ('.bot
::$myBotName.'|'.bot
::$channel.") :(.*)\r`",$this->msg
,$T)) {
60 $this->msg_info
= array (
62 'from' => $T[1], // owner
63 'to' => $T[2], // message for bot or channel
66 } elseif (preg_match('`^:(.*?)!.*?@.*? NOTICE '.bot
::$myBotName." :(.*)\r`",$this->msg
,$T)) {
67 $this->msg_info
= array (
70 'to' => bot
::$myBotName,
77 * return last privmsg / notice
81 public function get_msg_info() {
82 $temp = $this->msg_info
;
83 $this->msg_info
= array('type'=>false);