コード例 #1
0
 public function listenError(IrcDataObject $resource)
 {
     $logger = $this->getModulePool()->get('Logger');
     switch ($resource->getCommand()) {
         case 431:
             $logger->warning('The server found the sent nickname to be empty. Trying alternatives...');
             break;
         case 432:
             $logger->warning('The set nickname contains invalid characters according to the server. Trying alternatives...');
             break;
         case 433:
             $logger->warning('The server reported that this nickname was already in use. Trying alternatives...');
             break;
         case 437:
             $logger->warning('The server reported that the sent nickname has been temporarily disabled. Trying alternative in the meantime.');
             break;
     }
 }
コード例 #2
0
 public function updateChannelName(IrcDataObject $object)
 {
     if (!in_array($object->getCommand(), ['QUIT', 'JOIN', 'PART', 'KICK'])) {
         return;
     }
     $nick = $object->getMessage()['nick'];
     // kick command has the destination user set elsewhere; ['nick'] is the user executing the kick
     if ($object->getCommand() == 'KICK') {
         $nick = $object->getParams()['user'];
     }
     // true if user should be removed, false if he/she needs to be added
     $remove = $object->getCommand() != 'JOIN';
     foreach ($this->channelIndex as $channel) {
         if ($remove && $channel->userExists($nick)) {
             $channel->removeUser($nick);
         } elseif (!$channel->userExists($nick)) {
             $channel->addUser($nick);
         }
     }
 }