mirror of
https://github.com/friendica/friendica
synced 2024-11-18 20:23:44 +00:00
Merge pull request #10593 from annando/matrix2
The Matrix and XMPP address is now transported via AP as well
This commit is contained in:
commit
e146a5983c
6 changed files with 33 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- 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 '',
|
||||
`name` varchar(255) COMMENT '',
|
||||
`about` text COMMENT '',
|
||||
`xmpp` varchar(255) COMMENT 'XMPP address',
|
||||
`matrix` varchar(255) COMMENT 'Matrix address',
|
||||
`photo` varchar(255) COMMENT '',
|
||||
`header` varchar(255) COMMENT 'Header picture',
|
||||
`addr` varchar(255) COMMENT '',
|
||||
|
|
|
@ -22,6 +22,8 @@ Fields
|
|||
| nick | | varchar(255) | NO | | | |
|
||||
| name | | varchar(255) | 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 | |
|
||||
| header | Header picture | varchar(255) | YES | | NULL | |
|
||||
| addr | | varchar(255) | YES | | NULL | |
|
||||
|
|
|
@ -239,6 +239,18 @@ class APContact
|
|||
|
||||
$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');
|
||||
if (is_array($apcontact['photo']) || !empty($compacted['as:icon']['as:url']['@id'])) {
|
||||
$apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id');
|
||||
|
|
|
@ -157,6 +157,8 @@ class ActivityPub
|
|||
// $profile['keywords']
|
||||
// $profile['location']
|
||||
$profile['about'] = $apcontact['about'];
|
||||
$profile['xmpp'] = $apcontact['xmpp'];
|
||||
$profile['matrix'] = $apcontact['matrix'];
|
||||
$profile['batch'] = $apcontact['sharedinbox'];
|
||||
$profile['notify'] = $apcontact['inbox'];
|
||||
$profile['poll'] = $apcontact['outbox'];
|
||||
|
|
|
@ -352,6 +352,17 @@ class Transmitter
|
|||
$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['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
|
||||
$data['discoverable'] = (bool)$owner['net-publish'];
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1432);
|
||||
define('DB_UPDATE_VERSION', 1433);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -392,6 +392,8 @@ return [
|
|||
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"name" => ["type" => "varchar(255)", "comment" => ""],
|
||||
"about" => ["type" => "text", "comment" => ""],
|
||||
"xmpp" => ["type" => "varchar(255)", "comment" => "XMPP address"],
|
||||
"matrix" => ["type" => "varchar(255)", "comment" => "Matrix address"],
|
||||
"photo" => ["type" => "varchar(255)", "comment" => ""],
|
||||
"header" => ["type" => "varchar(255)", "comment" => "Header picture"],
|
||||
"addr" => ["type" => "varchar(255)", "comment" => ""],
|
||||
|
|
Loading…
Reference in a new issue