]> git.mxchange.org Git - friendica.git/commitdiff
Diaspora: Images from shared messages now appear in the posting.
authorMichael Vogel <icarus@dabo.de>
Sun, 23 Mar 2014 17:50:28 +0000 (18:50 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 23 Mar 2014 17:50:28 +0000 (18:50 +0100)
include/diaspora.php
include/dsprphotoq.php

index df6700ae2bf1173a977c80e72c5da9474de6c333..7476a5c26d544bca9c66368bb99421d8f72b0a0c 100755 (executable)
@@ -1009,20 +1009,36 @@ function diaspora_reshare($importer,$xml,$msg) {
        }
        elseif($source_xml->post->status_message) {
                $body = diaspora2bb($source_xml->post->status_message->raw_message);
+
+               // Checking for embedded pictures
+               if($source_xml->post->status_message->photo->remote_photo_path AND
+                       $source_xml->post->status_message->photo->remote_photo_name) {
+
+                       $remote_photo_path = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_path));
+                       $remote_photo_name = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_name));
+
+                       $body = '[img]'.$remote_photo_path.$remote_photo_name.'[/img]'."\n".$body;
+
+                       logger('diaspora_reshare: embedded picture link found: '.$body, LOGGER_DEBUG);
+               }
+
                $body = scale_external_images($body);
 
                // Add OEmbed and other information to the body
                $body = diaspora_add_page_info_to_body($body);
        }
        else {
+               // Maybe it is a reshare of a photo that will be delivered at a later time (testing)
                logger('diaspora_reshare: no reshare content found: ' . print_r($source_xml,true));
-               return;
-       }
-       if(! $body) {
-               logger('diaspora_reshare: empty body: source= ' . $x);
-               return;
+               $body = "";
+               //return;
        }
 
+       //if(! $body) {
+       //      logger('diaspora_reshare: empty body: source= ' . $x);
+       //      return;
+       //}
+
        $person = find_diaspora_person_by_handle($orig_author);
 
        /*if(is_array($person) && x($person,'name') && x($person,'url'))
@@ -1113,6 +1129,9 @@ function diaspora_reshare($importer,$xml,$msg) {
        $datarray['tag'] = $str_tags;
        $datarray['app']  = 'Diaspora';
 
+       // if empty content it might be a photo that hasn't arrived yet. If a photo arrives, we'll make it visible. (testing)
+       $datarray['visible'] = ((strlen($body)) ? 1 : 0);
+
        $message_id = item_store($datarray);
 
        //if($message_id) {
index 06e733d79c70126bc73dfae2ee61372218bc71c8..47592006d7f597b88801acdb68706972b21afe93 100644 (file)
@@ -8,7 +8,7 @@ function dsprphotoq_run($argv, $argc){
        if(is_null($a)){
                $a = new App;
        }
-  
+
        if(is_null($db)){
                @include(".htconfig.php");
                require_once("include/dba.php");