use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
+use Friendica\Protocol\Diaspora;
use dba;
use DOMDocument;
use DOMXPath;
dba::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
if ($data->scope == 'tags') {
+ // Avoid duplicates
+ $tags = [];
foreach ($data->tags as $tag) {
+ $tag = mb_strtolower($tag);
+ $tags[$tag] = $tag;
+ }
+
+ foreach ($tags as $tag) {
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag]);
}
}
+
+ // Create or update the relay contact
+ $fields = [];
+ if (isset($data->protocols)) {
+ if (isset($data->protocols->diaspora)) {
+ $fields['network'] = NETWORK_DIASPORA;
+ $fields['batch'] = $data->protocols->diaspora;
+ }
+ if (isset($data->protocols->dfrn)) {
+ $fields['network'] = NETWORK_DFRN;
+ $fields['batch'] = $data->protocols->dfrn;
+ }
+ }
+ Diaspora::setRelayContact($server_url, $fields);
}
/**