All pastes #924457 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-01 10:52 UTC
rendered paste body
class bot {
	function connect($num) {
		$this->me = "localhost[".$num."]";
		$this->chans = "#Spicy";

		$this->context = stream_context_create(array('socket' => array('bindto' => "[2001:6f8:1139::2]:0")));
		$this->socket = stream_socket_client("tcp://darklite.be.eu.SwiftIRC.net:6667",$errno,$errstr,5,0,$this->context);
	
		stream_set_timeout($this->socket,-1); 
	
		$this->raw("USER ".$this->me." \"\" \"irc.swiftirc.net\" :Spicy!");
		$this->raw("NICK ".$this->me);
		$this->raw("MODE ".$this->me." -x");
		sleep(1);
		$this->raw("JOIN ".$this->chans);
		while ($this->data = trim(fgets($this->socket))) {
			echo $this->data;
		}
	}
	
	function raw($info) {
		echo $info."\r\n";
		fputs($this->socket,$info."\n");
	}
}


$bot1 = new bot();
$bot1->connect(1);
$bot2 = new bot();
$bot2->connect(2);
$bot3 = new bot();
$bot3->connect(3);