From 65921bf2e70c10641672464d151a24f1c015f8d9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 9 Aug 2015 14:28:59 +0200 Subject: [PATCH] Posts from Diaspora are always accepted for the global contact --- include/diaspora.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 534e2541c..fd9dd8fb7 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -34,8 +34,13 @@ function diaspora_dispatch_public($msg) { diaspora_dispatch($rr,$msg); } } - else - logger('diaspora_public: no subscribers'); + else { + logger('diaspora_public: no subscribers '.print_r($msg, true)); + + // Use a dummy importer + $importer = array("uid" => 0, "page-flags" => PAGE_FREELOVE); + diaspora_dispatch($importer,$msg); + } } @@ -782,6 +787,11 @@ function diaspora_post_allow($importer,$contact) { if($contact['rel'] == CONTACT_IS_FOLLOWER) if($importer['page-flags'] == PAGE_COMMUNITY) return true; + + // Messages for the global users are always accepted + if ($importer['uid'] == 0) + return true; + return false; } @@ -1605,7 +1615,7 @@ function diaspora_conversation($importer,$xml,$msg) { $created_at = datetime_convert('UTC','UTC',notags(unxmlify($xml->created_at))); $parent_uri = $diaspora_handle . ':' . $guid; - + $messages = $xml->message; if(! count($messages)) { @@ -1619,7 +1629,7 @@ function diaspora_conversation($importer,$xml,$msg) { return; } - if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { + if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { logger('diaspora_conversation: Ignoring this author.'); return 202; } @@ -1776,14 +1786,14 @@ function diaspora_message($importer,$xml,$msg) { $msg_conversation_guid = notags(unxmlify($xml->conversation_guid)); $parent_uri = $diaspora_handle . ':' . $msg_parent_guid; - + $contact = diaspora_get_contact_by_handle($importer['uid'],$msg_diaspora_handle); if(! $contact) { logger('diaspora_message: cannot find contact: ' . $msg_diaspora_handle); return; } - if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { + if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { logger('diaspora_message: Ignoring this author.'); return 202; }