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_chan_create(&$ircdata) { if (ircd::on_chan_create(&$ircdata)) { $chans = explode(',', $ircdata[2]); // chans foreach ($chans as $chan) { if ($channel = services::chan_exists($chan, array('channel', 'topic', 'suspended'))) { self::_join_channel(&$channel); // join the channel } // does the channel exist? } } // hook to the event when a channel is created. }
public function main(&$ircdata, $startup = false) { if (ircd::on_chan_create(&$ircdata)) { $chans = explode(',', $ircdata[2]); // the chans 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; } // if the channel doesn't exist we return false, to save us the hassle of wasting // resources on this stuff below. self::on_create($nusers, $channel); // on_create event } } // we give out the nessicary access when a channel is created :) if (ircd::on_join(&$ircdata)) { $nick = core::get_nick(&$ircdata, 0); $chans = explode(',', $ircdata[2]); // get the channel & nick foreach ($chans as $chan) { if (!($channel = services::chan_exists($chan, array('channel')))) { return false; } // if the channel doesn't exist we return false, to save us the hassle of wasting // resources on this stuff below. if ($nick == core::$config->chanserv->nick) { continue; } // skip us :D $hostname = core::get_full_hostname($nick); // generate a hostname if ($reason = chanserv::check_levels($nick, $chan, array('b'), true, false, true)) { ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']); ircd::kick(core::$config->chanserv->nick, $nick, $chan, $reason); return false; } // check for bans before access $access_array = self::get_access($channel->channel); // get the access array foreach ($access_array as $target => $access) { if ($target == $nick) { $remove_access = false; // don't remove access self::give_access($channel->channel, $nick, $access, chanserv::check_flags($chan, array('S'))); // give them access break; // break cause we've found a match } elseif (strpos($target, '@') !== false && services::match($hostname, $target)) { $remove_access = false; // don't remove access self::give_access($channel->channel, $nick, $access, chanserv::check_flags($chan, array('S'))); // give them access break; // break cause we've found a match } elseif (strpos(core::$chans[$channel->channel]['users'][$nick], 'o') !== false) { $remove_access = true; // set remove access to true continue 1; // continue to next loop to check other access records } elseif (strpos(core::$chans[$channel->channel]['users'][$nick], 'h') !== false) { $remove_access = true; // set remove access to true continue 1; // continue to next loop to check other access records } else { continue 1; // continue to next loop to check other access records } // we check if the user has access, if they do break; // we also check if they dont have access and have op, if they do remove it. } // loop through the access records if ($remove_access) { ircd::mode(core::$config->chanserv->nick, $channel->channel, '-oh ' . $nick . ' ' . $nick); } // easy fix to stop stuff like this below happening. // [20:27:19] * ChanServ sets mode: -o N0valyfe // [20:27:19] * ChanServ sets mode: +o N0valyfe } } // and the same when someone joins }
public function main(&$ircdata, $startup = false) { if ((core::$config->settings->loglevel == 'server' || core::$config->settings->loglevel == 'all') && ircd::on_connect(&$ircdata)) { $nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3); // get nick ircd::notice(core::$config->global->nick, $nick, 'Services are currently running in debug mode, please be careful when sending passwords.'); // give them a quick notice that people can see their passwords. } if (ircd::on_chan_create(&$ircdata)) { $chans = explode(',', $ircdata[2]); // chan foreach ($chans as $chan) { if (core::$config->settings->logchan == $chan) { self::join_logchan(); } // join global to the logchan. } // on chan create bring our bot into it. } }
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. }
public function main(&$ircdata, $startup = false) { 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', 'suspended', 'suspend_reason'))) { if ($channel->suspended == 1) { if (!core::$nicks[$nick]['ircop']) { ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, $channel->suspend_reason); } // boot } // it's also suspended } // channel is registered } } // on_join trigger for forbidden channels if (ircd::on_chan_create(&$ircdata)) { $chans = explode(',', $ircdata[2]); // chans 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', 'suspended', 'suspend_reason'))) { if ($channel->suspended == 1) { foreach ($nusers as $nick => $modes) { if (!core::$nicks[$nick]['ircop']) { ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, $channel->suspend_reason); } } // boot } // it's also suspended } // channel is registered } } // and same with channels being created }