Browse Source

Retraction could work now as well.

pull/2418/head
Michael Vogel 5 years ago
parent
commit
6468fbb905
3 changed files with 37 additions and 4 deletions
  1. +34
    -0
      include/diaspora2.php
  2. +1
    -1
      include/xml.php
  3. +2
    -3
      view/templates/diaspora_relay_retraction.tpl

+ 34
- 0
include/diaspora2.php 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);


+ 1
- 1
include/xml.php 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));
}


+ 2
- 3
view/templates/diaspora_relay_retraction.tpl 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>

Loading…
Cancel
Save