for outgoing. This is so that you can identify messages that appear in the console. */ print date("[d/m @ H:i]")."<- ".$con['buffer']['all'] ."n"; /* If the server is PINGing, then PONG. This is to tell the server that we are still here, and have not lost the connection */ if(substr($con['buffer']['all'], 0, 6) == 'PING :') { /* PONG : is followed by the line that the server sent us when PINGing */ send('PONG :'.substr($con['buffer']['all'], 6)); /* If this is the first time we have reached this point, then JOIN the channel */ if ($firstTime == true){ send("JOIN ". $CONFIG['channel']); /* The next time we get here, it will NOT be the firstTime */ $firstTime = false; } /* Make sure that we have a NEW line of chats to analyse. If we don't, there is no need to parse the data again */ } elseif ($old_buffer != $con['buffer']['all']) { /* This is where you would analyze the data, and act accordingly. */ } } } ?>