/** * Accept a queued input message. * * @return true if processing completed, false if message should be reprocessed */ function receiveRawMessage($message) { $info = Aim::getMessageInfo($message); $from = $info['from']; $user = $this->getUser($from); $notice_text = $info['message']; $this->handleIncoming($from, $notice_text); return true; }
* @subpackage plugins-aim */ /** * Initialization */ $_SERVER['SCRIPT_URL'] = __FILE__; $_SERVER['REQUEST_URI'] = __FILE__; $_SERVER['REQUEST_METHOD'] = ''; $_SERVER['SERVER_PROTOCOL'] = ''; $_SERVER['HTTP_HOST'] = ''; $_SERVER['HTTP_USER_AGENT'] = 'console'; $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER['SERVER_ADDR'] = '127.0.0.1'; require_once '../../../kernel/setup_inc.php'; require_once 'Aim.php'; $aimClient = new Aim($gBitSystem->getConfig('switchboard_aim_screenname'), $gBitSystem->getConfig('switchboard_aim_password'), 4); $aimClient->myServer = $gBitSystem->getConfig('switchboard_aim_server', 'aimexpress.oscar.aol.com'); // "toc-m08.blue.aol.com" ); //$aimClient->registerHandler("IMIn","ImINHand"); //$aimClient->registerHandler("Rvous","OnRvousIn"); //$aimClient->registerHandler("DimIn","onDimIn"); //$aimClient->registerHandler("ChatInvite","chatInvite"); //$aimClient->registerHandler("ChatIn","chatMessage"); //$aimClient->registerHandler("CatchAll","onFallThrough"); $aimClient->registerHandler("Error", "switchboard_aim_error"); $aimClient->signon(); $aimClient->setProfile('', true); /* Based on submitted code at http://us.php.net/manual/en/function.stream-socket-server.php Use stream_socket_server and stream_select() to make a server that accepts more than one connections (can have many clients connected): In master we hold all opened connections. Just before calling stream select we copy the array to $activeSockets and then pass it ot stream_select(). In case that we may read from at least one socket, $activeSockets will contain socket descriptors. $allSockets is needed not to lose references to the opened connections we have.