Esempio n. 1
0
function kill($who, $reason)
{
    global $channels, $conn, $u_info;
    $sentto = array($who);
    // Who received a QUIT packet already?
    foreach ($channels as &$channel) {
        if (in_array($who, $channel['nicks'])) {
            foreach ($channel['nicks'] as $user) {
                if (!in_array($user, $sentto)) {
                    send($user, ':' . $who['nick'] . '!' . $who['ident'] . '@' . $u_info[$who['sock']]['cloak'] . ' QUIT :' . $reason);
                    $sentto[] = $user;
                }
            }
            nick_removal($who['nick'], $channel['nicks']);
            // Remove the killed user from the channel
        }
    }
    send($who, 'ERROR :Closing Link: ' . $who['nick'] . '[' . $who['host'] . '] (' . $reason . ')');
    socket_close($who['sock']);
    // Close socket
    array_removal($u_info[$who['sock']], $u_info);
    // Remove from the info array - part of the bugfix stated above
    array_removal($who, $conn);
    // Remove socket from listing
}
Esempio n. 2
0
                        $names .= $chars . $user['nick'] . ' ';
                    }
                }
                send($me, ':' . $config['name'] . ' 353 ' . $me['nick'] . ' = ' . $target . ' :' . $names);
                send($me, ':' . $config['name'] . ' 366 ' . $me['nick'] . ' ' . $target . ' :End of /NAMES list.');
                break;
            case 'ping':
                // PONG DAMNIT!
                if (strpos($args[1], ':') === false) {
                    $args[1] = ':' . $args[1];
                }
                send($me, ':' . $config['name'] . ' PONG ' . $config['name'] . ' ' . $args[1]);
                break;
                // tabbing jumps
        }
        // select
    }
    // while
    // closed?
    $error = socket_last_error($me['sock']);
    //echo $error;
    if ($error == 10053 || $error == 10054 || $error === false) {
        // he failed.
        echo $me['nick'] . " has died.\r\n";
        kill($me, 'Something failed...');
        array_removal($me, $conn);
    }
}
// foreach
sleep(1);
// 100% CPU ftl