/**
* @file include/diaspora.php
* @brief The implementation of the diaspora protocol
- *
- * Checklist:
- *
- * Checked:
- * - send status
- * - send comment
- * - send like
- * - send mail
- * - send status retraction
- * - send comment retraction on own post
- * - send like retraction on own post
- * - send comment retraction on diaspora post
- * - send like retraction on diaspora post
- * - receive status
- * - receive reshare
- * - receive comment
- * - receive like
- * - receive connect request
- * - receive profile data
- * - receive mail
- * - receive comment retraction
- * - receive like retraction
- * - relay comment
- * - relay like
- * - relay comment retraction from diaspora
- * - relay comment retraction from friendica
- * - relay like retraction from diaspora
- * - relay like retraction from friendica
- * - send share
- *
- * Should work:
- * - receive account deletion
- * - send unshare
- *
- * Unchecked:
*/
require_once("include/items.php");
* @return bool Success
*/
private function receive_account_deletion($importer, $data) {
+
+ /// @todo Account deletion should remove the contact from the global contacts as well
+
$author = notags(unxmlify($data->author));
$contact = self::contact_by_handle($importer["uid"], $author);
FROM `item` WHERE `id` = %d AND `visible` AND NOT `deleted` AND `body` != '' LIMIT 1",
intval($item_id));
- if ($r)
+ if ($r) {
+ // If it is a reshared post from another network then reformat to avoid display problems with two share elements
+ if (self::is_reshare($r[0]["body"], false))
+ $r[0]["body"] = diaspora2bb(bb2diaspora($r[0]["body"]));
+
return $r[0];
+ }
}
}
case "StatusMessage":
return self::item_retraction($importer, $contact, $data);;
+ case "Contact":
case "Person":
/// @todo What should we do with an "unshare"?
// Removing the contact isn't correct since we still can read the public items
- //contact_remove($contact["id"]);
+ contact_remove($contact["id"]);
return true;
default:
// Skip if it isn't a pure repeated messages
// Does it start with a share?
- if (strpos($body, "[share") > 0)
+ if ((strpos($body, "[share") > 0) AND $complete)
return(false);
// Does it end with a share?
*/
public static function store_like_signature($contact, $post_id) {
- $enabled = intval(get_config('system','diaspora_enabled'));
- if (!$enabled) {
- logger('Diaspora support disabled, not storing like signature', LOGGER_DEBUG);
- return false;
- }
-
// Is the contact the owner? Then fetch the private key
if (!$contact['self'] OR ($contact['uid'] == 0)) {
logger("No owner post, so not storing signature", LOGGER_DEBUG);
return false;
}
- $enabled = intval(get_config('system','diaspora_enabled'));
- if (!$enabled) {
- logger('Diaspora support disabled, not storing comment signature', LOGGER_DEBUG);
- return false;
- }
-
$contact["uprvkey"] = $uprvkey;
$message = self::construct_comment($item, $contact);