示例#1
0
*/
#####################################################################################################
require_once "lib.php";
$trailing = strtolower(trim($argv[1]));
$nick = strtolower(trim($argv[2]));
$dest = strtolower(trim($argv[3]));
$alias = trim($argv[4]);
$parts = explode(" ", $trailing);
delete_empty_elements($parts);
$cmd = $parts[0];
array_shift($parts);
$trailing = trim(implode(" ", $parts));
switch ($cmd) {
    case "nicks":
        $channel = strtolower(trim($trailing));
        $nicks = users_get_nicks($channel);
        privmsg(implode(" ", $nicks));
        break;
    case "channels":
        $subject_nick = strtolower(trim($trailing));
        $account = users_get_account($subject_nick);
        $channels = users_get_channels($subject_nick);
        privmsg(implode(" ", $channels));
        break;
    case "all-channels":
        $channels = users_get_all_channels();
        privmsg(implode(" ", $channels));
        break;
    case "count":
        $channel = strtolower(trim($trailing));
        $n = users_count_nicks($channel);
示例#2
0
function verify_quorum()
{
    global $dest;
    global $board_member_accounts;
    global $board_member_quorum;
    global $meeting_data;
    if (isset($meeting_data["quorum"]) == False) {
        privmsg("verifying quorum...");
    } else {
        meeting_msg("verifying quorum...");
    }
    $members = array();
    # first try nick same as account
    for ($i = 0; $i < count($board_member_accounts); $i++) {
        $nick = $board_member_accounts[$i];
        $user = users_get_data($nick);
        $account = "";
        if (isset($user["account"]) == True and isset($user["account_updated"]) == True) {
            $delta = microtime(True) - $user["account_updated"];
            if ($delta <= 30 * 60) {
                $account = $user["account"];
                #privmsg("1: [get_data] nick=$nick, account=$account");
            }
        }
        if ($account == "") {
            $account = users_get_account($nick);
            usleep(500000.0);
            #privmsg("1: [whois] nick=$nick, account=$account");
        }
        if (in_array($account, $board_member_accounts) == True and in_array($account, $members) == False) {
            $members[] = $account;
            #privmsg("[".count($members)."] nick=$nick, account=$account");
            if (count($members) >= $board_member_quorum) {
                return $members;
            }
        }
    }
    # cycle through all nicks in channel (except for nicks that are the same as board member accounts)
    $nicks = users_get_nicks($dest);
    for ($i = 0; $i < count($nicks); $i++) {
        $nick = $nicks[$i];
        if (in_array($nick, $board_member_accounts) == True) {
            continue;
        }
        $user = users_get_data($nick);
        $account = "";
        if (isset($user["account"]) == True and isset($user["account_updated"]) == True) {
            $delta = microtime(True) - $user["account_updated"];
            if ($delta <= 30 * 60) {
                $account = $user["account"];
                #privmsg("2: [get_data] nick=$nick, account=$account");
            }
        }
        if ($account == "") {
            $account = users_get_account($nick);
            usleep(500000.0);
            #privmsg("2: [whois] nick=$nick, account=$account");
        }
        if (in_array($account, $board_member_accounts) == True and in_array($account, $members) == False) {
            $members[] = $account;
            #privmsg("[".count($members)."] nick=$nick, account=$account");
            if (count($members) >= $board_member_quorum) {
                return $members;
            }
        }
    }
    return False;
}