+++ /dev/null
-<?php\r
-/**\r
- * StatusNet - the distributed open-source microblogging tool\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU Affero General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Affero General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Affero General Public License\r
- * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- *\r
- * Extends the bot class (Phergie_Bot) to allow connection and access to\r
- * sockets and to allow StatusNet to 'drive' the bot\r
- *\r
- * @category Phergie\r
- * @package Phergie_StatusnetBot\r
- * @author Luke Fitzgerald <lw.fitzgerald@googlemail.com>\r
- * @copyright 2010 StatusNet, Inc.\r
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0\r
- * @link http://status.net/\r
- */\r
-class Phergie_StatusnetBot extends Phergie_Bot {\r
- /**\r
- * Set up bot and connect to servers\r
- *\r
- * @return void\r
- */\r
- public function connect() {\r
- $ui = $this->getUi();\r
- $ui->setEnabled($this->getConfig('ui.enabled'));\r
-\r
- $this->loadPlugins();\r
- $this->loadConnections();\r
- }\r
-\r
- /**\r
- * Transmit raw command to server using driver\r
- *\r
- * Handles construction of command strings and their transmission to the\r
- * server.\r
- *\r
- * @param string $command Command to send\r
- * @param string|array $args Optional string or array of sequential\r
- * arguments\r
- *\r
- * @return string Command string that was sent\r
- * @throws Phergie_Driver_Exception\r
- */\r
- public function send($command, $args = '') {\r
- return $this->getDriver()->send($command, $args);\r
- }\r
-\r
- /**\r
- * Handle incoming data on the socket using the handleEvents\r
- * method of the Processor\r
- *\r
- * @return void\r
- */\r
- public function handleEvents() {\r
- $this->getProcessor()->handleEvents();\r
- }\r
-\r
- /**\r
- * Close the current connection and reconnect to the server\r
- *\r
- * @return void\r
- */\r
- public function reconnect() {\r
- $driver = $this->getDriver();\r
- $sockets = $driver->getSockets();\r
-\r
- // Close any existing connections\r
- try {\r
- $driver->forceQuit();\r
- } catch (Phergie_Driver_Exception $e){}\r
- try {\r
- $driver->doConnect();\r
- } catch (Phergie_Driver_Exception $e){\r
- $driver->forceQuit();\r
- throw $e;\r
- }\r
- }\r
-\r
- /**\r
- * Get the sockets used by the bot\r
- *\r
- * @return array Array of socket resources\r
- */\r
- public function getSockets() {\r
- return $this->getDriver()->getSockets();\r
- }\r
-}
\ No newline at end of file