if ($user->isFlooding()) { return; } Dog::setTriggered(); $trigger = substr($trigger, 1); if (false !== ($plug = Dog_Plugin::getPlug($trigger))) { if (!$plug->isInScope($serv, $chan)) { Dog::scopeError($plug->getScope()); } elseif (!$plug->hasPermission($serv, $chan, $user)) { Dog::permissionError($plug->getPriv()); } elseif (!$plug->isEnabled($serv, $chan)) { Dog::rply('err_disabled'); } else { $plug->execute(); } } elseif (false !== ($mod = Dog_Module::getByTrigger($trigger))) { if (!$mod->hasScopeFor($trigger, $serv, $chan)) { Dog::scopeError($mod->getScope($trigger)); } if (!$mod->hasPermissionFor($trigger, $serv, $chan, $user)) { Dog::permissionError($mod->getPriv($trigger)); } elseif (!$mod->isTriggerEnabled($serv, $chan, $trigger)) { Dog::rply('err_disabled'); } else { $mod->execute($trigger); } } else { // Dog::rply('err_command'); } } } elseif (Common::startsWith($msg, "") && Common::endsWith($msg, "")) {
$serv = Dog::getServer(); $plugin = Dog::getPlugin(); $argv = $plugin->argv(); $argc = count($argv); if ($argc === 1) { $name = $argv[0]; if (false !== ($plug = Dog_Plugin::getPlugWithPerms($serv, $chan, $user, $name))) { $plug->showConfigVarNames('u'); } if (false !== ($mod = Dog_Module::getModuleWithPermsByTrigger($serv, $chan, $user, $name)) || false !== ($mod = Dog_Module::getByName($name))) { $mod->showConfigVarNames('u'); } } elseif ($argc === 2) { $name = $argv[0]; if (false !== ($plug = Dog_Plugin::getPlugWithPerms($serv, $chan, $user, $name))) { $plug->showConfigVar('u', $argv[1]); } if (false !== ($mod = Dog_Module::getModuleWithPermsByTrigger($serv, $chan, $user, $name)) || false !== ($mod = Dog_Module::getByName($name))) { $mod->showConfigVar('u', $argv[1]); } } elseif ($argc === 3) { $name = $argv[0]; if (false !== ($plug = Dog_Plugin::getPlugWithPerms($serv, $chan, $user, $name))) { $plug->setConfigVar('u', $argv[1], $argv[2]); } if (false !== ($mod = Dog_Module::getModuleWithPermsByTrigger($serv, $chan, $user, $name)) || false !== ($mod = Dog_Module::getByName($name))) { $mod->setConfigVar('u', $argv[1], $argv[2]); } } else { $plugin->showHelp(); }
<?php $lang = array('en' => array('help' => 'Usage: %CMD% <module> [<flush>]. Will (re)install and init a module.', 'install' => 'Triggering install for %s.', 'install_flush' => 'Dropping all tables and triggering install for %s.'), 'de' => array('help' => 'Nutze: %CMD% <Modul> [<flush>]. (Re)-Installiert und Initialisiert ein Modul.', 'install' => 'Führe die Installationsroutinen für %s aus.', 'install_flush' => 'Lösche und initialisiere Modul %s.')); $plugin = Dog::getPlugin(); $argv = $plugin->argv(); $argc = count($argv); $flush = false; if ($argc === 2) { $flush = $argv[1] === 'flush'; $argc = 1; } if ($flush) { return Dog::reply('NO FLUSH!'); } if ($argc !== 1) { return $plugin->showHelp(); } if (false === ($module = Dog_Module::getModule($argv[0]))) { return Dog::rply('err_module'); } $plugin->rply($flush ? 'install_flush' : 'install', array($module->displayName())); Dog_Init::installModule($module, $flush);
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); }
$out .= implode(', ', $triggers); $out .= '.'; } } $user = Dog::getUser(); $user->sendNOTICE(substr($out, 1)); # Plugins $out = ''; $plugdir = Dog_Plugin::getPlugDir(); GWF_File::filewalker($plugdir, 'dogplug_help_all', false, true, strlen($plugdir) + 1); ksort($DPH_ALL); foreach ($DPH_ALL as $folder => $commands) { sort($commands); $out .= ' ' . chr(2) . $folder . chr(2) . ': '; $out .= implode(', ', $commands); $out .= '.'; } $user->sendNOTICE(substr($out, 1)); } elseif ($argc === 1) { if (false !== ($plug = Dog_Plugin::getPlug($argv[0]))) { $scopetxt = dogplug_scopetxt($plugin, $plug->getPriv(), $plug->getScope()); $plugin->reply($plug->getHelp() . $scopetxt); } elseif (false !== ($mod = Dog_Module::getByTrigger($argv[0]))) { $scopetxt = dogplug_scopetxt($plugin, $mod->getPriv($argv[0]), $mod->getScope($argv[0])); $plugin->reply($mod->getHelp($argv[0]) . $scopetxt); } else { Dog::rply('err_command'); } } else { $plugin->showHelp(); }
<?php $user = Dog::getUser(); $server = Dog::getServer(); $message = Dog::getIRCMsg()->getArg(1); $cmd = strtolower(Common::substrUntil($message, ' ', $message)); $msg = Common::substrFrom($message, ' ', $message); switch ($cmd) { case "ping": case "time": case "action": case "finger": break; case 'version': $user->sendCTCP(sprintf('VERSION Dog v%s. Http://dog.gizmore.org', DOG_VERSION)); break; } Dog_Module::map('trigger_ctcp', array($cmd, $msg));
public static function initTimers() { # Modules foreach (Dog_Module::getModules() as $module) { $module instanceof Dog_Module; $module->onInitTimers(); } # One timer for each server. $d = self::getTimerDir(); $dir = $d . 'all_servers_all'; foreach (Dog::getServers() as $server) { $server instanceof Dog_Server; GWF_File::filewalker($dir, true, array(__CLASS__, 'initTimersDir'), false, $server); } # One timer per server for all servers. $dir = $d . 'all_servers_one'; GWF_File::filewalker($dir, true, array(__CLASS__, 'initTimersDir'), false, $server); # One timer per server for a single server. $dir = $d . 'one_server_one'; GWF_File::filewalker($dir, true, array(__CLASS__, 'initTimersDirServer'), false, NULL); }
public function onLoadLanguage() { parent::onLoadLanguage(); // Shadowcmd::onLoadLanguage(); // Shadowlang::onLoadLanguage(); }
/** * Fired when all servers _should_ be connected, but some are probably down. */ public static function botReady() { echo "Bot is ready!\n"; Dog_Module::map('botReady'); self::$IN_STARTUP = false; }
public static function executeDogHook($hook, $args) { return Dog_Module::map("trigger_{$hook}", $args); }
} if (false !== ($mod = Dog_Module::getByName($name))) { Dog_Conf_Mod_Serv::setModuleDisabled($mod->getName(), $sid, '0'); $plugin->rply('mod_on_serv', array($mod->displayName(), $serv->displayName())); } // else // { // Dog::rply('err_command'); // } } else { $cid = $chan->getID(); if (!Dog::hasPermission($serv, $chan, $user, 's')) { return Dog::noPermission('s'); } if (false !== ($plug = Dog_Plugin::getPlug($name))) { Dog_Conf_Plug_Chan::setDisabled($plug->getName(), $cid, '0'); $plugin->rply('plg_on_chan', array($name, $chan->displayLongName())); } if (false !== ($mod = Dog_Module::getByTrigger($name))) { Dog_Conf_Mod_Chan::setTriggerDisabled($mod->getName(), $cid, $name, '0'); $plugin->rply('trg_on_chan', array($name, $mod->displayName(), $chan->displayLongName())); } if (false !== ($mod = Dog_Module::getByName($name))) { Dog_Conf_Mod_Chan::setModuleDisabled($mod->getName(), $cid, '0'); $plugin->rply('mod_on_chan', array($mod->displayName(), $chan->displayLongName())); } // else // { // Dog::rply('err_command'); // } }