]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/APDelivery.php
Merge pull request #7907 from nupplaphil/task/reduce_app_deps
[friendica.git] / src / Worker / APDelivery.php
index 634a9446ebfc85ba63a04805bc49ef9ebc6daf35..812db57013c7154d5a519d63be342b206f5e503a 100644 (file)
@@ -30,9 +30,16 @@ class APDelivery extends BaseObject
                $success = true;
 
                if ($cmd == Delivery::MAIL) {
+                       $data = ActivityPub\Transmitter::createActivityFromMail($target_id);
+                       if (!empty($data)) {
+                               $success = HTTPSignature::transmit($data, $inbox, $uid);
+                       }
                } elseif ($cmd == Delivery::SUGGESTION) {
                        $success = ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $target_id);
                } elseif ($cmd == Delivery::RELOCATION) {
+                       // @todo Implementation pending
+               } elseif ($cmd == Delivery::POKE) {
+                       // Implementation not planned
                } elseif ($cmd == Delivery::REMOVAL) {
                        $success = ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox);
                } elseif ($cmd == Delivery::PROFILEUPDATE) {
@@ -42,14 +49,12 @@ class APDelivery extends BaseObject
                        if (!empty($data)) {
                                $success = HTTPSignature::transmit($data, $inbox, $uid);
                        }
-
-                       if ($success && in_array($cmd, [Delivery::POST, Delivery::COMMENT])) {
-                               ItemDeliveryData::incrementQueueDone($target_id);
-                       }
                }
 
-               if (!$success) {
-                       Worker::defer();
+               if (!$success && !Worker::defer() && in_array($cmd, [Delivery::POST])) {
+                       ItemDeliveryData::incrementQueueFailed($target_id);
+               } elseif ($success && in_array($cmd, [Delivery::POST])) {
+                       ItemDeliveryData::incrementQueueDone($target_id, ItemDeliveryData::ACTIVITYPUB);
                }
        }
 }