
Untitled
By: a guest on Jan 28th, 2012 | syntax:
None | size: 1.22 KB | hits: 12 | expires: Never
private function mainloop()
{
$timers = new timers;
while(true)
{
$data = fgets($this->socket, 128);
//Filter color, bold, underline and italic and double spaces
$data = preg_replace('/'.chr(3).'(\d{1,2})\,?(\d{1,2})?|'.chr(2).'|'.chr(31).'|'.chr(29).'|'.chr(15).'|\s\s/','',$data);
echo $data."\n";
flush();
$d = explode(' ',$data);
for($i = 0;isset($d[$i]);$i++)
{
$d[$i] = trim(addslashes($d[$i]));
}
if ($d[1] == '376') { $motd = 'displayed'; } //Join channels after MOTD is displayed
if ($motd == 'displayed' && count($this->myChans) == 0)
{
$chans = $this->config['connect']['channels'];
$chans = preg_split('/\,/',trim($chans));
foreach($chans as $channel)
{
$this->write('JOIN '.$channel);
array_push($this->myChans,$channel);
}
}
if($d[0] == 'PING')
{
$this->write('PONG '.$d[1]);
}
if ($d[3] == ":!quit")
{
$this->write("QUIT :Quit - Command by ".$Nick);
socket_close($this->socket);
die('Bot was shut down.');
}
$timers->checkTimers();
include('inc/pokerscript.php');
//require('inc/script.php');
}
}