Exemplo n.º 1
0
 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
 }
Exemplo n.º 2
0
 public static function on_join(&$ircdata)
 {
     if (ircd::on_join(&$ircdata)) {
         $chans = explode(',', $ircdata[2]);
         // find the chans.
         foreach ($chans as $chan) {
             if (services::chan_exists($chan, array('channel', 'topic')) !== false) {
                 database::update('chans', array('last_timestamp' => core::$network_time), array('channel', '=', $chan));
                 // lets update the last used timestamp
             }
             // is the channel registered?
         }
         // we have to do this shit, because unreal has JOINs made up of #chan1,#chan2 craq
         // seriously, in server 2 server? have a laugh son.
     }
 }
Exemplo n.º 3
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.
 }
Exemplo n.º 4
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
 }
Exemplo n.º 5
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
 }