Just some more message types

2022.09-rc
Michael 2017-06-15 21:20:18 +00:00
rodzic 6482495001
commit f36ffe3c03
1 zmienionych plików z 14 dodań i 23 usunięć

Wyświetl plik

@ -2501,7 +2501,8 @@ class Diaspora {
switch ($target_type) { switch ($target_type) {
case "Comment": case "Comment":
case "Like": case "Like":
case "Post": // "Post" will be supported in a future version case "Post":
return self::item_retraction($importer, $contact, $data);
case "Reshare": case "Reshare":
case "StatusMessage": case "StatusMessage":
return self::item_retraction($importer, $contact, $data); return self::item_retraction($importer, $contact, $data);
@ -3024,9 +3025,11 @@ class Diaspora {
*/ */
public static function send_unshare($owner,$contact) { public static function send_unshare($owner,$contact) {
$message = array("post_guid" => $owner["guid"], self::$new = true;
"diaspora_handle" => self::my_handle($owner),
"type" => "Person"); $message = array("author" => self::my_handle($owner),
"target_guid" => $owner["guid"],
"target_type" => "Person");
logger("Send unshare ".print_r($message, true), LOGGER_DEBUG); 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) { 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"]); $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 $msg_type = "retraction";
if ($item["uri"] !== $item["parent-uri"]) { $target_type = "Post";
$msg_type = "relayable_retraction";
$target_type = (($item["verb"] === ACTIVITY_LIKE) ? "Like" : "Comment");
} else {
$msg_type = "signed_retraction";
$target_type = "StatusMessage";
}
if ($relay && ($item["uri"] !== $item["parent-uri"])) $message = array("author" => $itemaddr,
$signature = "parent_author_signature"; "target_guid" => $item['guid'],
else "target_type" => $target_type);
$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')));
logger("Got message ".print_r($message, true), LOGGER_DEBUG); logger("Got message ".print_r($message, true), LOGGER_DEBUG);