public static function getChannels() {
return self::$static_channels;
- }
+ }
+ public static function getChannelCount() {
+ return count(self::$static_channels);
+ }
+
+ public static function recheckAllChannels() {
+ foreach(self::$static_channels as $channel) {
+ $channel->checkChannel();
+ }
+ }
private $name;
private $topic;
return $this->topic;
}
+ public function setCreateTime($time) {
+ $this->create_time = $time;
+ }
+
public function getCreateTime() {
return $this->create_time;
}
$user->addChannel($this);
}
+ private function checkChannel() {
+ if(count($this->users) == 0 && !$this->modes->hasMode('z')) {
+ unset(self::$static_channels[strtolower($this->name)]); //drop empty channel
+ }
+ }
+
public function quitUser($user) {
if(array_key_exists($user->getNumeric(), $this->users)) {
unset($this->users[$user->getNumeric()]);
unset($this->userPrivs[$user->getNumeric()]);
//$user->delChannel($this) is not necessary because the user quits (the whole Object gets removed later)
+ $this->checkChannel();
} else {
trigger_error("Tried to quit a User from a Channel it is not joined.", E_USER_WARNING);
}
unset($this->users[$user->getNumeric()]);
unset($this->userPrivs[$user->getNumeric()]);
$user->delChannel($this);
+ $this->checkChannel();
} else {
trigger_error("Tried to part a User from a Channel it is not joined.", E_USER_WARNING);
}
}
}
+ public function getUserCount() {
+ return count($this->users);
+ }
+
public function getUsers() {
return $this->users;
}