Example #1
0
function register_channel()
{
    global $trailing;
    global $dest;
    global $game_data;
    global $irciv_data_changed;
    $all_channels = users_get_all_channels();
    # seems to be needed to kick the users bucket into gear
    irciv_term_echo("trailing = \"{$trailing}\"");
    $channel = "";
    if ($trailing != "") {
        irciv_privmsg("syntax: [~civ] register-channel");
        return;
    }
    $channel = strtolower($dest);
    if ($channel == "") {
        irciv_term_echo("error: channel not specified");
        return;
    }
    if (users_chan_exists($channel) == False) {
        irciv_privmsg("error: channel \"{$channel}\" not found");
        return;
    }
    if (isset($game_data["map"]) == True) {
        irciv_privmsg("error: existing map data found");
        return;
    }
    $map_data = generate_map_data();
    $game_data["map"] = $map_data;
    $game_data["players"] = array();
    $irciv_data_changed = True;
    $msg = "map generated for channel \"{$channel}\"";
    if ($trailing != "") {
        irciv_privmsg_dest($trailing, $msg);
    }
    if ($dest != "" and $dest != $trailing) {
        irciv_privmsg($msg);
    }
}
Example #2
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);
        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];
Example #3
0
function users_chan_exists($channel)
{
    $channels = users_get_all_channels();
    if (in_array($channel, $channels) == True) {
        return True;
    } else {
        return False;
    }
}