[TASK] Added function for clients, so they're able to send initial data right after connecting to a server.
[TASK] Restructured parts of the core to support sending data right after connecting. [TASK] Adapted core part for automatic reconnect to support sending initial data, too.
This commit is contained in:
@@ -17,25 +17,31 @@ class Client_BotClient extends Client_AbstractClient {
|
||||
|
||||
/**
|
||||
* Does all the hard work.
|
||||
* @param string $data
|
||||
* @return string
|
||||
* @param object $contentObject
|
||||
* @return void
|
||||
*/
|
||||
public function processContentObject($contentObject) {
|
||||
$return = "";
|
||||
$data = $contentObject->getRawData();
|
||||
if(strpos($data, "-") !== FALSE ) {
|
||||
$data = explode("-", $data, 2);
|
||||
$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);
|
||||
$this->clientManager->sendToID((int) $data[0], $data[1]."\r\n");
|
||||
$return = print_r($data, TRUE);
|
||||
}
|
||||
|
||||
if(strpos($data, "+") !== FALSE ) {
|
||||
$data = explode("+", $data, 2);
|
||||
if(strpos($rawData, "+") !== FALSE ) {
|
||||
$data = explode("+", $rawData, 2);
|
||||
$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);
|
||||
$this->protocolHandler->sendRaw($return);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user