aboutsummaryrefslogtreecommitdiffstats
path: root/mod/chat.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-29 17:09:20 -0800
committerfriendica <info@friendica.com>2014-01-29 17:09:20 -0800
commitb8fb6a437335ce16e658f8acda632916bb28e574 (patch)
treef1c4c0349eb06d2077fae874f52bf6d57ca5ebde /mod/chat.php
parent677f5f641e6c37244ee67459b6fa2c7e5aea119b (diff)
downloadvolse-hubzilla-b8fb6a437335ce16e658f8acda632916bb28e574.tar.gz
volse-hubzilla-b8fb6a437335ce16e658f8acda632916bb28e574.tar.bz2
volse-hubzilla-b8fb6a437335ce16e658f8acda632916bb28e574.zip
more chat infrastructure
Diffstat (limited to 'mod/chat.php')
-rw-r--r--mod/chat.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/mod/chat.php b/mod/chat.php
new file mode 100644
index 000000000..bc981b76b
--- /dev/null
+++ b/mod/chat.php
@@ -0,0 +1,62 @@
+<?php /** @file */
+
+require_once('include/chat.php');
+
+function chat_init(&$a) {
+
+ $which = null;
+ if(argc() > 1)
+ $which = argv(1);
+ if(! $which) {
+ if(local_user()) {
+ $channel = $a->get_channel();
+ if($channel && $channel['channel_address'])
+ $which = $channel['channel_address'];
+ }
+ }
+ if(! $which) {
+ notice( t('You must be logged in to see this page.') . EOL );
+ return;
+ }
+
+ $profile = 0;
+ $channel = $a->get_channel();
+
+ if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
+ $which = $channel['channel_address'];
+ $profile = argv(1);
+ }
+
+ $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
+
+ // Run profile_load() here to make sure the theme is set before
+ // we start loading content
+
+ profile_load($a,$which,$profile);
+
+}
+
+
+function chat_content(&$a) {
+
+ if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'chat')) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) {
+ chatroom_leave(get_observer_hash(),$room_id,$_SERVER['REMOTE_ADDR']);
+ goaway(z_root() . '/channel/' . argv(1));
+ }
+
+
+ if(argc() > 2 && intval(argv(2))) {
+ $room_id = intval(argv(2));
+ $x = chatroom_enter(get_observer_hash(),$room_id,'online',$_SERVER['REMOTE_ADDR']);
+ if(! $x)
+ return;
+ $o = replace_macros(get_markup_template('chat.tpl'),array());
+ return $o;
+ }
+
+} \ No newline at end of file