public static function getPermbits(Dog_Server $server, Dog_User $user, $needlogin = true) { $bits = $user->isRegistered() ? Dog_IRCPriv::REGBIT : 0; if ($needlogin && !$user->isLoggedIn()) { return $bits; } $uid = $user->getID(); $sid = $server->getID(); if (0 === ($bits = $user->getVarDefault("dsp_{$sid}", 0))) { $bits |= Dog_IRCPriv::LOGBIT; $bits |= self::table(__CLASS__)->selectVar('priv_privs', "priv_sid={$sid} AND priv_uid={$uid}"); # Cache if ($user->isHoster()) { $bits |= Dog_IRCPriv::HOSTBIT; } $user->setVar("dsp_{$sid}", $bits); } return $bits; }
public function onJoinTell(Dog_Server $server, Dog_User $user) { if ($user->isRegistered() && !$user->isLoggedIn()) { return; } $userid = $user->getID(); if (0 == ($count = Dog_Note::countUnread($userid))) { return; } $username = $user->getName(); if ($count == 1) { $user->sendPRIVMSG($this->lang('note1')); } else { $user->sendPRIVMSG($this->lang('note2')); } for ($i = 0; $i < $count; $i++) { $user->sendPRIVMSG($this->readNext($server, $user)); } }
public static function onTrigger(Dog_User $user, $msg) { if ($user->isRegistered() && !$user->isLoggedIn()) { if (false !== ($mod_al = Dog_Module::getModule('AutoLogin'))) { $mod_al instanceof DOGMOD_AutoLogin; $mod_al->onTryAutoLogin(); } # You need to login to play. return Dog::reply(DOGMOD_Shadowlamb::instance()->lang('0001')); } if (false === ($player = self::getPlayerForUser($user))) { return Dog::reply('Can not get Player for user ' . $user->getName() . '.'); } SR_Tell::onTell($player); # Do it! Shadowcmd::onTrigger($player, $msg); }
private function tryAutoLogin(Dog_Server $server, Dog_User $user) { if ($user->isRegistered()) { $username = $user->getName(); if (in_array($server->getID(), $this->status, true)) { $this->sendNickservStatus($server, $username); } else { $server->getConnection()->sendRAW("WHOIS {$username}"); } } }