Beispiel #1
0
 public function getChannelOrCreate($name, &$created)
 {
     $created = false;
     $chan = $this->getChannelByName($name);
     if (!$chan) {
         // Channel does not exist or has currently no active users (destructed)
         $ch = $this->db->getChannelInfo($name);
         if (!$ch) {
             // Channel does not exist, create it
             if (!$this->db->createChannel($name)) {
                 return null;
             }
             $chan = new Channel($name, $this);
             $created = true;
         } else {
             // Channel exists but is destructed
             $chan = new Channel($ch['name'], $this);
             $chan->setTopic($ch['topic']);
             $chan->addMode($ch['modes']);
             $chan->setUserLimit($ch['userlimit']);
             $chan->setPassword($ch['password']);
         }
         $this->channels->attach($chan);
     }
     return $chan;
 }
Beispiel #2
0
 public function joinChannel(Channel $chan, $permissions)
 {
     $chan->addUser($this, $permissions);
     $this->channels->attach($chan, $permissions);
 }