Exemplo n.º 1
0
 public function run()
 {
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     ChannelManager::rename($this->senderNick, $this->targetNick);
     UserManager::rename($this->senderNick, $line->targetNick, $line->senderIdent, $line->senderHost);
 }
Exemplo n.º 2
0
 public function run()
 {
     $server = Server::getInstance();
     $channels = ChannelManager::getConnectedChannelArray();
     $server->notify($this->senderNick, "Flushed topic cache successfully");
     foreach ($channels as $channel) {
         $server->topic($channel);
     }
 }
Exemplo n.º 3
0
 public function run()
 {
     $channel = ChannelManager::get($this->channel);
     $channel->removeConnectedNick($this->targetNick);
     ChannelManager::store($this->channel, $channel);
     if (!ChannelManager::isConnectedToTrackedChannel($this->targetNick)) {
         UserManager::remove($this->targetNick);
     }
 }
 public function run()
 {
     $workingLine = explode(" ", $this->runMessage, 5);
     $channel = $workingLine[3];
     $workingLine = explode(" :", $this->runMessage, 2);
     $newTopic = $workingLine[1];
     $channelObject = ChannelManager::get($channel);
     $channelObject->topic = $newTopic;
     ChannelManager::store($channel, $channelObject);
 }
Exemplo n.º 5
0
 public function run()
 {
     $channel = ChannelManager::get($this->channel);
     $channel->addConnectedNick($this->senderNick);
     ChannelManager::store($this->channel, $channel);
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     $user = UserManager::get($this->senderNick);
     $user->nickname = $line->senderNick;
     $user->ident = $line->senderIdent;
     $user->host = $line->senderHost;
     UserManager::store($this->senderNick, $user);
 }
Exemplo n.º 6
0
 public function run()
 {
     if ($this->parameters(2)) {
         $channel = $this->parameters(2);
     } else {
         $channel = $this->channel;
     }
     $channelObject = ChannelManager::get($channel);
     if ($channelObject->hasPrivilegeOrHigher($this->senderNick, "@")) {
         $server = Server::getInstance();
         $server->channelInvite($this->parameters(1), $channel);
     }
 }
Exemplo n.º 7
0
 public function run()
 {
     $channel = ChannelManager::get($this->channel);
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     // We currently only process modes with targets. We can therefor skip if no targets present.
     if (empty($line->targetNick)) {
         return;
     }
     $modes = array();
     if (strlen($line->message) > 2) {
         $split = str_split($line->message);
         $symbol = "";
         foreach ($split as $id => $character) {
             if ($character == "+" || $character == "-") {
                 $symbol = $character;
             } else {
                 $modes[] = $symbol . $character;
             }
         }
     } else {
         $modes[] = $line->message;
     }
     $targetIndex = 0;
     foreach ($modes as $mode) {
         switch ($mode) {
             case "+v":
                 $channel->addPrivilege($this->getTargetNick($line, $targetIndex++), "+");
                 break;
             case "+h":
                 $channel->addPrivilege($this->getTargetNick($line, $targetIndex++), "%");
                 break;
             case "+o":
                 $channel->addPrivilege($this->getTargetNick($line, $targetIndex++), "@");
                 break;
             case "+a":
                 $channel->addPrivilege($this->getTargetNick($line, $targetIndex++), "&");
                 break;
             case "+q":
                 $channel->addPrivilege($this->getTargetNick($line, $targetIndex++), "~");
                 break;
             default:
                 if (in_array($mode, static::$modesWithTarget)) {
                     $targetIndex++;
                 }
                 break;
         }
     }
     ChannelManager::store($this->channel, $channel);
 }
 public function run()
 {
     $user = UserManager::get($this->senderNick);
     if (!$user->nickname) {
         $user = UserManager::get($this->targetNick);
     }
     $channels = ChannelManager::getCommonChannels($this->senderNick);
     if (!$channels) {
         $channels = ChannelManager::getCommonChannels($this->targetNick);
     }
     $db = Database::getInstance();
     foreach ($channels as $channel) {
         $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, host, ident, channel_name, target_nick, time, message) VALUES (?,?,?,?,?,?,?,?)");
         $stmt->execute(array(ReceivedLineTypes::NICK, $this->senderNick, $user->host, $user->ident, $channel, $this->targetNick, time(), "changed nick to " . $this->target_nick));
     }
 }
Exemplo n.º 9
0
 public function run()
 {
     $channel = ChannelManager::get($this->channel);
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     $modes = array();
     if (strlen($line->message) > 2) {
         $split = str_split($line->message);
         foreach ($split as $id => $character) {
             if ($id == 0) {
                 $symbol = $split[0];
             } else {
                 $modes[] = $symbol . $character;
             }
         }
     } else {
         $modes[] = $line->message;
     }
     foreach ($modes as $mode) {
         switch ($mode) {
             case "+v":
                 $channel->addPrivilege($line->targetNick, "+");
                 break;
             case "+h":
                 $channel->addPrivilege($line->targetNick, "%");
                 break;
             case "+o":
                 $channel->addPrivilege($line->targetNick, "@");
                 break;
             case "+a":
                 $channel->addPrivilege($line->targetNick, "&");
                 break;
             case "+q":
                 $channel->addPrivilege($line->targetNick, "~");
                 break;
         }
     }
     ChannelManager::store($this->channel, $channel);
 }
Exemplo n.º 10
0
 public function run()
 {
     // Channel
     $workingLine = explode(" ", $this->runMessage);
     $channel = $workingLine[4];
     // Names
     $workingLine = explode(" :", $this->runMessage);
     $names = trim($workingLine[1]);
     $names = explode(" ", $names);
     // Fetch the channel object
     $channelObject = ChannelManager::get($channel);
     // Loop through the names adding them to the channel and UserManager
     foreach ($names as $name) {
         $privileges = false;
         if (strpos($name, "~") === 0) {
             $privileges = "~";
         }
         if (strpos($name, "&") === 0) {
             $privileges = "&";
         }
         if (strpos($name, "@") === 0) {
             $privileges = "@";
         }
         if (strpos($name, "%") === 0) {
             $privileges = "%";
         }
         if (strpos($name, "+") === 0) {
             $privileges = "+";
         }
         $nick = str_replace(array("~", "@", "&", "%", "+"), "", $name);
         $channelObject->addConnectedNick($nick, $privileges);
         $user = UserManager::get($nick);
         $user->nickname = $nick;
         UserManager::store($nick, $user);
     }
     // Store away the channel object
     ChannelManager::store($channel, $channelObject);
 }
Exemplo n.º 11
0
 public function run()
 {
     ChannelManager::removeConnectedNickFromAll($this->senderNick);
     UserManager::remove($this->senderNick);
 }
Exemplo n.º 12
0
 /**
  * Part a specified channel
  *
  * @param string channel name
  */
 public function part($channel)
 {
     // Send to the server
     fwrite(static::$serverHandle, "PART " . $channel . "\n");
     ErrorLog::log(ErrorCategories::NOTICE, "Parting IRC channel '" . $channel);
     // Remove the channel from the ChannelManager
     ChannelManager::remove($channel);
 }