ircbot/IrcClient/Classes/BotClientDispatcher.php

58 lines
1.4 KiB
PHP
Raw Normal View History

2010-11-21 23:48:11 +01:00
<?php
namespace JPT\IrcClient;
2010-11-21 23:48:11 +01:00
/**
* BotClient class that handles the controls or whatever...edit this later...
*
2010-11-21 23:48:11 +01:00
* @author jpt
* @package Client
* @depends \JPT\SocketFramework\Client\AbstractClientDispatcher
2010-11-21 23:48:11 +01:00
*/
class BotClientDispatcher extends \JPT\SocketFramework\Client\AbstractClientDispatcher {
2010-11-21 23:48:11 +01:00
/**
* Forwards incoming data to the ProtocolHandler
* Let's the ProtocolHandler do all the work and forward its results to the Clients.
* Return resulting raw data.
*
* @param string $rawData
* @return string
2010-11-21 23:48:11 +01:00
*/
public function processRawData($rawData) {
$return = "";
if(trim($rawData) === "list") {
$return = print_r(array(
"IDs" => $this->clientManager->getIDs(),
"Groups" => $this->clientManager->getGroups()
), TRUE);
}
if(strpos($rawData, "-") !== FALSE ) {
$data = explode("-", $rawData, 2);
2010-11-21 23:48:11 +01:00
$this->clientManager->sendToID((int) $data[0], $data[1]."\r\n");
$return = print_r($data, TRUE);
}
if(strpos($rawData, "+") !== FALSE ) {
$data = explode("+", $rawData, 2);
2010-11-21 23:48:11 +01:00
$this->clientManager->sendToGroup($data[0], $data[1]."\r\n");
$return = print_r($data, TRUE);
}
//TODO: implement this correctly
$return = str_replace("\n", "\r\n", $return);
return $return;
2010-11-21 23:48:11 +01:00
}
/**
* Loads the given configuration.
* @param array $config
* @return void
*/
public function loadConfig($config) {
}
}
?>