示例#1
0
 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
 }
示例#2
0
 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.
 }
示例#3
0
 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
 }
示例#4
0
 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
 }