2010-11-21 23:48:11 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* IrcClient class that contains all the Plugins
|
|
|
|
* @author jpt
|
|
|
|
* @package Client
|
|
|
|
* @depends Client_AbstractClient
|
|
|
|
*/
|
|
|
|
class Client_BotClient extends Client_AbstractClient {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default constructor.
|
2010-12-19 15:26:32 +01:00
|
|
|
* @return void
|
2010-11-21 23:48:11 +01:00
|
|
|
*/
|
2010-12-18 15:42:56 +01:00
|
|
|
public function __construct() {
|
2010-11-21 23:48:11 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Does all the hard work.
|
2011-06-26 00:13:53 +02:00
|
|
|
* @param object $contentObject
|
|
|
|
* @return void
|
2010-11-21 23:48:11 +01:00
|
|
|
*/
|
2010-11-28 02:15:20 +01:00
|
|
|
public function processContentObject($contentObject) {
|
2010-11-28 03:45:25 +01:00
|
|
|
$return = "";
|
2011-06-26 00:13:53 +02:00
|
|
|
$rawData = $contentObject->getRawData();
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-06-26 00:13:53 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-12-08 17:47:04 +01:00
|
|
|
//TODO: implement this correctly
|
2011-06-26 00:13:53 +02:00
|
|
|
$return = str_replace("\n", "\r\n", $return);
|
2010-12-08 17:47:04 +01:00
|
|
|
$this->protocolHandler->sendRaw($return);
|
2010-11-21 23:48:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the given configuration.
|
|
|
|
* @param array $config
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function loadConfig($config) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|