]> git.mxchange.org Git - friendica.git/blobdiff - mod/salmon.php
Merge pull request #10479 from MrPetovan/task/9378-merge-share-template
[friendica.git] / mod / salmon.php
index 1932d3ba4175599f990121a0608382562e44b90f..1e92980f1ceb123a2ef362e97581fc780be7e816 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -25,6 +25,8 @@ use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
+use Friendica\Model\GServer;
+use Friendica\Model\Post;
 use Friendica\Protocol\ActivityNamespace;
 use Friendica\Protocol\OStatus;
 use Friendica\Protocol\Salmon;
@@ -79,7 +81,7 @@ function salmon_post(App $a, $xml = '') {
        // stash away some other stuff for later
 
        $type = $base->data[0]->attributes()->type[0];
-       $keyhash = $base->sig[0]->attributes()->keyhash[0];
+       $keyhash = $base->sig[0]->attributes()->keyhash[0] ?? '';
        $encoding = $base->encoding;
        $alg = $base->alg;
 
@@ -120,7 +122,7 @@ function salmon_post(App $a, $xml = '') {
        $m = Strings::base64UrlDecode($key_info[1]);
        $e = Strings::base64UrlDecode($key_info[2]);
 
-       Logger::log('key details: ' . print_r($key_info,true), Logger::DEBUG);
+       Logger::info('key details', ['info' => $key_info]);
 
        $pubkey = Crypto::meToPem($m, $e);
 
@@ -185,6 +187,10 @@ function salmon_post(App $a, $xml = '') {
                }
        }
 
+       if (!empty($r[0]['gsid'])) {
+               GServer::setProtocol($r[0]['gsid'], Post\DeliveryData::OSTATUS);
+       }
+
        // Have we ignored the person?
        // If so we can not accept this post.