示例#1
0
文件: server.php 项目: laiello/zircd
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
}
示例#2
0
             send($me, ':' . $config['name'] . ' 442 ' . $me['nick'] . ' ' . $target . ' :You\'re not on that channel');
             break;
         }
         foreach ($channel['nicks'] as $user) {
             // Tell everyone about the part! But not about the whole.
             send($user, ':' . $me['nick'] . '!' . $me['ident'] . '@' . $u_info[$me['sock']]['cloak'] . ' PART ' . $target . $message);
         }
     } else {
         // NO RLY
         send($me, ':' . $config['name'] . ' 403 ' . $me['nick'] . ' ' . $target . ' :No such channel');
         break;
     }
     // Remove from channel listings. We need to search all the modes arrays too.
     $arrs = array('nicks', 'owners', 'protected', 'oped', 'halfoped', 'voiced');
     foreach ($arrs as $arr) {
         nick_removal($me['nick'], $channel[$arr]);
     }
     $channels[strtolower($target)] = $channel;
     // Might not be needed if I used a & up there ^^ but who cares?
     break;
 case 'names':
     $target = $args[1];
     $names = '';
     if (isset($channels[strtolower($target)])) {
         // If channel exists....
         $channel = $channels[strtolower($target)];
         foreach ($channel['nicks'] as $user) {
             // Build list.
             $chars = '';
             $search = array('~' => 'owners', '&' => 'owners', '@' => 'oped', '%' => 'halfoped', '+' => 'voiced');
             foreach ($search as $search_char => $search_name) {