Ejemplo n.º 1
0
 */
$chan_name = $pargs[1];
$owner_nick = $pargs[2];
$purpose = '';
if ($cmd_num_args > 2) {
    $purpose = assemble($pargs, 3);
}
if ($chan_name[0] != '#') {
    $bot->notice($user, 'Channel names must begin with the # character.');
    return false;
}
if (!($owner = $this->getAccount($owner_nick))) {
    $bot->noticef($user, '%s is not a known account name!', $owner_nick);
    return false;
}
if (!($reg = $this->getChannelReg($chan_name))) {
    $reg = new DB_Channel($chan_name, $owner->getId());
    $reg->setPurpose($purpose);
    $reg->save();
    $reg = $this->addChannelReg($reg);
    $bot->join($chan_name);
    $chan = $this->getChannel($chan_name);
    if (!$chan->isOp($bot->getNumeric())) {
        $this->mode($chan_name, '+Ro ' . $bot->getNumeric());
    } else {
        $bot->mode($chan_name, '+R');
    }
} else {
    $bot->noticef($user, 'Sorry, %s is already registered.', $reg->getName());
    return false;
}
Ejemplo n.º 2
0
 function loadChannels()
 {
     $res = db_query('select * from channels order by lower(name) asc');
     while ($row = mysql_fetch_assoc($res)) {
         $channel_key = strtolower($row['name']);
         $channel = new DB_Channel($row);
         if ($channel->autoLimits() && !$channel->hasPendingAutolimit()) {
             $this->addTimer(false, $channel->getAutoLimitWait(), 'auto_limit.php', $channel->getName());
             $channel->setPendingAutolimit(true);
         }
         $clean_defmodes = $this->cleanModes($channel->getDefaultModes());
         if ($channel->getDefaultModes() != $clean_defmodes) {
             debugf("Setting defmodes for %s from [%s] to [%s]", $channel->getName(), $channel->getDefaultModes(), $clean_defmodes);
             $channel->setDefaultModes($clean_defmodes);
             $channel->save();
         }
         $this->db_channels[$channel_key] = $channel;
     }
     debugf("Loaded %d channel records.", count($this->db_channels));
 }
Ejemplo n.º 3
0
}
if ($this->getChannelRegCount($user->getAccountId()) >= MAX_CHAN_REGS) {
    $bot->noticef($user, 'You cannot register more than %d channels.', MAX_CHAN_REGS);
    return false;
}
$reg = $this->getChannelReg($chan_name);
$chan = $this->getChannel($chan_name);
if ($reg) {
    $bot->noticef($user, 'Sorry, %s is already registered.', $reg->getName());
    return false;
}
if ($this->isBadchan($chan_name)) {
    $bot->noticef($user, 'Sorry, but you are not allowed to register %s.', $chan_name);
    return false;
}
if (!$chan || !$chan->isOp($user->getNumeric())) {
    $bot->noticef($user, 'You must be an op in %s in order to register it.', $chan_name);
    return false;
}
$create_ts = time();
if ($chan != NULL) {
    $create_ts = $chan->getTs();
}
$reg = new DB_Channel($chan_name, $user->getAccountId());
$reg->setPurpose($purpose);
$reg->setCreateTs($create_ts);
$reg->setRegisterDate(db_date());
$reg->save();
$reg = $this->addChannelReg($reg);
$bot->join($chan_name);
$this->mode($chan_name, '+Ro ' . $bot->getNumeric());