コード例 #1
0
ファイル: core.php プロジェクト: rickihastings/acorairc
 public static function max_users(&$ircdata)
 {
     if (ircd::on_connect(&$ircdata)) {
         if (count(self::$nicks) > self::$max_users) {
             $update_array = array('max_users' => count(self::$nicks), 'max_userstime' => self::$network_time);
             $update = database::update('core', $update_array, array('id', '=', '1'));
             self::$max_users = count(self::$nicks);
             // update the max users
             self::alog(self::$config->operserv->nick . ': New user peak: ' . count(self::$nicks) . ' users');
             // logchan
             return true;
         }
         // if the current number of users is more than the previous max
     }
     // if someone has logged in
 }
コード例 #2
0
ファイル: suspend.ns.php プロジェクト: rickihastings/acorairc
 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
 }
コード例 #3
0
ファイル: global.os.php プロジェクト: rickihastings/acorairc
 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.
     }
 }
コード例 #4
0
 public function main(&$ircdata, $startup = false)
 {
     if (ircd::on_connect(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3);
         // get nick
         if ($user = services::user_exists($nick, false, array('display', 'identified', 'validated', 'last_hostmask', 'suspended'))) {
             if ($user->validated == 0 && $user->suspended == 0) {
                 ircd::on_user_logout($nick);
                 // they shouldn't really have registered mode
                 services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
             } elseif ($user->identified == 0 && $user->suspended == 0) {
                 self::_registered_nick($nick, $user);
             } elseif ($user->identified == 1 && $user->last_hostmask == core::get_full_hostname($nick)) {
                 ircd::on_user_login($nick);
                 if (!$startup) {
                     core::alog(core::$config->nickserv->nick . ': ' . core::$nicks[$nick]['ident'] . '@' . core::$nicks[$nick]['host'] . ' automatically identified for ' . $nick);
                 }
             } else {
                 self::_registered_nick($nick, $user);
             }
         }
         // is the user existing?
     }
     // on connect let them know that they're using
     // an identified nickname
     if (ircd::on_nick_change(&$ircdata)) {
         $nick = core::get_nick($ircdata, 2);
         $old_nick = core::$nicks[$nick]['onick'];
         // get the nicknames
         timer::remove(array('ns_identify', 'secured_callback', array($old_nick)));
         // remove the secured timer. if there is one
         ircd::on_user_logout($nick);
         // we remove the registered mode
         if ($user = services::user_exists($nick, false, array('display', 'identified', 'validated', 'last_hostmask', 'suspended'))) {
             if ($user->validated == 0 && $user->suspended == 0) {
                 ircd::on_user_logout($nick);
                 // they shouldn't really have registered mode
                 services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
             } elseif ($user->identified == 0 && $user->suspended == 0) {
                 self::_registered_nick($nick, $user);
             } elseif ($user->identified == 1 && $user->last_hostmask == core::get_full_hostname($nick)) {
                 ircd::on_user_login($nick);
                 core::alog(core::$config->nickserv->nick . ': ' . core::$nicks[$nick]['ident'] . '@' . core::$nicks[$nick]['host'] . ' automatically identified for ' . $nick);
             } else {
                 self::_registered_nick($nick, $user);
             }
         }
         // is the new nick registered? let them know
     }
     if (ircd::on_quit(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, 0);
         timer::remove(array('ns_identify', 'secured_callback', array($nick)));
         // remove the secured timer. if there is one
         database::update('users', array('identified' => 0, 'last_timestamp' => core::$network_time), array('display', '=', $nick));
         // change nick to unidentified imo
     }
 }
コード例 #5
0
 public function main(&$ircdata, $startup = false)
 {
     if ($startup) {
         return false;
     }
     // we're booting, f**k sending messages to everyone, they don't want to see
     // it if it's just a restart, and we don't want to waste the resources on it.
     if (ircd::on_connect(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3);
         $get_news = database::select('logon_news', array('nick', 'title', 'message', 'time'), '', array('time', 'DESC'), array(0 => 3));
         // get our news
         if (database::num_rows($get_news) > 0) {
             if (isset(operserv::$help->OS_LOGON_START)) {
                 services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_START);
             }
             while ($news = database::fetch($get_news)) {
                 services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_NEWS_1, array('title' => $news->title, 'user' => $news->nick, 'date' => date("F j, Y, g:i a", $news->time)));
                 services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_NEWS_2, array('message' => $news->message));
             }
             // loop through the news
             if (isset(operserv::$help->OS_LOGON_END)) {
                 services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_END);
             }
         }
         // there is news! epic
     }
     // trigger on connects
 }