//thats a little bit complicated :D (we may only have one _)
$ipv6 = array();
$ip = explode(":",$ip);
- $last_zero = false; $zero_sequence = 0; $biggest_zero_sequence = 0, $max_start = -1;
+ $last_zero = false; $zero_sequence = 0; $biggest_zero_sequence = 0; $max_start = -1;
foreach($ip as $i => $v) {
if($v == "") {
$skipBlocks = (8 - count($ip));
for($i = 0; $i < 8; $i++) {
if($i == $max_start) { //merge the biggest sequence of _'s
$ip .= "_";
- $i += ($biggest_zero_sequence-1)
+ $i += ($biggest_zero_sequence-1);
} elseif($ipv6[$i] == "_") {
$ip .= "AAA";
} else {
private $modeflags = 0;
private $modeparams = array();
- public __construct($modes) {
+ public function __construct($modes) {
if(self::$modevalues == null) {
//build modevalues array
$flag = 1;
$this->parseModes($modes);
}
- public parseModes($modes) {
+ public function parseModes($modes) {
$args = explode(" ",$modes);
$c = 1;
for($i = 0; $i < strlen($args[0]); $i++) {
}
}
- public setModes($modes, $returndiff = false) {
+ public function setModes($modes, $returndiff = false) {
$args = explode(" ",$modes);
$c = 1;
$add = true;
}
}
- public getModeString() {
+ public function getModeString() {
$modestr = "+";
$paramstr = "";
foreach(self::$modevalues as $mode => $flag) {
private $modeflags = 0;
private $modeparams = array();
- public __construct($modes) {
+ public function __construct($modes) {
if(self::$modevalues == null) {
//build modevalues array
$flag = 1;
$this->parseModes($modes);
}
- public parseModes($modes) {
+ public function parseModes($modes) {
$args = explode(" ",$modes);
$c = 1;
for($i = 0; $i < strlen($args[0]); $i++) {
}
}
- public setModes($modes, $returndiff = false) {
+ public function setModes($modes, $returndiff = false) {
$args = explode(" ",$modes);
$c = 1;
$add = true;
}
}
- public getModeString() {
+ public function getModeString() {
$modestr = "+";
$paramstr = "";
foreach(self::$modevalues as $mode => $flag) {
class P10_Server {
private static $static_servers = array();
- public static getServerByNum($numeric) {
+ public static function getServerByNum($numeric) {
if(array_key_exists($numeric, self::$static_servers)) {
return self::$static_servers[$numeric];
}
return NULL;
}
- public static getServerByName($name) {
+ public static function getServerByName($name) {
$name = strtolower($name);
foreach(self::$static_servers as $server) {
if(strtolower($server->getName()) == $name) {
class P10_User {
private static $static_users = array();
- public static getUserByNum($numeric) {
+ public static function getUserByNum($numeric) {
if(array_key_exists($numeric, self::$static_servers)) {
return self::$static_servers[$numeric];
}
return NULL;
}
- public static getUserByNick($nick) {
+ public static function getUserByNick($nick) {
$nick = strtolower($nick);
foreach(self::$static_users as $user) {
if(strtolower($user->getNick()) == $nick) {
private $modes;
private $realname;
- public __construct($nick, $numeric, $server, $connect_time, $ident, $host, $ip, $realname, $modes) {
+ public function __construct($nick, $numeric, $server, $connect_time, $ident, $host, $ip, $realname, $modes) {
$this->nick = $nick;
$this->numeric = $numeric;
$this->server = $server;
require_once("P10_ModeSets.class.php");
class Uplink {
- private $client = new Client();
+ private $client;
private $settings = array();
private $server;
private $flags = 0;
public function __construct() {
- $this->setSettings("recv_timeout", 1000);
+ $this->client = new Client();
+ $this->setSetting("recv_timeout", 1000);
}
public function initialize() {
if(($this->flags & self::FLAG_SECURITY_QUIT) || ($this->flags & self::FLAG_NOT_CONNECTABLE)) {
sleep(1);
}
- $state = $this->client->connect($host, $port, $this->getSettings("bind"), $this->getSettings("ssl"), $this->getSettings("recv_timeout"));
+ $state = $this->client->connect($host, $port, $this->getSetting("bind"), $this->getSetting("ssl"), $this->getSetting("recv_timeout"));
if(!$state) {
usleep($this->getSetting("recv_timeout") / 1000);
$this->flags |= self::FLAG_NOT_CONNECTABLE;
}
}
- public function setUplink($host, $port, $ssl = false, $bind = null) {
+ public function setUplinkHost($host, $port, $ssl = false, $bind = null) {
$this->setSetting("host", $host);
$this->setSetting("port", $port);
$this->setSetting("ssl", $ssl);
$uplink->setUplinkHost("localhost", 4402);
$uplink->setUplinkServer(5, "php.local.TestNet", "very_weak_password", "Test Server");
+$uplink->initialize();
+
while(true) {
$uplink->loop();
}