From 24f1a24208ece3827f9d5d734e99ba5be3e202f8 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 3 Dec 2015 08:35:47 +0100 Subject: [PATCH] Support for a new Diaspora command for post retraction --- include/diaspora.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index c5ba07586d..e0eaf065d6 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2254,8 +2254,23 @@ function diaspora_retraction($importer,$xml) { if($type === 'Person') { require_once('include/Contact.php'); contact_remove($contact['id']); - } - elseif($type === 'Post') { + } elseif($type === 'StatusMessage') { + $guid = notags(unxmlify($xml->post_guid)); + + $r = q("SELECT * FROM `item` WHERE `guid` = '%s' AND `uid` = %d AND NOT `file` LIKE '%%[%%' LIMIT 1", + dbesc($guid), + intval($importer['uid']) + ); + if(count($r)) { + if(link_compare($r[0]['author-link'],$contact['url'])) { + q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d", + dbesc(datetime_convert()), + intval($r[0]['id']) + ); + delete_thread($r[0]['id'], $r[0]['parent-uri']); + } + } + } elseif($type === 'Post') { $r = q("select * from item where guid = '%s' and uid = %d and not file like '%%[%%' limit 1", dbesc('guid'), intval($importer['uid']) -- 2.39.5