From ff8ee6fb2250d2188962f4b27de91b89465cc3d5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 10 Oct 2017 22:02:22 -0700 Subject: for federated forums we need to keep track of what protocols are available to red/hubzilla channels to determine which posts need to be mangled for transport to individual networks - based on what networks the author can communicate with. We probably need this for all xchans and hublocs but at some point it becomes increasingly difficult to scrape this information and map out a compatibility matrix. It's also doubtful anybody will use this system because we basically have to forge comments between network sites involving different protocols and this is going to look like crap to anybody that isn't on red/Hubzilla. Eventually they have to fix their protocols for this to work correctly, but nobody seems to believe me that their networks are basically anti-federation, so we need something like this to highlight their walled garden specifications and the resulting federation problems in a form they can't really argue with. --- include/zot.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/zot.php b/include/zot.php index af7fbf8fd..b6df6bca8 100644 --- a/include/zot.php +++ b/include/zot.php @@ -718,6 +718,16 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) { if(intval($r[0]['xchan_pubforum']) != intval($arr['public_forum'])) $pubforum_changed = 1; + if($arr['protocols']) { + $protocols = implode(',',$arr['protocols']); + if($protocols !== 'zot') { + set_xconfig($xchan_hash,'system','protocols',$protocols); + } + else { + del_xconfig($xchan_hash,'system','protocols'); + } + } + if(($r[0]['xchan_name_date'] != $arr['name_updated']) || ($r[0]['xchan_connurl'] != $arr['connections_url']) || ($r[0]['xchan_addr'] != $arr['address']) @@ -4035,6 +4045,11 @@ function zotinfo($arr) { $id = $e['channel_id']; + $x = [ 'channel_id' => $id, 'protocols' => 'zot' ]; + call_hooks('channel_protocols',$x); + $protocols = $x['protocols']; + + $sys_channel = (intval($e['channel_system']) ? true : false); $special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false); $adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false); @@ -4135,6 +4150,7 @@ function zotinfo($arr) { $ret['target'] = $ztarget; $ret['target_sig'] = $zsig; $ret['searchable'] = $searchable; + $ret['protocols'] = $protocols; $ret['adult_content'] = $adult_channel; $ret['public_forum'] = $public_forum; if($deleted) -- cgit v1.2.3