From db9dda856c664252b5174fe794e9db2217de964a Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sun, 28 Nov 2010 16:51:43 +0000 Subject: [PATCH] [TASK] Code cleanup and some small documentation. --- TODO => BRAINSTORM | 5 +---- Classes/Client/ClientManager.php | 6 +++--- Classes/Connection/ConnectionPool.php | 2 +- Main.php | 1 - README | 17 +++++++++++++++++ start.sh | 1 + update-docs.sh | 1 + 7 files changed, 24 insertions(+), 9 deletions(-) rename TODO => BRAINSTORM (79%) create mode 100644 README diff --git a/TODO b/BRAINSTORM similarity index 79% rename from TODO rename to BRAINSTORM index e92d6a7..6f7d7b9 100644 --- a/TODO +++ b/BRAINSTORM @@ -7,10 +7,7 @@ - Logging auf Verbindungs/Channel und Verbindung/Query-Basis für IRC. - RAW-Logging für den Rest? -- Settings?! - -" I'll ask Lucene about that ;-)" - +" I'll ask Lucene about that ;-)" -> Logfiles durchsuchen nach nick, zeit,... - Logging mit Timestamp für: - Sollte das Teil mal abkacken, so will ich zumindest über Verbindungsabbrüche, diff --git a/Classes/Client/ClientManager.php b/Classes/Client/ClientManager.php index 0ff4708..e069ccb 100644 --- a/Classes/Client/ClientManager.php +++ b/Classes/Client/ClientManager.php @@ -90,8 +90,8 @@ class Client_ClientManager { //assign the client to the new connectionHandler. $this->clientPool[$newConnectionHandler->getID()] = $client; //get the config and assign it to the new connectionHandler, too. - $config = $this->configPool[$connectionHandler->getID()]; - $this->configPool[$newConnectionHandler->getID()] = $config; + $config = $this->configPool[$connectionHandler->getID()]; + $this->configPool[$newConnectionHandler->getID()] = $config; //remove old connection $this->removeConnection($connectionHandler); } @@ -109,7 +109,7 @@ class Client_ClientManager { } //call the registered client if(isset($this->clientPool[$connectionHandler->getID()])) { - //let the client process the data, send the results back. + //let the client process the data, send the results back. while($data = $connectionHandler->read()) { $result = $this->clientPool[$connectionHandler->getID()]->processRawData($data); if($result !== "") { diff --git a/Classes/Connection/ConnectionPool.php b/Classes/Connection/ConnectionPool.php index da9722a..327f582 100644 --- a/Classes/Connection/ConnectionPool.php +++ b/Classes/Connection/ConnectionPool.php @@ -111,7 +111,7 @@ class Connection_ConnectionPool { if($connectionHandler->canWrite() && $connectionHandler->isServer() === FALSE) $write[] = $connectionSocket; } $except = $read; - + //Arrays are prepared, let's have socket_select() take a look and process its results. $tempArray = array(); $selectedSockets = $this->socketPool->select($read, $write, $except); foreach($selectedSockets AS $selectedType=>$selectedArray) { //read, write, except, this loop won't kill performance diff --git a/Main.php b/Main.php index 8f3723d..8554bfc 100644 --- a/Main.php +++ b/Main.php @@ -3,7 +3,6 @@ error_reporting(E_ALL); require_once('AutoLoader.php'); try { - //require_once('Testcode/Connection/IrcClientTest.php'); require_once('Testcode/Client/ClientManagerTest.php'); } catch(Exception $e) { diff --git a/README b/README new file mode 100644 index 0000000..59d33aa --- /dev/null +++ b/README @@ -0,0 +1,17 @@ +# General +This multiserver-ircbot is based on an advanced socket-driven framework. +It's still in beta, but the basics are working. + + +# Running the bot +To run it, simply type ./start.sh into your console. + + +# Documentation +The documentation is not in the svn, but you can easily create it using the existing Doxyfile with doxygen. +Simply run ./update-docs.sh and - if doxygen + dot are installed - you'll have a perfectly fine documentation. +The Code itself should also give you an idea of how this works :-) + + +# License +This project is a private one, i don't know what license i will use yet. \ No newline at end of file diff --git a/start.sh b/start.sh index 396eb9e..107c688 100755 --- a/start.sh +++ b/start.sh @@ -1 +1,2 @@ +#!/bin/bash clear && php Main.php \ No newline at end of file diff --git a/update-docs.sh b/update-docs.sh index a761032..13c3fad 100755 --- a/update-docs.sh +++ b/update-docs.sh @@ -1 +1,2 @@ +#!/bin/bash doxygen \ No newline at end of file