예제 #1
0
function handle_events(&$items)
{
    $cmd = strtoupper(trim($items["cmd"]));
    switch ($cmd) {
        case "PRIVMSG":
            handle_privmsg($items);
            break;
        case "JOIN":
            handle_join($items);
            break;
        case "KICK":
            handle_kick($items);
            break;
        case "KILL":
            handle_kill($items);
            break;
        case "NICK":
            handle_nick($items);
            break;
        case "PART":
            handle_part($items);
            break;
        case "QUIT":
            handle_quit($items);
            break;
        case "311":
            handle_311($items);
            break;
        case "319":
            handle_319($items);
            break;
        case "330":
            handle_330($items);
            break;
        case "353":
            handle_353($items);
            break;
    }
    script_event_handlers($cmd, $items);
}
예제 #2
0
        break;
    case "event-kick":
        # trailing = <channel> <nick>
        break;
    case "event-nick":
        # trailing = <old-nick> <new-nick>
        break;
    case "event-part":
        # trailing = <nick> <channel>
        break;
    case "event-quit":
        # trailing = <nick>
        break;
    case "event-privmsg":
        # trailing = <nick> <channel> <trailing>
        handle_privmsg($parts, $channel_data);
        break;
}
set_array_bucket($channel_data, "channel_data");
#####################################################################################################
function handle_privmsg($parts, &$channel_data)
{
    if (count($parts) < 3) {
        return;
    }
    # trailing = <nick> <channel> <trailing>
    $nick = strtolower($parts[0]);
    $channel = strtolower($parts[1]);
    array_shift($parts);
    array_shift($parts);
    $trailing = trim(implode(" ", $parts));