Esempio n. 1
0
 function identify()
 {
     if (Mootyconf::get_value($this->pluginspace . '::password') != '') {
         $this->main->log('Identifying with NickServ...', __CLASS__);
         $this->main->message(IRCINE_TYPE_PRIV, $this->nickserv, 'IDENTIFY ' . Mootyconf::get_value($this->pluginspace . '::password'), IRCINE_PRIO_CRITICAL);
     }
 }
Esempio n. 2
0
 function call($processed_data)
 {
     $reply = false;
     $ctcp = explode(' ', trim($processed_data['message']));
     $command = array_shift($ctcp);
     $rest = implode(' ', $ctcp);
     switch ($command) {
         case 'VERSION':
             $reply = 'VERSION ' . Mootyconf::get_value('deerkins::ircname');
             break;
         case 'PING':
             $reply = 'PING ' . $rest;
             break;
         case 'TIME':
             $reply = 'TIME ' . date("D M j H:i:s Y");
             break;
         case 'ACTION':
             return;
         default:
             $this->log('unknown CTCP type: ' . $command);
             return NULL;
     }
     if ($reply) {
         $this->log('Plugin triggered, sending ' . $command . ' reply');
         $this->message(IRCINE_TYPE_CTCP_REPLY, $processed_data['nick'], $reply, IRCINE_PRIO_CRITICAL);
     }
 }
Esempio n. 3
0
 function install()
 {
     parent::install();
     $admins = Mootyconf::get_values($this->pluginspace . '::admins');
     foreach ($admins as $a => $admin) {
         if ($admin == '') {
             continue;
         }
         $this->admins[] = array('nick' => $admin, 'host' => Mootyconf::get_value('plugin::' . $this->module . '::' . $admin . '::host'), 'password' => Mootyconf::get_value('plugin::' . $this->module . '::' . $admin . '::password'));
     }
 }
Esempio n. 4
0
 public function install()
 {
     $triggers = Mootyconf::get_values($this->pluginspace . '::active');
     foreach ($triggers as $a => $trigger) {
         $this->register_trigger($trigger, Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::type'), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::description'), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::message'), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::args'), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::exec'));
         if (Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::hide') == '' && (Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::type') == 'PRIVMSG' || Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::type') == 'action')) {
             $this->help_triggers[] = array('trigger' => $trigger, 'description' => Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::description'));
         }
         $this->triggers[] = array('trigger' => $trigger, 'type' => Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::type'));
     }
     $this->log('installed');
 }
Esempio n. 5
0
 function install()
 {
     parent::install();
     $this->deer_timeout = Mootyconf::get_value($this->pluginspace . '::timeout');
     $this->timeout_punish = Mootyconf::get_value($this->pluginspace . '::timeout_punish');
     $this->deeritor = Mootyconf::get_value('plugin::deerme::deeritor');
     $this->banlist = array('nick' => Mootyconf::get_values('plugin::deerme::ignore_nick'), 'host' => Mootyconf::get_values('plugin::deerme::ignore_host'), 'channel' => Mootyconf::get_values('plugin::deerme::ignore_channel'));
     $this->privileged_match = Mootyconf::get_values('plugin::deerme::privileged_match');
     $privileged = Mootyconf::get_values($this->pluginspace . '::privileged');
     foreach ($privileged as $a => $user) {
         $this->deer_privileged[] = array('nick' => $user, 'host' => Mootyconf::get_value('plugin::' . $this->module . '::' . $user . '::host'), 'timeout' => Mootyconf::get_value('plugin::' . $this->module . '::' . $user . '::timeout'));
     }
 }
