added P10_Channel.class.php and recv_burst
[PHP-P10.git] / Uplink / P10_User.class.php
index a05f40bb664dded9c99a15c0e02b7ce08db4053d..83169bfe4ada43fa419ec21df9d51a8cdc92e0dc 100644 (file)
@@ -64,6 +64,7 @@ class P10_User {
        private $connect_time;
        private $modes;
        private $realname;
+       private $channels;
        
        public function __construct($nick, $numeric, $server, $connect_time, $ident, $host, $ip, $realname, $modes) {
                $this->nick = $nick;
@@ -121,6 +122,21 @@ class P10_User {
        
        public function quit($reason) {
                $this->server->delUser($this);
+               foreach($this->channels as $channel) {
+                       $channel->quitUser($this);
+               }
+       }
+       
+       public function addChannel($channel) {
+               $this->channels[strtolower($channel->getName())] = $channel;
+       }
+       
+       public function delChannel($channel) {
+               if(array_key_exists(strtolower($channel->getName()), $this->channels)) {
+                       unset($this->channels[strtolower($channel->getName())]);
+               } else {
+                       trigger_error("Tried to remove a Channel, that does NOT exist.", E_USER_WARNING);
+               }
        }
 }