[TASK] Code working again. Introduced basic protocol handler structures.

This commit is contained in:
Jan Philipp Timme 2010-11-28 01:24:16 +00:00
parent 3bd7a6e0f9
commit 4bbb9bf548
3 changed files with 6 additions and 5 deletions

View File

@ -41,11 +41,11 @@ abstract class Client_AbstractClient {
* Forwards incoming data to the ProtocolParser.
* Calls protected processData()
* @param string $rawData
* @return void
* @return string
*/
public function processRawData($rawData) {
$contentObject = $this->protocolHandler->parse($rawData);
$this->processContentObject($contentObject);
return $this->processContentObject($contentObject);
}
/**

View File

@ -33,6 +33,7 @@ class Client_IrcClient extends Client_AbstractClient {
* @return string
*/
public function processContentObject($contentObject) {
var_dump($contentObject);
$data = $contentObject->rawData;
//echo "[RECV] ".$data;

View File

@ -1,6 +1,6 @@
<?php
$clientManager = new Client_ClientManager();
$clientManager->registerProtocol("irc", "Client_IrcClient");
$clientManager->registerProtocol("Irc", "Client_IrcClient");
$clientManager->registerProtocol("jpt", "Client_BotClient");
$freenode = $clientManager->createTcpConnection("freenode", "Irc");
@ -30,9 +30,9 @@ $eloxoph = $clientManager->createTcpConnection("eloxoph", "irc");
$clientManager->attachConfig($config_eloxoph, $eloxoph);
$eloxoph->connect("irc.eloxoph.com", 6667);*/
$srv = $clientManager->createTcpConnection("srv", "jpt");
/*$srv = $clientManager->createTcpConnection("srv", "jpt");
$srv->bind("localhost", 7777);
$srv->listen();
$srv->listen();*/
while($clientManager->countConnections() > 0) {
$clientManager->work();