$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); privmsg("nicks in {$channel}: {$n}"); break; case "data": $subject_nick = strtolower(trim($trailing)); $account = users_get_account($subject_nick); $user = users_get_data($subject_nick); if (isset($user["channels"]) == True) { $channels = array_keys($user["channels"]); for ($i = 0; $i < count($channels); $i++) { $channels[$i] = $user["channels"][$channels[$i]] . $channels[$i]; } privmsg("channels: " . implode(" ", $channels)); } if (isset($user["nicks"]) == True) { privmsg("nicks: " . implode(" ", array_keys($user["nicks"]))); } if (isset($user["account"]) == True) { privmsg("account: " . $user["account"]); } if (isset($user["prefix"]) == True) { privmsg("prefix: " . $user["prefix"]);
$items = unserialize($argv[1]); $nick = $items["nick"]; if (users_get_account($nick) == get_bot_nick()) { return; } $trailing = $items["trailing"]; $dest = strtolower($items["destination"]); $exec = users_get_data(get_bot_nick()); if (isset($exec["channels"][$dest]) == True) { if (strpos($exec["channels"][$dest], "@") === False) { return; } } else { return; } $user = users_get_data($nick); if (isset($user["channels"][$dest]) == False) { return; } var_dump($items); return; $timestamp = $items["time"]; $index = "ANTISPAM_DATA_" . $dest . "_" . $nick; $bucket = get_array_bucket($index); if (isset($bucket["timestamps"]) == False) { $bucket["timestamps"] = array(); $bucket["trailings"] = array(); } $bucket["timestamps"][] = $timestamp; $bucket["trailings"][] = $trailing; $n = count($bucket["timestamps"]);
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; }