return NULL;
}
+ public static function getChannels() {
+ return self::$static_channels;
+ }
+
private $name;
private $topic;
private $modes;
+ private $create_time;
private $users = array();
const USERPRIV_OPED = 0x0001;
const USERPRIV_VOICE = 0x0002;
public function __construct($name) {
$this->name = $name;
$this->modes = new P10_ChannelModeSet($this);
+ $this->create_time = time();
self::$static_channels[strtolower($name)] = $this;
}
return $this->topic;
}
+ public function getCreateTime() {
+ return $this->create_time;
+ }
+
public function joinUser($user) {
$this->users[$user->getNumeric()] = $user;
$this->userPrivs[$user->getNumeric()] = 0;
}
}
+ public function getUsers() {
+ return $this->users;
+ }
+
}
?>
\ No newline at end of file
$userstr = $args[count($args)-2];
$modeparamcount--;
}
+ if($userstr[0] == "+") { //MODE String
+ $modeparamcount++;
+ $userstr = "";
+ }
$users = explode(",",$userstr);
$isop = false; $isvoice = false;
foreach($users as $user) {
$realname = $user->getRealname();
$this->send("N", $nick, $connect_time, $ident, $host, $modes, $ip, $numeric, $realname);
}
+ foreach(P10_Channel::getChannels() as $channel) {
+ $sorted_users = array('ov' => array(), 'o' => array(), 'v' => array(), '-' => array());
+ $local_users = false;
+ foreach($channel->getUsers() as $user) {
+ if(substr($user->getNumeric(), 0, 2) != $this->server->getNumeric()) continue; //skip users that are not on the local server
+ $privs = $channel->getUserPrivs($user);
+ $strPrivs = "";
+ if(($privs & P10_Channel::USERPRIV_OPED)) $strPrivs .= "o";
+ if(($privs & P10_Channel::USERPRIV_VOICE)) $strPrivs .= "v";
+ if($strPrivs == "") $strPrivs = "-";
+ $local_users = true;
+ $sorted_users[$strPrivs][] = $user;
+ }
+ if(!$local_users) continue;
+ $userStr = "";
+ foreach($sorted_users['-'] as $user) {
+ if($userStr != "") $userStr.=",";
+ $userStr .= $user->getNumeric();
+ }
+ foreach($sorted_users['ov'] as $i => $user) {
+ if($userStr != "") $userStr.=",";
+ $userStr .= $user->getNumeric();
+ if($i == 0) $userStr .= ":ov";
+ }
+ foreach($sorted_users['o'] as $i => $user) {
+ if($userStr != "") $userStr.=",";
+ $userStr .= $user->getNumeric();
+ if($i == 0) $userStr .= ":o";
+ }
+ foreach($sorted_users['v'] as $i => $user) {
+ if($userStr != "") $userStr.=",";
+ $userStr .= $user->getNumeric();
+ if($i == 0) $userStr .= ":v";
+ }
+ $banString = "";
+ //TODO: Build ban String
+ $burstString = "";
+ $modeString = $channel->getModes()->getModeString();
+ if($modeString != "+") {
+ $burstString .= $modeString;
+ }
+ if($userStr != "") {
+ if($burstString != "") $burstString .= " ";
+ $burstString .= $userStr;
+ }
+ if($banString != "") {
+ if($burstString != "") $burstString .= " ";
+ $burstString .= ":%".$banString;
+ }
+ $this->send("B", $channel->getName(), $channel->getCreateTime(), $burstString);
+ }
$this->send("EB");
}