]> git.mxchange.org Git - friendica.git/commitdiff
Diaspora: Posts from Diaspora relais are transmitted the old way
authorMichael <heluecht@pirati.ca>
Mon, 25 Sep 2017 04:24:47 +0000 (04:24 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 25 Sep 2017 04:24:47 +0000 (04:24 +0000)
include/Smilies.php
include/diaspora.php
mod/receive.php

index d63511cd1d20af430b1c6ac0bcf3df09f0459cf1..8d527d7c82aa3e455f8525a2d978174c3e8f860e 100644 (file)
@@ -3,6 +3,9 @@
 /**
  * @file include/Smilies.php
  * @brief This file contains the Smilies class which contains functions to handle smiles
+ *
+ * @todo Use the shortcodes from here:
+ * https://github.com/iamcal/emoji-data/blob/master/emoji_pretty.json?raw=true
  */
 
 use Friendica\App;
index cd857ba6bdb9868da06f2d0219e83d1e850a5100..f7dee831d8c198bd6db14595cfb5fa5507a0b1eb 100644 (file)
@@ -287,6 +287,11 @@ class Diaspora {
                        $public = true;
                        $author_link = str_replace('acct:','',$children->header->author_id);
                } else {
+                       // This happens with posts from a relais
+                       if (!$importer) {
+                               logger("This is no private post in the old format", LOGGER_DEBUG);
+                               return false;
+                       }
 
                        $encrypted_header = json_decode(base64_decode($children->encrypted_header));
 
index 8b28c1656225cc60dba12e6c0a38c6b9c45f528a..68fc7f69fe962143346fc92bff02f82cf35c5f27 100644 (file)
@@ -17,11 +17,11 @@ function receive_post(App $a) {
                http_status_exit(500);
        }
 
-       $public = false;
-
        if (($a->argc == 2) && ($a->argv[1] === 'public')) {
                $public = true;
+               $importer = false;
        } else {
+               $public = false;
 
                if ($a->argc != 3 || $a->argv[1] !== 'users') {
                        http_status_exit(500);
@@ -49,8 +49,13 @@ function receive_post(App $a) {
                logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
                $msg = Diaspora::decode_raw($importer, $postdata);
        } else {
-               logger('mod-diaspora: message is in the old format', LOGGER_DEBUG);
+               logger('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
                $msg = Diaspora::decode($importer, $xml);
+
+               if ($public && !$msg) {
+                       logger('mod-diaspora: decode message in the new format', LOGGER_DEBUG);
+                       $msg = Diaspora::decode_raw($importer, $xml);
+               }
        }
 
        logger('mod-diaspora: decoded', LOGGER_DEBUG);