예제 #1
0
 /**
  * We got triggered by !seen.
  */
 public function on_seen_Pb()
 {
     $argv = $this->argv();
     $argc = count($argv);
     if ($argc === 1) {
         if (!preg_match('/^[a-z0-9_!]+$/iD', $argv[0])) {
             return Dog::rply('err_user');
         }
         if (false === ($server = Dog::getServerBySuffix($argv[0]))) {
             return Dog::rply('err_server');
         }
         if (false === ($user = Dog_User::getByLongName($argv[0]))) {
             return Dog::rply('err_user');
         }
         if (false === ($seen = Dog_Seen::getSeen($user))) {
             return $this->rply('never', array($user->displayName()));
         }
         $channel = $seen->getChannel();
         $channam = $channel === false ? '!NOCHAN!' : $channel->displayName();
         $this->rply($seen->getEvent(), array($user->displayName(), $server->displayName(), $channam, $seen->displayDate(), $seen->displayAge(), $seen->getMessage()));
     } else {
         $this->showHelp('seen');
     }
 }
예제 #2
0
파일: join_Hb.php 프로젝트: sinfocol/gwf3
<?php

$lang = array('en' => array('help' => 'Usage: %CMD% <channel>[!<SID>]. Try to join a channel.', 'already' => 'I am already on that channel.', 'trying' => 'Trying to join this channel.', 'unknown_serv' => 'This server is unknown.'), 'de' => array('help' => 'Nutze: %CMD% <Kanal>[!<SID>]. Versucht einem Kanal beizutreten.', 'already' => 'Ich bin schon in diesem Kanal.', 'trying' => 'Es wird versucht dem Kanal beizutreten.', 'unknown_serv' => 'Dieser Server ist nicht vorhanden.'));
$plugin = Dog::getPlugin();
if ($plugin->argc() !== 1) {
    return $plugin->showHelp();
}
$arg = $plugin->argv(0);
if (false === ($server = Dog::getServerBySuffix($arg))) {
    return $plugin->rply('unknown_serv');
}
if (false !== ($channel = Dog::getChannelByArg($arg))) {
    return $plugin->rply('already');
}
$chan_name = Common::substrFrom($arg, '!', $arg);
if (false === ($channel = Dog_Channel::getOrCreate($server, $chan_name))) {
    return Dog::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$plugin->rply('trying');
$channel->saveOption(Dog_Channel::AUTO_JOIN, true);
$server->joinChannel($channel);