public function main(&$ircdata, $startup = false) { foreach (modules::$list as $module => $data) { if ($data['type'] == 'nickserv') { modules::$list[$module]['class']->main(&$ircdata, $startup); // loop through the modules for nickserv. } } if (ircd::on_msg(&$ircdata, core::$config->nickserv->nick)) { $nick = core::get_nick(&$ircdata, 0); $command = substr(core::get_data_after(&$ircdata, 3), 1); // convert to lower case because all the tingy wags are in lowercase self::get_command($nick, $command); } // this is what we use to handle command listens // should be quite epic. if (ircd::on_mode(&$ircdata) && core::$config->server->help_chan) { $chan = core::get_chan(&$ircdata, 2); if ($chan == strtolower(core::$config->server->help_chan)) { $re_data = $ircdata; unset($re_data[0], $re_data[1], $re_data[2], $re_data[3]); foreach ($re_data as $nick) { // we're going to guess that it's a nick here, lol. if (strstr(core::$chans[$chan]['users'][$nick], 'o')) { ircd::umode(core::$config->nickserv->nick, $nick, '+h'); } // user has +o, lets give em +h! } } // only deal with it if we're talking about the help chan } // here we deal with giving umode +h to ops :D if (ircd::on_chan_create(&$ircdata) && core::$config->server->help_chan) { $chans = explode(',', $ircdata[2]); // chans foreach ($chans as $chan) { if ($chan == strtolower(core::$config->server->help_chan)) { // the chan $nusers_str = implode(' ', $ircdata); $nusers_str = explode(':', $nusers_str); // right here we need to find out where the thing is $nusers = ircd::parse_users($chan, $nusers_str, 1); foreach ($nusers as $nick => $modes) { if (strstr($modes, 'o')) { ircd::umode(core::$config->nickserv->nick, $nick, '+h'); } // user has +o, lets give em +h! } } // only deal with it if we're talking about the help chan } } // and on_chan_create }
public static function log_changes(&$ircdata, $startup = false) { if (ircd::on_server(&$ircdata)) { ircd::handle_on_server(&$ircdata); } // let's us keep track of the linked servers if (ircd::on_squit(&$ircdata)) { ircd::handle_on_squit(&$ircdata); } // let's us keep track of the linked servers if (ircd::on_connect(&$ircdata)) { ircd::handle_on_connect(&$ircdata, $startup); } // log shit on connect, basically the users host etc. if (ircd::on_nick_change(&$ircdata)) { ircd::handle_nick_change(&$ircdata, $startup); } // on nick change, make sure the variable changes too. if (ircd::on_quit(&$ircdata)) { ircd::handle_quit(&$ircdata, $startup); } // on quit. if (ircd::on_fhost(&$ircdata)) { ircd::handle_host_change(&$ircdata); } // on hostname change. if (ircd::on_ident_change(&$ircdata)) { ircd::handle_ident_change(&$ircdata); } // on ident change if (ircd::on_gecos_change(&$ircdata)) { ircd::handle_gecos_change(&$ircdata); } // on realname (gecos) change if (ircd::on_mode(&$ircdata)) { ircd::handle_mode(&$ircdata); } // on mode if (ircd::on_ftopic(&$ircdata)) { ircd::handle_ftopic(&$ircdata); } // on ftopic if (ircd::on_topic(&$ircdata)) { ircd::handle_topic(&$ircdata); } // on topic if (ircd::on_chan_create(&$ircdata)) { ircd::handle_channel_create(&$ircdata); } // on channel create if (ircd::on_join(&$ircdata)) { ircd::handle_join(&$ircdata); } // on join if (ircd::on_part(&$ircdata)) { ircd::handle_part(&$ircdata); } // and on part. if (ircd::on_kick(&$ircdata)) { ircd::handle_kick(&$ircdata); } // and on kick. if (ircd::on_oper_up(&$ircdata)) { ircd::handle_oper_up(&$ircdata); } // on oper ups }
public static function on_mode(&$ircdata) { if (ircd::on_mode(&$ircdata)) { $nick = core::get_nick(&$ircdata, 0); $chan = core::get_chan(&$ircdata, 2); $mode_queue = core::get_data_after(&$ircdata, 4); $a_mode = strpos($mode_queue, 'a'); $o_mode = strpos($mode_queue, 'o'); $cs_uid = array_search(core::$config->chanserv->nick, core::$uids); // bleh. if ((strpos($mode_queue, core::$config->chanserv->nick) || strpos($mode_queue, $cs_uid)) && ($a_mode !== false || $o_mode !== false)) { if (ircd::$protect) { ircd::mode(core::$config->chanserv->nick, $chan, '+ao ' . core::$config->chanserv->nick . ' ' . core::$config->chanserv->nick); } else { ircd::mode(core::$config->chanserv->nick, $chan, '+o ' . core::$config->chanserv->nick); } // +o its self. } // we're being deopped! WHAT THE F**K! :D } }
public function main(&$ircdata, $startup = false) { if (ircd::on_mode(&$ircdata)) { $nick = core::get_nick(&$ircdata, 0); $chan = core::get_chan(&$ircdata, 2); $mode_queue = core::get_data_after(&$ircdata, 4); if (strpos($nick, '.') !== false && core::$config->server->ircd != 'inspircd12') { $server = $nick; } elseif (strlen($nick) == 3 && core::$config->server->ircd == 'inspircd12') { $server = core::$servers[$nick]['sid']; } else { $server = ''; } // we've found a.in nick, which means it's a server? And it's NOT insp1.2 // OR we've noticed $nick is 3 chars long, which is a SID and it's insp1.2 if ($server == core::$config->ulined_servers || is_array(core::$config->ulined_servers) && in_array($server, core::$config->ulined_servers)) { return false; } // ignore mode changing from ulined servers. if (!($channel = services::chan_exists($chan, array('channel')))) { return false; } // channel isnt registered $modelock = chanserv::get_flags($chan, 'm'); // get the modelock if ($modelock != null) { $nmodelock = explode(' ', $modelock); foreach (str_split($nmodelock[0]) as $mode) { if (strstr($mode_queue, $mode)) { ircd::mode(core::$config->chanserv->nick, $chan, $modelock); } // reset the modes } } // modelock? } // we need to check for any modechanges here, for modelocking if (ircd::on_part(&$ircdata)) { $chan = core::get_chan(&$ircdata, 2); // get the channel if (chanserv::check_flags($chan, array('L'))) { timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1); // add a timer to update the limit, in 15 seconds } // is there auto-limit enabled? } // on part we check for if (ircd::on_quit(&$ircdata)) { foreach (core::$chans as $chan => $data) { if (chanserv::check_flags($chan, array('L'))) { timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1); // add a timer to update the limit, in 15 seconds } // is there auto-limit enabled? } } // on part we check for if (ircd::on_join(&$ircdata)) { $nick = core::get_nick(&$ircdata, 0); $chans = explode(',', $ircdata[2]); // find the nick & chan foreach ($chans as $chan) { if (!($channel = services::chan_exists($chan, array('channel')))) { return false; } // channel isnt registered if (chanserv::check_flags($chan, array('I'))) { if (chanserv::check_levels($nick, $chan, array('k', 'q', 'a', 'o', 'h', 'v', 'F'), true, false) === false) { ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']); ircd::kick(core::$config->chanserv->nick, $nick, $chan, '+k only channel.'); return false; } // they don't have +k, KICKEM } // is the channel +I, eg, +k users only? $welcome = chanserv::get_flags($chan, 'w'); // get the welcome msg if ($welcome != null) { ircd::notice(core::$config->chanserv->nick, $nick, '(' . $chan . ') ' . $welcome); // we give them the welcome msg } // is there any welcome msg? notice it to them if (chanserv::check_flags($chan, array('L'))) { timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1); // add a timer to update the limit, in 15 seconds } // is there auto-limit enabled? } } // on_join entry msg // this is just a basic JOIN trigger if (ircd::on_chan_create(&$ircdata)) { $chans = explode(',', $ircdata[2]); // chan foreach ($chans as $chan) { $nusers_str = implode(' ', $ircdata); $nusers_str = explode(':', $nusers_str); // right here we need to find out where the thing is $nusers = ircd::parse_users($chan, $nusers_str, 1); if (!($channel = services::chan_exists($chan, array('channel')))) { return false; } // channel isnt registered if (chanserv::check_flags($chan, array('I'))) { foreach ($nusers as $nick => $mode) { if (chanserv::check_levels($nick, $chan, array('k', 'q', 'a', 'o', 'h', 'v', 'F'), true, false) === false) { ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']); ircd::kick(core::$config->chanserv->nick, $nick, $chan, '+k only channel.'); } // they don't have +k, KICKEM } } // is the channel +I, eg, +k users only? $welcome = chanserv::get_flags($chan, 'w'); // get the welcome msg if ($welcome != null) { foreach ($nusers as $nick => $mode) { if ($nick == core::$config->chanserv->nick) { continue; } // skip if it's chanserv ircd::notice(core::$config->chanserv->nick, $nick, '(' . $chan . ') ' . $welcome); // we give them the entrymsg } } // check for a welcome msg, if so // message it to the joining users. if (chanserv::check_flags($chan, array('L'))) { cs_flags::increase_limit($chan, 1); // add a timer to update the limit, in 15 seconds } // is there auto-limit enabled? } } // on channel create, we send out the welcome message // if there is one. }