From: Michael Vogel Date: Sun, 6 Mar 2016 00:37:47 +0000 (+0100) Subject: Retraction could work now as well. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6468fbb9051ab6fe09bfcaaf0f46ce03491ace4f;p=friendica.git Retraction could work now as well. --- diff --git a/include/diaspora2.php b/include/diaspora2.php index 197cb1da11..c745ab8366 100644 --- a/include/diaspora2.php +++ b/include/diaspora2.php @@ -2031,6 +2031,40 @@ EOT; return $return_code; } + function send_retraction($item, $owner, $contact, $public_batch = false) { + + $myaddr = self::get_my_handle($owner); + + // 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"; + } + + $signed_text = $item["guid"].";".$target_type; + + $message = array("target_guid" => $item['guid'], + "target_type" => $target_type, + "sender_handle" => $myaddr, + "target_author_signature" => base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha256'))); + + $data = array("XML" => array("post" => array($msg_type => $message))); + $msg = xml::from_array($data, $xml); + + logger("send guid ".$item["guid"], LOGGER_DEBUG); + + $slap = self::build_message($msg, $owner, $contact, $owner["uprvkey"], $contact["pubkey"], $public_batch); + + $return_code = self::transmit($owner, $contact, $slap, $public_batch, false, $item["guid"]); + + logger("guid: ".$item["guid"]." result ".$return_code, LOGGER_DEBUG); + + return $return_code; + } + function send_mail($item,$owner,$contact) { $myaddr = self::get_my_handle($owner); diff --git a/include/xml.php b/include/xml.php index e46f53acc0..9c458dab12 100644 --- a/include/xml.php +++ b/include/xml.php @@ -20,7 +20,7 @@ class xml { foreach($array as $key => $value) { if (!is_array($value) AND !is_numeric($key)) - $xml->addChild($key, $value); + $xml->addChild($key, xmlify($value)); elseif (is_array($value)) self::from_array($value, $xml->addChild($key)); } diff --git a/view/templates/diaspora_relay_retraction.tpl b/view/templates/diaspora_relay_retraction.tpl index b3f97a2e13..c4b44cd05f 100644 --- a/view/templates/diaspora_relay_retraction.tpl +++ b/view/templates/diaspora_relay_retraction.tpl @@ -1,11 +1,10 @@ - - {{$type}} {{$guid}} - {{$signature}} + {{$type}} {{$handle}} + {{$signature}}