Retraction could work now as well.

This commit is contained in:
Michael Vogel 2016-03-06 01:37:47 +01:00
parent 71227b5d0d
commit 6468fbb905
3 changed files with 37 additions and 4 deletions

View File

@ -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);

View File

@ -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));
}

View File

@ -1,11 +1,10 @@
<XML>
<post>
<relayable_retraction>
<target_type>{{$type}}</target_type>
<target_guid>{{$guid}}</target_guid>
<target_author_signature>{{$signature}}</target_author_signature>
<target_type>{{$type}}</target_type>
<sender_handle>{{$handle}}</sender_handle>
<target_author_signature>{{$signature}}</target_author_signature>
</relayable_retraction>
</post>
</XML>