示例#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);
 }
示例#2
0
 public function run()
 {
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     $user = UserManager::get($this->senderNick);
     $server = Server::getInstance();
     //$server->message($user->nickname, "Welcome to Persian Mafia game. This channel is logged, check this for more info : http://cyberrabbits.net/non/mafia/");
 }
 public function run()
 {
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     $user = UserManager::get($this->senderNick);
     $db = Database::getInstance();
     $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, host, ident, channel_name, message, time) VALUES (?,?,?,?,?,?,?)");
     $stmt->execute(array(ReceivedLineTypes::CHANMSG, $this->senderNick, $user->host, $user->ident, $this->channel, $line->message, time()));
 }
示例#4
0
文件: MafiaNick.php 项目: numb95/pmg
 public function run()
 {
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     $game = MafiaGame::getInstance();
     //ChannelManager::rename($this->senderNick, $this->targetNick);
     //UserManager::rename($this->senderNick, $line->targetNick, $line->senderIdent, $line->senderHost);
     $game->changeNick($this->senderNick, $this->targetNick);
 }
示例#5
0
 public function run()
 {
     $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);
 }
示例#6
0
文件: JoinParser.php 项目: numb95/pmg
 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);
 }
示例#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);
 }
示例#8
0
文件: ModeParser.php 项目: numb95/pmg
 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);
 }
示例#9
0
文件: bot.php 项目: numb95/pmg
 // Identify
 $server->identify();
 sleep(1);
 // NickServ
 if (Config::$nickservPassword) {
     $server->identifyWithNickServ();
 }
 // Loop through the channels in the config and join them
 foreach (Config::$channels as $channel) {
     $server->join($channel);
 }
 // Loop-edy-loop
 $cntUpd = 0;
 while ($server->connected()) {
     $line = $server->getNextLine();
     $line = new ReceivedLine($line);
     $line->parse();
     if ($line->isCommand()) {
         $command = new Command($line);
         $command->execute();
     }
     if ($line->isMappedEvent()) {
         $event = new Event($line);
         $event->execute();
     }
     if ($line->isMappedTrigger()) {
         $trigger = new Trigger($line);
         $trigger->execute();
     }
     $cntUpd++;
     if ($cntUpd > 1000) {