]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_notify.php
Just some more fixed notice
[friendica.git] / mod / dfrn_notify.php
index 27e8ed63f8f0b2ff2449edd564d95701b821b3ea..e3569965720af8b5b400df5e236ab745841f041e 100644 (file)
@@ -9,6 +9,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
+use Friendica\Database\dba;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Protocol\DFRN;
@@ -198,9 +199,6 @@ function dfrn_notify_post(App $a) {
 
 function dfrn_dispatch_public($postdata)
 {
-       /// @todo Currently disabled, until there is a working item distribution for public posts
-       return false;
-
        $msg = Diaspora::decodeRaw([], $postdata);
        if (!$msg) {
                // We have to fail silently to be able to hand it over to the salmon parser
@@ -211,7 +209,7 @@ function dfrn_dispatch_public($postdata)
        $contact = Contact::getDetailsByAddr($msg['author'], 0);
        if (!$contact) {
                logger('Contact not found for address ' . $msg['author']);
-               System::xmlExit(3, 'Contact not found');
+               System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
        }
 
        // We now have some contact, so we fetch it
@@ -225,7 +223,7 @@ function dfrn_dispatch_public($postdata)
        // This should never fail
        if (!DBM::is_result($importer)) {
                logger('Contact not found for address ' . $msg['author']);
-               System::xmlExit(3, 'Contact not found');
+               System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
        }
 
        logger('Importing post from ' . $msg['author'] . ' with the public envelope.', LOGGER_DEBUG);
@@ -249,7 +247,7 @@ function dfrn_dispatch_private($user, $postdata)
                $cid = Contact::getIdForURL($msg['author']);
                if (!$cid) {
                        logger('Contact not found for address ' . $msg['author']);
-                       System::xmlExit(3, 'Contact not found');
+                       System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
                }
        }
 
@@ -262,12 +260,14 @@ function dfrn_dispatch_private($user, $postdata)
        // This should never fail
        if (!DBM::is_result($importer)) {
                logger('Contact not found for address ' . $msg['author']);
-               System::xmlExit(3, 'Contact not found');
+               System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
        }
 
        // Set the user id. This is important if this is a public contact
        $importer['importer_uid']  = $user['uid'];
 
+       $importer = array_merge($importer, $user);
+
        logger('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', LOGGER_DEBUG);
 
        // Now we should be able to import it
@@ -336,7 +336,8 @@ function dfrn_notify_content(App $a) {
                );
 
                if (!DBM::is_result($r)) {
-                       $status = 1;
+                       logger('No user data found for ' . $a->argv[1] . ' - SQL: ' . $sql_extra);
+                       killme();
                }
 
                logger("Remote rino version: ".$rino_remote." for ".$r[0]["url"], LOGGER_DATA);