[TASK] Implemented the ProtocolHandler things so it works again.
[TASK] Added some comments. [TASK] Added TODOs concerning refactoring and more functions that are needed.
This commit is contained in:
@@ -58,14 +58,17 @@ abstract class Client_AbstractClient {
|
||||
|
||||
/**
|
||||
* This function will be the main entry point of any client.
|
||||
* Any reactions will be passed to the ProtocolHandler.
|
||||
* The ProtocolHandler will then pass the data back to the socket.
|
||||
* @param string $data
|
||||
* @return string
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function processContentObject($contentObject);
|
||||
|
||||
/**
|
||||
* This function will load the given config.
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
abstract public function loadConfig($config);
|
||||
|
||||
@@ -81,6 +84,7 @@ abstract class Client_AbstractClient {
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function setID($id) {
|
||||
$this->ID = $id;
|
||||
@@ -88,6 +92,7 @@ abstract class Client_AbstractClient {
|
||||
|
||||
/**
|
||||
* @param string $group
|
||||
* @return void
|
||||
*/
|
||||
public function setGroup($group) {
|
||||
$this->group = $group;
|
||||
@@ -96,6 +101,7 @@ abstract class Client_AbstractClient {
|
||||
/**
|
||||
* Injects ClientManager
|
||||
* @param Client_ClientManager $clientManager
|
||||
* @return void
|
||||
* @throws Exception_WrongDatatypeException
|
||||
*/
|
||||
public function injectClientManager($clientManager) {
|
||||
|
||||
@@ -34,7 +34,8 @@ class Client_BotClient extends Client_AbstractClient {
|
||||
$return = print_r($data, TRUE);
|
||||
}
|
||||
|
||||
return $return;
|
||||
//TODO: implement this correctly
|
||||
$this->protocolHandler->sendRaw($return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,16 +61,18 @@ class Client_ClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Implement a function that is able to count active connections instead of sockets!
|
||||
* @see Connection_ConnectionPool
|
||||
* @return int
|
||||
*/
|
||||
public function countConnections() {
|
||||
return $this->connectionPool->countConnections();
|
||||
public function countSockets() {
|
||||
return $this->connectionPool->countSockets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Main worker function.
|
||||
* Processes incoming data, calls clients and much more.
|
||||
* TODO: refactor this? (split it into handleFoobar() functions)
|
||||
* @return void
|
||||
*/
|
||||
public function work() {
|
||||
|
||||
@@ -39,7 +39,7 @@ class Client_IrcClient extends Client_AbstractClient {
|
||||
* Processes the resulting ContentObject from a ProtocolHandler.
|
||||
* Does all the hard work.
|
||||
* @param string $data
|
||||
* @return string
|
||||
* @return void
|
||||
*/
|
||||
public function processContentObject($contentObject) {
|
||||
$data = $contentObject->rawData;
|
||||
@@ -68,8 +68,8 @@ class Client_IrcClient extends Client_AbstractClient {
|
||||
$return .= "QUIT :lol\r\n";
|
||||
}
|
||||
|
||||
//if($return !== "") echo "[SEND] ".$return;
|
||||
return $return;
|
||||
//workaround. will be removed soon
|
||||
$this->protocolHandler->sendRaw($return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user