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

@@ -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');

View File

@@ -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'];

View File

@@ -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'];