Ejemplo n.º 1
0
 public function onSend(Dog_Server $server, Dog_User $user, $message)
 {
     // 		$c = Dog::getTrigger();
     if (false === ($nickname = Common::substrUntil($message, ' ', false))) {
         return $this->lang('help_send');
     }
     $message = Common::substrFrom($message, ' ');
     if (false === ($user_to = Dog_User::getForServer($server->getID(), $nickname))) {
         return Dog::lang('err_user');
     }
     if (false === Dog_Note::isWithinLimits($user->getID())) {
         return $this->lang('err_limit', array(Dog_Note::LIMIT_AMT, GWF_Time::humanDuration(Dog_Note::LIMIT_TIME)));
     }
     if (false !== ($channel = Dog::getChannel())) {
         if (false !== $channel->getUserByName($nickname)) {
             return $this->lang('err_in_chan', array($nickname));
         }
     }
     if (false === Dog_Note::insertNote($user, $user_to, $message)) {
         return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->lang('msg_sent', array($nickname));
 }
Ejemplo n.º 2
0
 public static function getOrLoadUserByArg($arg)
 {
     // 		Dog_Log::debug("Dog::getOrLoadUserByArg($arg)");
     if (false === ($server = self::getServerBySuffix($arg))) {
         $server = self::getServer();
     }
     $username = Common::substrUntil($arg, '!', $arg);
     if (false !== ($user = $server->getUserByName($username))) {
         return $user;
     }
     return Dog_User::getForServer($server->getID(), $username);
 }