Ejemplo n.º 1
0
 /**
  * privmsg 受信時のアクション
  * プラグインマネージャと,各プラグインの実行を行う
  * @param Net_IRC_Message $m
  * @return void
  **/
 protected function on_privmsg(Net_IRC_Message $m)
 {
     list($prefix, $message) = $m->params();
     // plugin-manager
     if (strpos($message, '@' . $this->nick) === 0) {
         $this->plugin_manager($prefix, $message);
     }
     // 通常のアクション
     foreach ($this->plugins as $plugin_name => $plugin) {
         if ($plugin->pattern() != null && preg_match($plugin->pattern(), $message, $match)) {
             $this->run_plugin($plugin_name, 'on_privmsg', $m, $match);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * privmsg 受信時のアクション
  * プラグインマネージャと,各プラグインの実行を行う
  * @param Net_IRC_Message $m
  * @return void
  **/
 protected function on_privmsg(Net_IRC_Message $m)
 {
     list($prefix, $message) = $m->params();
     // plugin-manager
     if (strpos($message, '@' . $this->nick) === 0) {
         $this->plugin_manager($prefix, $message);
     }
     // 通常のアクション
     if (!isset($this->channel_plugins[$prefix])) {
         $this->channel_plugins[$prefix] = array();
     }
     foreach ($this->channel_plugins[$prefix] as $plugin_name => $status) {
         if ($status && isset($this->plugins[$plugin_name])) {
             $plugin = $this->plugins[$plugin_name];
             if ($plugin->pattern() != null && preg_match($plugin->pattern(), $message, $match)) {
                 $this->run_plugin($plugin_name, 'on_privmsg', $m, $match);
             }
             $plugin = null;
         }
     }
 }