aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-03 16:41:40 -0700
committerredmatrix <git@macgirvin.com>2016-04-03 16:41:40 -0700
commitbf3f3564e08754c3f91524798523839ae7b9094c (patch)
treef1da047c364df5de64eb9467663787d2e5c6c0b3
parent102d41ccb96f67363d50941f5ce4ca9bfd2ae6d5 (diff)
downloadvolse-hubzilla-bf3f3564e08754c3f91524798523839ae7b9094c.tar.gz
volse-hubzilla-bf3f3564e08754c3f91524798523839ae7b9094c.tar.bz2
volse-hubzilla-bf3f3564e08754c3f91524798523839ae7b9094c.zip
issue #138 ; make ajaxchat optional and configurable. For reasons we've discussed repeatedly the ajax chat will not be removed from core as XMPP chat does not provide decentralised access control compatible with nomadic identity.
-rw-r--r--include/conversation.php3
-rw-r--r--include/features.php2
-rw-r--r--include/nav.php2
-rw-r--r--include/widgets.php8
-rw-r--r--mod/chat.php6
5 files changed, 18 insertions, 3 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 829e85382..5e9ba16a1 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1592,6 +1592,7 @@ function network_tabs() {
function profile_tabs($a, $is_owner = false, $nickname = null){
// Don't provide any profile tabs if we're running as the sys channel
+
if (App::$is_sys)
return;
@@ -1669,7 +1670,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
}
- if ($p['chat']) {
+ if ($p['chat'] && feature_enabled($uid,'ajaxchat')) {
require_once('include/chat.php');
$has_chats = chatroom_list_count($uid);
if ($has_chats) {
diff --git a/include/features.php b/include/features.php
index ff6b71d4c..38700f9f5 100644
--- a/include/features.php
+++ b/include/features.php
@@ -56,7 +56,7 @@ function get_features($filtered = true) {
array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),
array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')),
-
+ array('ajaxchat', t('Access Controlled Chatrooms'), t('Provide chatrooms and chat services with access control.'),true,get_config('feature_lock','ajaxchat')),
array('smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'),true,get_config('feature_lock','smart_birthdays')),
array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')),
array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')),
diff --git a/include/nav.php b/include/nav.php
index 3f5c7963a..201882fd1 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -92,7 +92,7 @@ EOT;
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
- if(! UNO)
+ if((! UNO) && feature_enabled(local_channel(),'ajaxchat'))
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
diff --git a/include/widgets.php b/include/widgets.php
index 0116e5bd1..0355ebd8c 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -785,6 +785,7 @@ function widget_menu_preview($arr) {
function widget_chatroom_list($arr) {
+
require_once("include/chat.php");
$r = chatroom_list(App::$profile['profile_uid']);
@@ -808,6 +809,10 @@ function widget_chatroom_members() {
}
function widget_bookmarkedchats($arr) {
+
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
+ return '';
+
$h = get_observer_hash();
if(! $h)
return;
@@ -827,6 +832,9 @@ function widget_bookmarkedchats($arr) {
function widget_suggestedchats($arr) {
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
+ return '';
+
// probably should restrict this to your friends, but then the widget will only work
// if you are logged in locally.
diff --git a/mod/chat.php b/mod/chat.php
index 75c364008..375d069be 100644
--- a/mod/chat.php
+++ b/mod/chat.php
@@ -208,6 +208,12 @@ function chat_content(&$a) {
$o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']);
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat')) {
+ notice( t('Feature disabled.') . EOL);
+ return $o;
+ }
+
+
$acl = new Zotlabs\Access\AccessList($channel);
$channel_acl = $acl->get();