From f36ffe3c0329958aa4fe190d528207301c0058e7 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 15 Jun 2017 21:20:18 +0000 Subject: [PATCH] Just some more message types --- include/diaspora.php | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 49871fb59..ff3caa574 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2501,7 +2501,8 @@ class Diaspora { switch ($target_type) { case "Comment": case "Like": - case "Post": // "Post" will be supported in a future version + case "Post": + return self::item_retraction($importer, $contact, $data); case "Reshare": case "StatusMessage": return self::item_retraction($importer, $contact, $data); @@ -3024,9 +3025,11 @@ class Diaspora { */ public static function send_unshare($owner,$contact) { - $message = array("post_guid" => $owner["guid"], - "diaspora_handle" => self::my_handle($owner), - "type" => "Person"); + self::$new = true; + + $message = array("author" => self::my_handle($owner), + "target_guid" => $owner["guid"], + "target_type" => "Person"); logger("Send unshare ".print_r($message, true), LOGGER_DEBUG); @@ -3589,28 +3592,16 @@ class Diaspora { */ public static function send_retraction($item, $owner, $contact, $public_batch = false, $relay = false) { + self::$new = true; + $itemaddr = self::handle_from_contact($item["contact-id"], $item["gcontact-id"]); - // Check whether the retraction is for a top-level post or whether it's a relayable - if ($item["uri"] !== $item["parent-uri"]) { - $msg_type = "relayable_retraction"; - $target_type = (($item["verb"] === ACTIVITY_LIKE) ? "Like" : "Comment"); - } else { - $msg_type = "signed_retraction"; - $target_type = "StatusMessage"; - } + $msg_type = "retraction"; + $target_type = "Post"; - if ($relay && ($item["uri"] !== $item["parent-uri"])) - $signature = "parent_author_signature"; - else - $signature = "target_author_signature"; - - $signed_text = $item["guid"].";".$target_type; - - $message = array("target_guid" => $item['guid'], - "target_type" => $target_type, - "sender_handle" => $itemaddr, - $signature => base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha256'))); + $message = array("author" => $itemaddr, + "target_guid" => $item['guid'], + "target_type" => $target_type); logger("Got message ".print_r($message, true), LOGGER_DEBUG);