Diaspora: Images from shared messages now appear in the posting.

This commit is contained in:
Michael Vogel 2014-03-23 18:50:28 +01:00
parent e1a41aff05
commit 54bb33d232
2 changed files with 25 additions and 6 deletions

View file

@ -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) {

View 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");