[TASK] Removed all the protocol handlers. [TASK] Clients are no longer part of the SocketFramework itself. [TASK] The Framework provides an "interface" to external clients - the ClientDispatcher. [TASK] Added the Core package and added a better ClassLoader. [TASK] Created a bootstrap module to include in other projects. [TASK] Cleaned up comments, reformatted them.
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * IrcClient class that contains all the Plugins
 | 
						|
 * @author jpt
 | 
						|
 * @package Client
 | 
						|
 * @depends Client_AbstractClient
 | 
						|
 */
 | 
						|
class Client_BotClient extends Client_AbstractClient {
 | 
						|
 | 
						|
	/**
 | 
						|
	 * Default constructor.
 | 
						|
	 * @return void
 | 
						|
	 */
 | 
						|
	public function __construct() {
 | 
						|
 | 
						|
	}
 | 
						|
 | 
						|
	/**
 | 
						|
	 * Does all the hard work.
 | 
						|
	 * @param object $contentObject
 | 
						|
	 * @return void
 | 
						|
	 */
 | 
						|
	public function processContentObject($contentObject) {
 | 
						|
		$return = "";
 | 
						|
		$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($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);
 | 
						|
	}
 | 
						|
 | 
						|
	/**
 | 
						|
	 * Loads the given configuration.
 | 
						|
	 * @param array $config
 | 
						|
	 * @return void
 | 
						|
	 */
 | 
						|
	public function loadConfig($config) {
 | 
						|
 | 
						|
	}
 | 
						|
 | 
						|
}
 | 
						|
?>
 |