The Matrix and XMPP address is now transported via AP as well

This commit is contained in:
Michael 2021-08-10 23:49:09 +00:00
parent 56ee1a211f
commit ce46ab2573
6 changed files with 33 additions and 2 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2021.09-dev (Siberian Iris) -- Friendica 2021.09-dev (Siberian Iris)
-- DB_UPDATE_VERSION 1432 -- DB_UPDATE_VERSION 1433
-- ------------------------------------------ -- ------------------------------------------
@ -332,6 +332,8 @@ CREATE TABLE IF NOT EXISTS `apcontact` (
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '', `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`name` varchar(255) COMMENT '', `name` varchar(255) COMMENT '',
`about` text COMMENT '', `about` text COMMENT '',
`xmpp` varchar(255) COMMENT 'XMPP address',
`matrix` varchar(255) COMMENT 'Matrix address',
`photo` varchar(255) COMMENT '', `photo` varchar(255) COMMENT '',
`header` varchar(255) COMMENT 'Header picture', `header` varchar(255) COMMENT 'Header picture',
`addr` varchar(255) COMMENT '', `addr` varchar(255) COMMENT '',

View file

@ -22,6 +22,8 @@ Fields
| nick | | varchar(255) | NO | | | | | nick | | varchar(255) | NO | | | |
| name | | varchar(255) | YES | | NULL | | | name | | varchar(255) | YES | | NULL | |
| about | | text | YES | | NULL | | | about | | text | YES | | NULL | |
| xmpp | XMPP address | varchar(255) | YES | | NULL | |
| matrix | Matrix address | varchar(255) | YES | | NULL | |
| photo | | varchar(255) | YES | | NULL | | | photo | | varchar(255) | YES | | NULL | |
| header | Header picture | varchar(255) | YES | | NULL | | | header | Header picture | varchar(255) | YES | | NULL | |
| addr | | varchar(255) | YES | | NULL | | | addr | | varchar(255) | YES | | NULL | |

View file

@ -239,6 +239,18 @@ class APContact
$apcontact['about'] = HTML::toBBCode(JsonLD::fetchElement($compacted, 'as:summary', '@value')); $apcontact['about'] = HTML::toBBCode(JsonLD::fetchElement($compacted, 'as:summary', '@value'));
$ims = JsonLD::fetchElementArray($compacted, 'vcard:hasInstantMessage');
if (!empty($ims)) {
foreach ($ims as $link) {
if (substr($link, 0, 5) == 'xmpp:') {
$apcontact['xmpp'] = substr($link, 5);
}
if (substr($link, 0, 7) == 'matrix:') {
$apcontact['matrix'] = substr($link, 7);
}
}
}
$apcontact['photo'] = JsonLD::fetchElement($compacted, 'as:icon', '@id'); $apcontact['photo'] = JsonLD::fetchElement($compacted, 'as:icon', '@id');
if (is_array($apcontact['photo']) || !empty($compacted['as:icon']['as:url']['@id'])) { if (is_array($apcontact['photo']) || !empty($compacted['as:icon']['as:url']['@id'])) {
$apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id'); $apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id');

View file

@ -157,6 +157,8 @@ class ActivityPub
// $profile['keywords'] // $profile['keywords']
// $profile['location'] // $profile['location']
$profile['about'] = $apcontact['about']; $profile['about'] = $apcontact['about'];
$profile['xmpp'] = $apcontact['xmpp'];
$profile['matrix'] = $apcontact['matrix'];
$profile['batch'] = $apcontact['sharedinbox']; $profile['batch'] = $apcontact['sharedinbox'];
$profile['notify'] = $apcontact['inbox']; $profile['notify'] = $apcontact['inbox'];
$profile['poll'] = $apcontact['outbox']; $profile['poll'] = $apcontact['outbox'];

View file

@ -352,6 +352,17 @@ class Transmitter
$data['summary'] = BBCode::convertForUriId($owner['uri-id'] ?? 0, $owner['about'], BBCode::EXTERNAL); $data['summary'] = BBCode::convertForUriId($owner['uri-id'] ?? 0, $owner['about'], BBCode::EXTERNAL);
} }
if (!empty($owner['xmpp']) || !empty($owner['matrix'])) {
$data['vcard:hasInstantMessage'] = [];
if (!empty($owner['xmpp'])) {
$data['vcard:hasInstantMessage'][] = 'xmpp:' . $owner['xmpp'];
}
if (!empty($owner['matrix'])) {
$data['vcard:hasInstantMessage'][] = 'matrix:' . $owner['matrix'];
}
}
$data['url'] = $owner['url']; $data['url'] = $owner['url'];
$data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]); $data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
$data['discoverable'] = (bool)$owner['net-publish']; $data['discoverable'] = (bool)$owner['net-publish'];

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA; use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1432); define('DB_UPDATE_VERSION', 1433);
} }
return [ return [
@ -392,6 +392,8 @@ return [
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"name" => ["type" => "varchar(255)", "comment" => ""], "name" => ["type" => "varchar(255)", "comment" => ""],
"about" => ["type" => "text", "comment" => ""], "about" => ["type" => "text", "comment" => ""],
"xmpp" => ["type" => "varchar(255)", "comment" => "XMPP address"],
"matrix" => ["type" => "varchar(255)", "comment" => "Matrix address"],
"photo" => ["type" => "varchar(255)", "comment" => ""], "photo" => ["type" => "varchar(255)", "comment" => ""],
"header" => ["type" => "varchar(255)", "comment" => "Header picture"], "header" => ["type" => "varchar(255)", "comment" => "Header picture"],
"addr" => ["type" => "varchar(255)", "comment" => ""], "addr" => ["type" => "varchar(255)", "comment" => ""],