]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Irc/ChannelResponseChannel.php
3ddad28aa9266eb8140109060b358f7da6c349c4
[quix0rs-gnu-social.git] / plugins / Irc / ChannelResponseChannel.php
1 <?php\r
2 /**\r
3  * StatusNet, the distributed open-source microblogging tool\r
4  *\r
5  * Extend the IMChannel class to allow commands to send messages\r
6  * to a channel instead of PMing a user\r
7  *\r
8  * PHP version 5\r
9  *\r
10  * LICENCE: This program is free software: you can redistribute it and/or modify\r
11  * it under the terms of the GNU Affero General Public License as published by\r
12  * the Free Software Foundation, either version 3 of the License, or\r
13  * (at your option) any later version.\r
14  *\r
15  * This program is distributed in the hope that it will be useful,\r
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
18  * GNU Affero General Public License for more details.\r
19  *\r
20  * You should have received a copy of the GNU Affero General Public License\r
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
22  *\r
23  * @category  Network\r
24  * @package   StatusNet\r
25  * @author    Luke Fitzgerald <lw.fitzgerald@googlemail.com>\r
26  * @copyright 2010 StatusNet, Inc.\r
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0\r
28  * @link      http://status.net/\r
29  */\r
30 \r
31 if (!defined('STATUSNET') && !defined('LACONICA')) {\r
32     exit(1);\r
33 }\r
34 \r
35 class ChannelResponseChannel extends IMChannel {\r
36     protected $ircChannel;\r
37 \r
38     /**\r
39     * Construct a ChannelResponseChannel\r
40     *\r
41     * @param IMplugin $imPlugin IMPlugin\r
42     * @param string $ircChannel IRC Channel to reply to\r
43     * @return ChannelResponseChannel\r
44     */\r
45     public function __construct($imPlugin, $ircChannel) {\r
46         $this->ircChannel = $ircChannel;\r
47         parent::__construct($imPlugin);\r
48     }\r
49 \r
50     /**\r
51     * Send a message using the plugin\r
52     *\r
53     * @param User $user User\r
54     * @param string $text Message text\r
55     * @return void\r
56     */\r
57     public function output($user, $text) {\r
58         $text = $user->nickname.': ['.common_config('site', 'name') . '] ' . $text;\r
59         $this->imPlugin->sendMessage($this->ircChannel, $text);\r
60     }\r
61 }\r