Example #1
0
<?php

$lang = array('en' => array('help' => 'Usage: %CMD% [<server>]. Command %BOT% to quit a server.', 'ok' => 'Disconnecting from %s...', 'msg' => '%s executed %CMD%!'));
$plugin = Dog::getPlugin();
$user = Dog::getUser();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 0) {
    $server = Dog::getServer();
} elseif ($argc === 1) {
    if (false === ($server = Dog::getServerByArg($argv[0]))) {
        return Dog::rply('err_server');
    }
} else {
    return $plugin->showHelp();
}
$server->saveOption(Dog_Server::ACTIVE, false);
$plugin->rply('ok', array($server->displayLongName()));
$server->disconnect($plugin->lang('msg', array($user->displayName())));
if (!$server->hasConnectedOnce()) {
    Dog::removeServer($server);
    $server->delete();
}
Example #2
0
 public function connect()
 {
     if ($this->next_connect <= microtime(true)) {
         $this->attempt++;
         echo "Dog_IRC::connect() to {$this->getURL()}{$this->displaySSL()} attempt {$this->attempt}.\n";
         if (false === $this->connection->connect($this)) {
             $this->setConnectIn($this->getNextConnectTime());
             if (false !== ($connector = $this->getVarDefault('dog_connector', false))) {
                 $connector instanceof Dog_User;
                 $connector->sendPRIVMSG(Dog::lang('err_connecting', array($this->displayLongName())));
             }
             if ($this->attempt > 3 && !$this->hasConnectedOnce()) {
                 Dog::removeServer($this);
                 $this->delete();
             }
             return false;
         } else {
             $this->attempt = 2;
             return Dog_Auth::connect($this);
         }
     }
 }