public static function recover_command($nick, $ircdata = array()) { $unick = $ircdata[0]; $password = $ircdata[1]; // get the parameters. if (trim($unick) == '' || trim($password) == '') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'RECOVER')); return false; } // invalid syntax if (!isset(core::$nicks[$unick])) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IN_USE, array('nick' => $unick)); return false; // nickname isn't in use } if ($user = services::user_exists($unick, false, array('display', 'pass', 'salt'))) { if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) { $random_nick = 'Unknown' . rand(10000, 99999); // generate a random nick ircd::svsnick($unick, $random_nick, core::$network_time); // force the nick change, ONLY, we set a timer to introduce the // enforcer client, in the next iteration of the main loop // to make sure the ircd class can preserve all information // about the target, and not have it overwritten with introduce_client() core::alog(core::$config->nickserv->nick . ': RECOVER command used on ' . $unick . ' by ' . core::get_full_hostname($nick)); // introduce a client, logchan everything etc. timer::add(array('ns_recover', 'introduce_callback', array($unick)), 1, 1); // set it into the array which we check, in the next second } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD); // password isn't correct } } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick)); return false; // doesn't even exist.. } }
public function main(&$ircdata, $startup = false) { if (ircd::on_connect(&$ircdata)) { $nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3); if ($user = services::user_exists($nick, false, array('display', 'suspended'))) { if ($user->suspended == 1) { $random_nick = 'Unknown' . rand(10000, 99999); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display)); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_CHANGE, array('nick' => $random_nick)); ircd::svsnick($nick, $random_nick, core::$network_time); } } // check if the nick is suspended etc. } // trigger on connect if (ircd::on_nick_change(&$ircdata)) { $nick = core::get_nick($ircdata, 2); // get the nicknames if ($user = services::user_exists($nick, false, array('display', 'suspended'))) { if ($user->suspended == 1) { $random_nick = 'Unknown' . rand(10000, 99999); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display)); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_CHANGE, array('nick' => $random_nick)); ircd::svsnick($nick, $random_nick, core::$network_time); } } // check if the nick is suspended etc. } // trigger on nick change }
public function secured_callback($nick) { $random_nick = 'Unknown' . rand(10000, 99999); ircd::svsnick($nick, $random_nick, core::$network_time); // ready to change a secured nick >:D }