X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=Uplink%2FP10_Channel.class.php;fp=Uplink%2FP10_Channel.class.php;h=efe960de62b9f407f823241485cbcb766f099a49;hb=455040407c031d33129808462d42414c577863b4;hp=0000000000000000000000000000000000000000;hpb=7b5d14ab67eadfdb5cc9f062610ae2dd1b9e53af;p=PHP-P10.git diff --git a/Uplink/P10_Channel.class.php b/Uplink/P10_Channel.class.php new file mode 100644 index 0000000..efe960d --- /dev/null +++ b/Uplink/P10_Channel.class.php @@ -0,0 +1,127 @@ +name = $name; + $this->modes = new P10_ChannelModeSet($this); + self::$static_channels[strtolower($name)] = $this; + } + + public function getName() { + return $this->name; + } + + public function getModes() { + return $this->modes; + } + + public function setTopic($topic) { + $this->topic = $topic; + } + + public function getTopic() { + return $this->topic; + } + + public function joinUser($user) { + $this->users[$user->getNumeric()] = $user; + $this->userPrivs[$user->getNumeric()] = 0; + $user->addChannel($this); + } + + public function burstUser($user, $opped, $voiced) { + $this->users[$user->getNumeric()] = $user; + $this->userPrivs[$user->getNumeric()] = ($opped ? self::USERPRIV_OPED : 0) | ($voiced ? self::USERPRIV_VOICE : 0); + $user->addChannel($this); + } + + 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) + } else { + trigger_error("Tried to quit a User from a Channel it is not joined.", E_USER_WARNING); + } + } + + public function partUser($user) { + if(array_key_exists($user->getNumeric(), $this->users)) { + unset($this->users[$user->getNumeric()]); + unset($this->userPrivs[$user->getNumeric()]); + $user->delChannel($this); + } else { + trigger_error("Tried to part a User from a Channel it is not joined.", E_USER_WARNING); + } + } + + public function getUserPrivs($user) { + if(array_key_exists($user->getNumeric(), $this->users)) { + return $this->userPrivs[$user->getNumeric()]; + } else + return 0; + } + + public function setUserPrivs($user, $privs) { + if(array_key_exists($user->getNumeric(), $this->users)) { + $this->userPrivs[$user->getNumeric()] = $privs; + } + } + +} + +?> \ No newline at end of file