format
[PHP-P10.git] / Uplink / P10_Channel.class.php
index 0022b623cd2a5cc1dd2dfad1df84d160866d3226..b194b8206ba4ee39ee6b554a3501b975ef126318 100644 (file)
@@ -6,7 +6,7 @@
  * it under the terms of the GNU General Public License as published by *
  * the Free Software Foundation, either version 3 of the License, or    *
  * (at your option) any later version.                                  *
- *                                                                      * 
+ *                                                                      *
  * This program is distributed in the hope that it will be useful,      *
  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
@@ -16,7 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  *                                                                      *
  ************************************************************************
- * 
+ *
  *  Uplink/P10_Channel.class.php
  *
  * This class represents a IRC Channel
@@ -25,7 +25,7 @@
 
 class P10_Channel {
        private static $static_channels = array();
-       
+
        public static function getChannelByName($name) {
                $name = strtolower($name);
                if(array_key_exists($name, self::$static_channels)) {
@@ -33,21 +33,21 @@ class P10_Channel {
                }
                return NULL;
        }
-       
+
        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;
        private $modes;
@@ -55,58 +55,58 @@ class P10_Channel {
        private $users = array();
        const USERPRIV_OPED  = 0x0001;
        const USERPRIV_HALFOP = 0x0002;
-    const USERPRIV_VOICE = 0x0004;
+       const USERPRIV_VOICE = 0x0004;
        private $userPrivs = array();
-       
+
        public function __construct($name) {
                $this->name = $name;
                $this->modes = new P10_ChannelModeSet($this);
                $this->create_time = time();
                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 setCreateTime($time) {
                $this->create_time = $time;
        }
-       
+
        public function getCreateTime() {
                return $this->create_time;
        }
-       
+
        public function joinUser($user) {
                $this->users[$user->getNumeric()] = $user;
                $this->userPrivs[$user->getNumeric()] = 0;
                $user->addChannel($this);
        }
-       
+
        public function burstUser($user, $opped, $halfopped, $voiced) {
                $this->users[$user->getNumeric()] = $user;
                $this->userPrivs[$user->getNumeric()] = ($opped ? self::USERPRIV_OPED : 0) | ($halfopped ? self::USERPRIV_HALFOP : 0) | ($voiced ? self::USERPRIV_VOICE : 0);
                $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()]);
@@ -117,7 +117,7 @@ class P10_Channel {
                        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()]);
@@ -128,28 +128,28 @@ class P10_Channel {
                        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;
+               } else
+               return 0;
        }
-       
+
        public function setUserPrivs($user, $privs) {
                if(array_key_exists($user->getNumeric(), $this->users)) {
                        $this->userPrivs[$user->getNumeric()] = $privs;
                }
        }
-       
+
        public function getUserCount() {
                return count($this->users);
        }
-       
+
        public function getUsers() {
                return $this->users;
        }
-       
+
 }
 
 ?>
\ No newline at end of file