コード例 #1
0
ファイル: mods_Pb.php プロジェクト: sinfocol/gwf3
        $u = Dog::getUser();
        $have = Dog_PrivServer::getPermbits($serv, $u);
        $want = Dog_IRCPriv::charsToBits(substr($argv[1], 1));
        $high = Dog_IRCPriv::getHighestBit($have);
        $wigh = Dog_IRCPriv::getHighestBit($want);
        if ($wigh > $high) {
            $plugin->rply('no', array(Dog_IRCPriv::displayBits($wigh, ''), $user->displayName()));
        } else {
            $now = Dog_PrivServer::getPermbits($serv, $user) | $want;
            Dog_PrivServer::setPermbits($serv, $user, $now);
            $plugin->rply('set', array($user->displayName(), $serv->displayName(), Dog_IRCPriv::displayBits($now)));
        }
    } elseif ($sign === '-' && strlen($argv[1]) >= 1) {
        $u = Dog::getUser();
        $have = Dog_PrivServer::getPermbits($serv, $u);
        $want = Dog_IRCPriv::charsToBits(substr($argv[1], 1));
        $high = Dog_IRCPriv::getHighestBit($have);
        $wigh = Dog_IRCPriv::getHighestBit($want);
        if ($wigh >= $high) {
            $plugin->rply('no2', array(Dog_IRCPriv::displayBits($wigh, ''), $user->displayName()));
        } else {
            $now = Dog_PrivServer::getPermbits($serv, $user) & ~$want;
            Dog_PrivServer::setPermbits($serv, $user, $now);
            $plugin->rply('set', array($user->displayName(), $serv->displayName(), Dog_IRCPriv::displayBits($now)));
        }
    } else {
        $plugin->rply('err_bits');
    }
} else {
    $plugin->showHelp();
}
コード例 #2
0
ファイル: opme_Vc.php プロジェクト: sinfocol/gwf3
<?php

$lang = array('en' => array('help' => 'Usage: %CMD%. Works only inside a channel and will try to lift your status.', 'no_privs' => 'I have not enough privileges in that channel.', 'yours_better' => 'Your privileges are even higher than mine :O'), 'de' => array('help' => 'Nutze: %CMD%. Funktioniert nur in Kanälen und erhöht deinen IRC Status.', 'no_privs' => 'Meine Rechte reichen hier nicht aus.', 'yours_better' => 'Deine Rechte sind ja höher als meine ^^'));
$user = Dog::getUser();
$plugin = Dog::getPlugin();
$server = Dog::getServer();
if (false === ($channel = Dog::getChannel())) {
    return Dog::rply('err_only_channel');
}
$dogprv = $channel->getPriv($channel->getDog());
#echo "DOGPRV: $dogprv\n";
$dogbit = Dog_IRCPriv::charsToBits($dogprv);
$bit = Dog_IRCPriv::charsToBits($channel->getPriv($user));
$wantbit = Dog_PrivChannel::getPermbits($channel, $user);
if ($wantbit > $dogbit) {
    $wantbit = $dogbit;
}
if ($dogbit < Dog_IRCPriv::charsToBits('h')) {
    $plugin->rply('no_privs');
} elseif ($bit > $dogbit) {
    $plugin->rply('yours_better');
} elseif ($dogbit > $bit) {
    $server->getConnection()->sendRAW(sprintf('MODE %s +%s %s', $channel->getName(), Dog_IRCPriv::bitToBestNamedSymbol($wantbit), $user->getName()));
}