".$bot['hostname']."");
}
if(!@socket_connect($bot['socket'],$bot['server'],$bot['port'])){
die("Can't connect to: ".$bot['server']."");
}
function sockwrite($data){
global $bot;
socket_write($bot['socket'],$data."\r\n");
}
sockwrite("USER ".$bot['identity']." ".$bot['hostname']." ".$bot['server']." :".$bot['realname']);
sockwrite("NICK ".$bot['nickname']);
$channel = 0;
while($data=@socket_read($bot['socket'],65000,PHP_NORMAL_READ)){
if($data == "\n"){
continue;
}
$edata = explode(" ",$data);
for($i=0; isset($edata[$i]); $i++){
$edata[$i] = trim($edata[$i]);
}
if($channel == "0"){
sockwrite("JOIN ".$bot['channel']);
$channel = 1;
}
if($edata[0] == "PING"){
sockwrite("PONG ".$edata[1]);
}
}
?>