Ejemplo n.º 1
0
Archivo: irc.php Proyecto: bonan/neotor
 /**
  * Returns the IRCChannel object for a specified channel
  * 
  * @param string  $chan   Channel name
  * @param boolean $create True if the channel object should be 
  *                        created if it doesn't already exist
  *
  * @return IRCChannel     Channel object
  */
 public function chan($chan, $create = false)
 {
     return $this->users->chan($chan, $create);
 }
Ejemplo n.º 2
0
 /**
  * Stats Settings
  *
  * @param object $parent The object that's calling the module
  * @param array  $extra  Extra data such as regexps
  * @param object $match  Extra data
  * @param object $text  Extra data
  *
  * @return none
  */
 public function StatsSettings($parent, $extra, $match, $text)
 {
     extract($extra);
     $nick = $extra['nick'];
     $channel = $extra['target'];
     switch ($text) {
         case 'activate':
             if ($parent->chan($target)->hasmode('o', $nick)) {
                 $q = $this->query("SELECT count(id) FROM `" . CONFIG_mysql_prefix . "channelstats_channel` WHERE channel = '{$channel}'");
                 $r = mysql_result($q, 0);
                 if ($r < 1) {
                     $this->parent->privmsg($replyto, "[CHANNELSTATS: Generating information]");
                     $this->query(sprintf("\n\t\t\t\t\t                        INSERT INTO `" . CONFIG_mysql_prefix . "channelstats_channel`\n\t\t\t\t\t                                (`channel`, `active`)\n\t\t\t\t\t                        VALUES\n\t\t\t\t\t                                ('%s', '%d')\n\t\t\t\t\t                ", $channel, 1));
                     $this->parent->privmsg($replyto, "[CHANNELSTATS: Information Stored, Stats Active]");
                     $this->StatsUpdate();
                 }
                 if ($r >= 1) {
                     $q2 = $this->query("SELECT active FROM `" . CONFIG_mysql_prefix . "channelstats_channel` WHERE channel = '{$channel}'");
                     $r2 = mysql_result($q, 0);
                     if ($r2 >= 1) {
                         $this->parent->privmsg($replyto, "[CHANNELSTATS: Channel is already active]");
                     } else {
                         $a = $this->query("UPDATE `" . CONFIG_mysql_prefix . "channelstats_channel` SET active=1 WHERE channel = '{$channel}'");
                         $this->parent->privmsg($replyto, "[CHANNELSTATS: Channel is now active]");
                         $this->settings[$target]["active"] = 1;
                     }
                 }
             } else {
                 $this->parent->privmsg($replyto, "[CHANNELSTATS: You are not an channel operator]");
             }
             break;
         case 'deactivate':
             if ($parent->chan($target)->hasmode('o', $nick)) {
                 $q = $this->query("SELECT count(id) FROM `" . CONFIG_mysql_prefix . "channelstats_channel` WHERE channel = '{$channel}'");
                 $r = mysql_result($q, 0);
                 if ($r < 1) {
                     $this->parent->privmsg($replyto, "[CHANNELSTATS: This channel has no records]");
                 }
                 if ($r >= 1) {
                     $a = $this->query("UPDATE `" . CONFIG_mysql_prefix . "channelstats_channel` SET active=0 WHERE channel = '{$channel}'");
                     $this->parent->privmsg($replyto, "[CHANNELSTATS: Channel is now deactivated]");
                     $this->settings[$target]["active"] = 0;
                 }
             }
             break;
         default:
             $this->parent->privmsg($replyto, "FAKK YOOO!!!");
             break;
     }
 }