Esempio n. 6
0
 function call($processed_data)
 {
     $message = explode(' ', $processed_data['message']);
     $trigger = array_shift($message);
     $takes_args = Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::args') == 'none' ? false : true;
     if (count($message) > 0 && !$takes_args) {
         return;
     }
     switch (Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::reply_type')) {
         case 'action':
             $this->action($processed_data['recepient'], str_replace(array('%bold', '%sender'), array(chr(2), $processed_data['nick']), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::message')), IRCINE_PRIO_MEDIUM);
             break;
         case 'notice':
             $this->notice($processed_data['recepient'], str_replace(array('%bold', '%sender'), array(chr(2), $processed_data['nick']), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::message')), IRCINE_PRIO_MEDIUM);
             break;
         case 'say':
         default:
             $this->say($processed_data['recepient'], str_replace(array('%bold', '%sender'), array(chr(2), $processed_data['nick']), Mootyconf::get_value('plugin::' . $this->module . '::' . $trigger . '::message')), IRCINE_PRIO_MEDIUM);
     }
 }
Esempio n. 7
0
 function load()
 {
     $this->main->log('Loading modules.', __CLASS__);
     require_once CORE_PATH . 'ircine.module.template.php';
     $modules = Mootyconf::get_values($this->main->server_config_prefix . '::plugins');
     foreach ($modules as $k => $module) {
         if ($this->import($module)) {
             if ($this->is_loaded($module)) {
                 unset($this->modules[$module]);
             }
             $ucmodule = ucfirst($module);
             $this->modules[$module] =& new $ucmodule($this->main);
             //$this->modules[$module]->install ( );
             $this->main->log('installed module: ' . $ucmodule, __CLASS__);
             if (!in_array($module, $this->loaded_modules)) {
                 $this->loaded_modules[] = $module;
             }
         }
     }
     return true;
 }
Esempio n. 8
0
 function install()
 {
     parent::install();
     $this->halp_list_file = MODULE_PATH . Mootyconf::get_value('plugin::halp::halplist');
     $this->load_halp_list();
 }
Esempio n. 9
0
 function handshake()
 {
     $match = array();
     $pattern = "/^\\:(.*)\\ ([0-9]{3})\\ (" . Mootyconf::get_value('deerkins::nick') . ")\\ \\:(.*)\$/";
     preg_match($pattern, $this->main->data, $match);
     if (empty($match)) {
         return;
     }
     if ($match[2] == '001') {
         $this->handshake = 1;
         $this->main->log('Successfully authenticated', __CLASS__);
     }
     if ($match[2] == '376') {
         $this->handshake = 2;
         $this->main->log('MOTD complete, joining channels.', __CLASS__);
         $this->part_join_channels($this->info['channels']);
         // Joins the channels.
     }
 }
Esempio n. 10
0
function load_mooty($serverconfig)
{
    Mootyconf::read($serverconfig, 'plugins.conf') or die($usage . Bashful::c('bold', 'red') . '        ERROR:' . Bashful::reset() . ' Could not read config ' . $conf . '.' . PHP_EOL . PHP_EOL);
}
Esempio n. 11
0
 public static function read($filename, $main = false)
 {
     $mainconfig = '';
     if ($main && file_exists($main)) {
         $mainconfig = file_get_contents($main);
     }
     if (!file_exists($filename)) {
         return false;
     }
     $secion = '';
     $file = file_get_contents($filename) . PHP_EOL . $mainconfig;
     $lines = explode(PHP_EOL, $file);
     foreach ($lines as $l) {
         // "Whitespace sux"
         $l = trim($l);
         // comment
         if (preg_match('/^#/', $l)) {
             continue;
         }
         // empty lines
         if (preg_match('/^(\\s*)$/', $l)) {
             continue;
         }
         if (preg_match('/^(\\s*)\\[(.*)\\]$/', $l, $sec)) {
             // Section
             $section = '';
             $secparts = explode('::', $sec[2]);
             $seccount = count($secparts) - 1;
             for ($i = 0; $i < $seccount; $i++) {
                 $part = $secparts[$i];
                 if ($section == '') {
                     $section .= $part;
                 } else {
                     $section .= '::' . $part;
                 }
                 if (!isset($config[$section])) {
                     $config[$section] = array();
                 }
                 $config[$section][] = $secparts[$i + 1];
             }
             if ($section == '') {
                 $section .= $secparts[$seccount];
             } else {
                 $section .= '::' . $secparts[$seccount];
             }
         } else {
             // Value.. or not?
             if (preg_match('/^(\\s*)(.*?)(\\s*)=(\\s*)(.*)(\\s*)$/', $l, $secparts)) {
                 // Value indeed
                 $hashname = $secparts[2];
                 if (!isset($config[$section . '::' . $hashname])) {
                     $config[$section . '::' . $hashname] = array();
                 }
                 $to_split = str_replace(',,', '\\n', $secparts[5]);
                 $nextval = explode(',', $to_split);
                 $nextvalcount = count($nextval);
                 for ($i = 0; $i < $nextvalcount; $i++) {
                     $nextval[$i] = str_replace(array('\\n', "\n"), ',', preg_replace('/^(\\s*)(.*)(\\s*)$/', '$2', $nextval[$i]));
                 }
                 $config[$section . '::' . $hashname][] = $nextval;
             } else {
                 die('error reading mootyconf.');
             }
         }
     }
     self::$config = $config;
     foreach (array_keys($config) as $key) {
         self::$lc_config[strtolower($key)] = $key;
     }
     return true;
 }
Esempio n. 12
0
 function log($msg, $handler = __CLASS__)
 {
     $prefix = strpos($msg, '<--') === false && strpos($msg, '-->') === false ? ' -!- ' : ' ';
     $msg = str_replace(array("\n", "\r"), '', $msg);
     if (is_object($handler)) {
         $handler = get_class($handler);
     } elseif (!$handler) {
         $handler = get_class($this);
     }
     $log = date("Y-m-d H:i:s") . ' ' . Mootyconf::get_value('deerkins::nick') . ' ( ' . $handler . ' ) !? ' . $prefix . $msg;
     $output = date("Y-m-d H:i:s") . ' ' . Mootyconf::get_value('deerkins::nick') . ' ' . Bashful::bold() . '(' . Bashful::unbold() . ' ' . $handler . ' ' . Bashful::bold() . ')' . Bashful::unbold() . $prefix . $msg;
     if ($this->debuglevel == IRCINE_DEBUG_HIGH || $this->debuglevel == IRCINE_DEBUG_MEDIUM) {
         if (!@fwrite($this->log_handle, $log . PHP_EOL)) {
             $output .= " [NO LOG]";
         }
     }
     echo $output . PHP_EOL;
 }
Esempio n. 13
0
 function install()
 {
     parent::install();
     $this->banned_channels = Mootyconf::get_values($this->main->server_config_prefix . '::banned_channels');
 }