]> git.mxchange.org Git - friendica-addons.git/blob - irc/irc.php
065e48080d81a4726ead6048b19dcab7327e71ae
[friendica-addons.git] / irc / irc.php
1 <?php
2 /**
3 * Name: IRC Chat Plugin
4 * Description: add an Internet Relay Chat chatroom
5 * Version: 1.0
6 * Author: tony baldwin <https://free-haven.org/profile/tony>
7 */
8
9 /* enable in admin->plugins
10  * you will then have "irc chatroom" listed at yoursite/apps
11  * and the app will run at yoursite/irc
12  * documentation at http://tonybaldwin.me/hax/doku.php?id=friendica:irc
13  */
14
15 function irc_install() {
16 register_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
17 }
18
19 function irc_uninstall() {
20 unregister_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
21
22 }
23
24 function irc_app_menu($a,&$b) {
25 $b['app_menu'][] = '<div class="app-title"><a href="irc">' . t('IRC Chatroom') . '</a></div>';
26 }
27
28
29 function irc_module() {
30 return;
31 }
32
33
34 function irc_content(&$a) {
35
36         $baseurl = $a->get_baseurl() . '/addon/irc';
37         $o = '';
38
39         $sitechats = get_config('irc','channels');
40         if($sitechats)
41                 $chats = explode(',',$sitechats);
42         else
43                 $chats = array('friendica','chat','chatback','hottub','ircbar','dateroom','teentalk');
44
45
46         $a->page['aside'] .= '<div class="widget"><h3>' . t('Popular Channels') . '</h3><ul>';
47         foreach($chats as $chat) {
48                 $a->page['aside'] .= '<li><a href="' . $a->get_baseurl() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>';
49         }
50         $a->page['aside'] .= '</ul></div>';
51
52
53
54
55
56 $channels = ((x($_GET,'channels')) ? $_GET['channels'] : 'friendica');
57
58 /* add the chatroom frame and some html
59  * by altering the "channels=friendica" part of the URL, you can add/remove channels.  
60  * At free-haven.org, I have "?channels=friendica,free-haven", for instance, to open #friendica and #free-haven
61  */
62   $o .= <<< EOT
63 <h2>IRC chat</h2>
64 <p><a href="http://tldp.org/HOWTO/IRC/beginners.html" target="_blank">A beginner's guide to using IRC. [en]</a></p>
65 <iframe src="http://webchat.freenode.net?channels=$channels" width="600" height="600"></iframe>
66 EOT;
67
68 return $o;
69     
70 }
71
72