public function modload() { modules::init_module('ns_drop', self::MOD_VERSION, self::MOD_AUTHOR, 'nickserv', 'default'); // these are standard in module constructors nickserv::add_help('ns_drop', 'help', &nickserv::$help->NS_HELP_DROP_1); nickserv::add_help('ns_drop', 'help drop', &nickserv::$help->NS_HELP_DROP_ALL); // add the help nickserv::add_command('drop', 'ns_drop', 'drop_command'); // add the drop command }
public function modload() { modules::init_module('ns_ghost', self::MOD_VERSION, self::MOD_AUTHOR, 'nickserv', 'default'); // these are standard in module constructors nickserv::add_help('ns_ghost', 'help', &nickserv::$help->NS_HELP_GHOST_1); nickserv::add_help('ns_ghost', 'help ghost', &nickserv::$help->NS_HELP_GHOST_ALL); // add the help nickserv::add_command('ghost', 'ns_ghost', 'ghost_command'); // add the ghost command }
public function main(&$ircdata, $startup = false) { if (ircd::on_msg(&$ircdata, core::$config->nickserv->nick)) { $nick = core::get_nick(&$ircdata, 0); $query = substr(core::get_data_after(&$ircdata, 3), 1); // convert to lower case because all the tingy wags are in lowercase $query = strtolower($query); nickserv::get_help($nick, $query); } // only hook to the privmsg towards ChanServ, not channel messages // although chanserv shouldn't even be in any channels :P }
public function modload() { modules::init_module('ns_suspend', self::MOD_VERSION, self::MOD_AUTHOR, 'nickserv', 'default'); // these are standard in module constructors nickserv::add_help('ns_suspend', 'help', &nickserv::$help->NS_HELP_SUSPEND_1, true); nickserv::add_help('ns_suspend', 'help', &nickserv::$help->NS_HELP_UNSUSPEND_1, true); nickserv::add_help('ns_suspend', 'help suspend', &nickserv::$help->NS_HELP_SUSPEND_ALL, true); nickserv::add_help('ns_suspend', 'help unsuspend', &nickserv::$help->NS_HELP_UNSUSPEND_ALL, true); // add the help nickserv::add_command('suspend', 'ns_suspend', 'suspend_command'); nickserv::add_command('unsuspend', 'ns_suspend', 'unsuspend_command'); // add the commands }
public function modload() { modules::init_module('ns_password', self::MOD_VERSION, self::MOD_AUTHOR, 'nickserv', 'default'); // these are standard in module constructors nickserv::add_help('ns_password', 'help', &nickserv::$help->NS_HELP_PASSWORD_1); nickserv::add_help('ns_password', 'help password', &nickserv::$help->NS_HELP_PASSWORD_ALL); nickserv::add_help('ns_password', 'help', &nickserv::$help->NS_HELP_SAPASS_1, true); nickserv::add_help('ns_password', 'help sapass', &nickserv::$help->NS_HELP_SAPASS_ALL, true); // add the help docs nickserv::add_command('password', 'ns_password', 'password_command'); nickserv::add_command('sapass', 'ns_password', 'sapass_command'); // add the password command }
public function modload() { modules::init_module('ns_recover', self::MOD_VERSION, self::MOD_AUTHOR, 'nickserv', 'default'); // these are standard in module constructors nickserv::add_help('ns_recover', 'help', &nickserv::$help->NS_HELP_RECOVER_1); nickserv::add_help('ns_recover', 'help recover', &nickserv::$help->NS_HELP_RECOVER_ALL); nickserv::add_help('ns_recover', 'help', &nickserv::$help->NS_HELP_RELEASE_1); nickserv::add_help('ns_recover', 'help release', &nickserv::$help->NS_HELP_RELEASE_ALL); // add the help nickserv::add_command('recover', 'ns_recover', 'recover_command'); nickserv::add_command('release', 'ns_recover', 'release_command'); // add the commands self::$expiry_time = 60; }
public function modload() { modules::init_module('ns_register', self::MOD_VERSION, self::MOD_AUTHOR, 'nickserv', 'default'); // these are standard in module constructors nickserv::add_help('ns_register', 'help', &nickserv::$help->NS_HELP_REGISTER_1); nickserv::add_help('ns_register', 'help register', &nickserv::$help->NS_HELP_REGISTER_ALL); if (core::$config->nickserv->force_validation) { nickserv::add_help('ns_register', 'help', &nickserv::$help->NS_HELP_CONFIRM_1); nickserv::add_help('ns_register', 'help confirm', &nickserv::$help->NS_HELP_CONFIRM_ALL); } // add the help nickserv::add_command('register', 'ns_register', 'register_command'); if (core::$config->nickserv->force_validation) { nickserv::add_command('confirm', 'ns_register', 'confirm_command'); } // add the commands }
public static function info_command($nick, $ircdata = array()) { $unick = core::get_nick(&$ircdata, 0); // get the nickname. if ($unick == '') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'INFO')); // wrong syntax return false; } // make sure they've entered a channel if (!($user = services::user_exists($unick, false, array('display', 'suspended', 'suspend_reason', 'last_hostmask', 'timestamp', 'last_timestamp')))) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick)); return false; } // make sure the user exists if ($user->suspended == 1) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_SUSPENDED_1, array('nick' => $user->display)); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_SUSPENDED_2, array('reason' => $user->suspend_reason)); } else { $hostmask = explode('!', $user->last_hostmask); $hostmask = $hostmask[1]; // get the hostmask services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_1, array('nick' => $user->display)); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_2, array('time' => date("F j, Y, g:i a", $user->timestamp))); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_3, array('time' => date("F j, Y, g:i a", $user->last_timestamp != 0 ? $user->last_timestamp : core::$network_time))); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_4, array('host' => $hostmask)); // standard messages if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false || $unick == $nick && services::user_exists($nick, true, array('display', 'identified')) !== false) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_5, array('email' => nickserv::get_flags($nick, 'e'))); } // if the person doing /ns info has staff powers we show the email // or if someone is doing /ns info on themselves we show it. $url = nickserv::get_flags($unick, 'u'); if ($url != null) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_6, array('url' => $url)); } // url $list = ''; if (nickserv::check_flags($unick, array('S'))) { $list .= 'Secure, '; } if (nickserv::check_flags($unick, array('P'))) { $list .= 'Private Message'; } if (substr($list, -2, 2) == ', ') { $list = substr($list, 0, -2); } // compile our list of options if ($list != '') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_7, array('options' => $list)); } // if our list doesn't equal '', eg. empty show the info. if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false && core::$config->nickserv->expire != 0) { $expiry_time = core::$config->nickserv->expire * 86400; services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_8, array('time' => date("F j, Y, g:i a", $user->last_timestamp != 0 ? $user->last_timestamp : core::$network_time + $expiry_time))); } // if the nick in question has staff powers, we show the expiry times. } }
public static function communicate($from, $to, $template, $data = '') { $ntemplate = $template; if ($data != '' && is_array($data)) { foreach ($data as $var => $value) { $ntemplate = str_replace('{' . $var . '}', $value, $ntemplate); } // loop through the array replacing each variable. } // IF there is a $data defined, we do some replacing // otherwise leave it alone if (nickserv::check_flags($to, array('P'))) { ircd::msg($from, $to, $ntemplate); } else { ircd::notice($from, $to, $ntemplate); } // if they are registered, we check their means of contact }
public static function _registered_nick($nick, $user) { database::update('users', array('identified' => 0), array('display', '=', $nick)); // set them to identified 0, this might fix that long term bug. ircd::on_user_logout($nick); // they shouldn't really have registered mode if (is_array(nickserv::$help->NS_REGISTERED_NICK)) { foreach (nickserv::$help->NS_REGISTERED_NICK as $line) { services::communicate(core::$config->nickserv->nick, $nick, $line); } } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_REGISTERED_NICK); } // this is just a crappy function, basically just parses the NS_REGISTERED thing // we check for arrays and single lines, even though the default is array // someone might have changed it. if (nickserv::check_flags($nick, array('S')) && isset(modules::$list['ns_flags'])) { timer::add(array('ns_identify', 'secured_callback', array($nick)), core::$config->nickserv->secure_time, 1); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SECURED_NICK, array('seconds' => core::$config->nickserv->secure_time)); } // if the nickname has secure enabled, we let them know that we're watching them :o }
public static function set_flag($nick, $target, $flag, $param) { $mode = $flag[0]; $r_flag = $flag[1]; // get the real flag, eg. V, v and mode if (in_array($r_flag, str_split(self::$p_flags)) && $param == '' && $mode == '+') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_NEEDS_PARAM, array('flag' => $flag)); return false; } // are they issuing a flag, that HAS to have a parameter? // only if mode is + and parameter is empty. if ($r_flag == 'e') { $param_field = 'email'; } if ($r_flag == 'u') { $param_field = 'url'; } if ($r_flag == 'm') { $param_field = 'msn'; } // translate. some craq. if ($r_flag == 'e' && $mode == '-') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_CANT_UNSET, array('flag' => $flag)); return false; } // we're not allowed to let +e be unset if (in_array($r_flag, str_split(self::$p_flags)) && $mode == '+') { $check_e = database::select('users_flags', array('id', 'email'), array('email', '=', $param)); if ($r_flag == 'e' && database::num_rows($check_e) > 0) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_EMAIL_IN_USE); return false; } // check if the email is in use. if ($r_flag == 'e' && services::valid_email($param) === false) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_INVALID_E, array('flag' => $flag)); return false; } // is the email invalid? if ($r_flag == 'm' && services::valid_email($param) === false) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_INVALID_E, array('flag' => $flag)); return false; } // is the email invalid? } // check for invalid values if (nickserv::check_flags($target, array($r_flag))) { $nick_flag_q = database::select('users_flags', array('id', 'nickname', 'flags'), array('nickname', '=', $target)); if ($mode == '-') { if (strpos(self::$set[$target], '-') === false) { self::$set[$target] .= '-'; } // ok, no - ? $nick_flag = database::fetch($nick_flag_q); // get the flag record $new_nick_flags = str_replace($r_flag, '', $nick_flag->flags); if (in_array($r_flag, str_split(self::$p_flags))) { database::update('users_flags', array('flags' => $new_nick_flags, $param_field => $param), array('nickname', '=', $target)); // update the row with the new flags. } else { database::update('users_flags', array('flags' => $new_nick_flags), array('nickname', '=', $target)); // update the row with the new flags. } self::$set[$target] .= $r_flag; // some magic :O return true; } if ($mode == '+') { if (!in_array($r_flag, str_split(self::$p_flags))) { self::$already_set[$target] .= $r_flag; // some magic :O return false; } if (strpos(self::$set[$target], '+') === false) { self::$set[$target] .= '+'; } // ok, no + ? $nick_flag = database::fetch($nick_flag_q); // get the flag record database::update('user_flags', array($param_field => $param), array('nickname', '=', $target)); // update the row with the new flags. self::$set[$target] .= $r_flag; // some magic :O return true; } // the flag IS set, so now we check whether they are trying to -, or + it // if they are trying to - it, go ahead, error if they are trying to + it. } else { $nick_flag_q = database::select('users_flags', array('id', 'nickname', 'flags'), array('nickname', '=', $target)); if ($mode == '+') { if (strpos(self::$set[$target], '+') === false) { self::$set[$target] .= '+'; } // ok, no + ? $nick_flag = database::fetch($nick_flag_q); // get the flag record $new_nick_flags = $nick_flag->flags . $r_flag; if (!in_array($r_flag, str_split(self::$p_flags))) { database::update('users_flags', array('flags' => $new_nick_flags), array('nickname', '=', $target)); // update the row with the new flags. self::$set[$target] .= $r_flag; // some magic :O return true; } else { database::update('users_flags', array('flags' => $new_nick_flags, $param_field => $param), array('nickname', '=', $target)); // update the row with the new flags. self::$set[$target] .= $r_flag; // some magic :O return true; } } // the flag ISNT set, so now we check whether they are trying to -, or + it // if they are trying to + it, go ahead, error if they are trying to _ it. if ($mode == '-') { self::$not_set[$target] .= $r_flag; // some magic :O return false; } } // check if the flag is already set? }