]> git.mxchange.org Git - friendica.git/commitdiff
Just some more message types
authorMichael <heluecht@pirati.ca>
Thu, 15 Jun 2017 21:20:18 +0000 (21:20 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 15 Jun 2017 21:20:18 +0000 (21:20 +0000)
include/diaspora.php

index 49871fb598c7535e13014aef2b36c688f6dcaeaa..ff3caa5744b5cda0d70c02919b861e7915165c4d 100644 (file)
@@ -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) {
 
-               $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";
-               }
+               self::$new = true;
 
-               if ($relay && ($item["uri"] !== $item["parent-uri"]))
-                       $signature = "parent_author_signature";
-               else
-                       $signature = "target_author_signature";
+               $itemaddr = self::handle_from_contact($item["contact-id"], $item["gcontact-id"]);
 
-               $signed_text = $item["guid"].";".$target_type;
+               $msg_type = "retraction";
+               $target_type = "Post";
 
-               $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);