]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Irc/extlib/phergie/Phergie/Driver/Statusnet.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / plugins / Irc / extlib / phergie / Phergie / Driver / Statusnet.php
1 <?php\r
2 /**\r
3  * StatusNet - the distributed open-source microblogging tool\r
4  *\r
5  * This program is free software: you can redistribute it and/or modify\r
6  * it under the terms of the GNU Affero General Public License as published by\r
7  * the Free Software Foundation, either version 3 of the License, or\r
8  * (at your option) any later version.\r
9  *\r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU Affero General Public License for more details.\r
14  *\r
15  * You should have received a copy of the GNU Affero General Public License\r
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
17  *\r
18  * Extends the Streams driver (Phergie_Driver_Streams) to give external access\r
19  * to the socket resources and send method\r
20  *\r
21  * @category  Phergie\r
22  * @package   Phergie_Driver_Statusnet\r
23  * @author    Luke Fitzgerald <lw.fitzgerald@googlemail.com>\r
24  * @copyright 2010 StatusNet, Inc.\r
25  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0\r
26  * @link      http://status.net/\r
27  */\r
28 \r
29 class Phergie_Driver_Statusnet extends Phergie_Driver_Streams {\r
30     /**\r
31      * Handles construction of command strings and their transmission to the\r
32      * server.\r
33      *\r
34      * @param string       $command Command to send\r
35      * @param string|array $args    Optional string or array of sequential\r
36      *        arguments\r
37      *\r
38      * @return string Command string that was sent\r
39      * @throws Phergie_Driver_Exception\r
40      */\r
41     public function send($command, $args = '') {\r
42         return parent::send($command, $args);\r
43     }\r
44 \r
45     public function forceQuit() {\r
46         try {\r
47             // Send a QUIT command to the server\r
48             $this->send('QUIT', 'Reconnecting');\r
49         } catch (Phergie_Driver_Exception $e){}\r
50 \r
51         // Terminate the socket connection\r
52         fclose($this->socket);\r
53 \r
54         // Remove the socket from the internal socket list\r
55         unset($this->sockets[(string) $this->getConnection()->getHostmask()]);\r
56     }\r
57 \r
58     /**\r
59     * Returns the array of sockets\r
60     *\r
61     * @return array Array of socket resources\r
62     */\r
63     public function getSockets() {\r
64         return $this->sockets;\r
65     }\r
66 }