public function hasPermission($serv, $chan, $user) { return Dog::hasPermission($serv, $chan, $user, $this->priv, $this->scope); }
} } else { if (NULL !== ($t = $serv->getTriggers())) { $plugin->rply('serv', array($t)); } else { $plugin->rply('serv_by_bot', array(Dog_Init::getTriggers())); } } } elseif ($argc === 1) { if ($chan !== false) { if ($argv[0] === 'default') { $chan->saveVar('chan_triggers', NULL); $plugin->rply('chan_to_default'); } else { $chan->saveVar('chan_triggers', $argv[0]); $plugin->rply('chan_to', array($argv[0])); } } else { if (!Dog::hasPermission($serv, false, $user, 'i')) { Dog::noPermission('i'); } elseif ($argv[0] === 'default') { $serv->saveVar('serv_triggers', NULL); $plugin->rply('serv_to_default'); } else { $serv->saveVar('serv_triggers', $argv[0]); $plugin->rply('serv_to', array($argv[0])); } } } else { $plugin->showHelp(); }
public function hasPermissionFor($trigger, Dog_Server $serv, $chan, $user) { $privabc = $this->getPrivABC($trigger); return Dog::hasPermission($serv, $chan, $user, $privabc[0], $privabc[1]); }
public function on_autojoin_Ac() { $user = Dog::getUser(); $server = Dog::getServer(); $argv = $this->argv(); $argc = count($argv); # Invoked in channel. switch ($argc) { # .autojoin case 0: return $this->showStatus($channel); # .autojoin on|#channel # .autojoin on|#channel case 1: if (Dog_Var::isValid('b', $argv[0])) { return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[0])); } elseif (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) { return Dog::rply('err_channel'); } else { return $this->showStatus($channel); } # .autojoin #wechall on # .autojoin #wechall on case 2: if (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) { return Dog::rply('err_channel'); } if (!Dog::hasPermission($server, $channel, $user, 'A')) { return Dog::noPermission('s'); } return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[1])); } $this->showHelp('autojoin'); }
<?php $lang = array('en' => array('help' => 'Usage: %CMD% <target> <message here...>. Send an action to the target. Admins can utilize this across networks. Staff can PRIVMS other users. Voice can only do this to channels.'), 'de' => array('help' => 'Nutze: %CMD% <Ziel> <Nachricht hier...>. Sendet eine Aktion an das Ziel. Admins nutzen dies Netzwerkweit. Staff kann andere Nutzer anschreiben. Voice nur in einen Kanal.')); $user = Dog::getUser(); $serv = Dog::getServer(); $plugin = Dog::getPlugin(); $message = $plugin->argv(); if (count($message) < 2) { return $plugin->showHelp(); } $arg = array_shift($message); $message = implode(' ', $message); # Admin if (Dog::hasPermission($serv, false, $user, 'a')) { if (false !== ($channel = Dog::getChannelByArg($arg))) { return $channel->sendAction($message); } elseif (false !== ($tuser = Dog::getUserByArg($arg))) { return $tuser->sendAction($message); } } elseif (DOG::hasPermission($serv, false, $user, 's')) { if (false !== ($channel = $serv->getChannelByName($arg))) { return $channel->sendAction($message); } elseif (false !== ($tuser = $serv->getUserByName($arg))) { return $tuser->sendAction($message); } } else { if (false !== ($channel = $serv->getChannelByName($arg))) { return $channel->sendAction($message); } } # Errors
if (!Dog::hasPermission($serv, false, $user, 'a')) { Dog::noPermission('a'); } elseif (false !== ($plug = Dog_Plugin::getPlug($name))) { Dog_Conf_Plug_Serv::setDisabled($plug->getName(), $sid, '1'); $plugin->rply('plg_on_serv', array($name, $serv->displayName())); } elseif (false !== ($mod = Dog_Module::getByName($name))) { Dog_Conf_Mod_Serv::setModuleDisabled($mod->getName(), $sid, '1'); $plugin->rply('mod_on_serv', array($mod->displayName(), $serv->displayName())); } elseif (false !== ($mod = Dog_Module::getByTrigger($name))) { Dog_Conf_Mod_Serv::setTriggerDisabled($mod->getName(), $sid, $name, '1'); $plugin->rply('trg_on_serv', array($name, $mod->displayName(), $serv->displayName())); } else { Dog::rply('err_command'); } } else { $cid = $chan->getID(); if (!Dog::hasPermission($serv, $chan, $user, 's')) { return Dog::noPermission('s'); } elseif (false !== ($plug = Dog_Plugin::getPlug($name))) { Dog_Conf_Plug_Chan::setDisabled($plug->getName(), $cid, '1'); $plugin->rply('plg_on_chan', array($name, $chan->displayLongName())); } elseif (false !== ($mod = Dog_Module::getByName($name))) { Dog_Conf_Mod_Chan::setModuleDisabled($mod->getName(), $cid, '1'); $plugin->rply('mod_on_chan', array($mod->displayName(), $chan->displayLongName())); } elseif (false !== ($mod = Dog_Module::getByTrigger($name))) { Dog_Conf_Mod_Chan::setTriggerDisabled($mod->getName(), $cid, $name, '1'); $plugin->rply('trg_on_chan', array($name, $mod->displayName(), $chan->displayLongName())); } else { Dog::rply('err_command'); } }