Diaspora: Link to protocol description added. Support for creation date of comments
This commit is contained in:
parent
0ff8b555fd
commit
2c5fb55725
|
@ -2,6 +2,10 @@
|
||||||
/**
|
/**
|
||||||
* @file include/diaspora.php
|
* @file include/diaspora.php
|
||||||
* @brief The implementation of the diaspora protocol
|
* @brief The implementation of the diaspora protocol
|
||||||
|
*
|
||||||
|
* The new protocol is described here: http://diaspora.github.io/diaspora_federation/index.html
|
||||||
|
* Currently this implementation here interprets the old and the new protocol and sends the old one.
|
||||||
|
* This will change in the future.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("include/items.php");
|
require_once("include/items.php");
|
||||||
|
@ -1107,6 +1111,11 @@ class diaspora {
|
||||||
$text = unxmlify($data->text);
|
$text = unxmlify($data->text);
|
||||||
$author = notags(unxmlify($data->author));
|
$author = notags(unxmlify($data->author));
|
||||||
|
|
||||||
|
if (isset($data->created_at))
|
||||||
|
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||||
|
else
|
||||||
|
$created_at = datetime_convert();
|
||||||
|
|
||||||
$contact = self::allowed_contact_by_handle($importer, $sender, true);
|
$contact = self::allowed_contact_by_handle($importer, $sender, true);
|
||||||
if (!$contact)
|
if (!$contact)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1153,6 +1162,8 @@ class diaspora {
|
||||||
$datarray["object-type"] = ACTIVITY_OBJ_COMMENT;
|
$datarray["object-type"] = ACTIVITY_OBJ_COMMENT;
|
||||||
$datarray["object"] = $xml;
|
$datarray["object"] = $xml;
|
||||||
|
|
||||||
|
$datarray["changed"] = $datarray["created"] = $datarray["edited"] = $created_at;
|
||||||
|
|
||||||
$datarray["body"] = diaspora2bb($text);
|
$datarray["body"] = diaspora2bb($text);
|
||||||
|
|
||||||
self::fetch_guid($datarray);
|
self::fetch_guid($datarray);
|
||||||
|
@ -1349,7 +1360,7 @@ class diaspora {
|
||||||
intval($importer["uid"]),
|
intval($importer["uid"]),
|
||||||
dbesc($guid),
|
dbesc($guid),
|
||||||
dbesc($author),
|
dbesc($author),
|
||||||
dbesc(datetime_convert("UTC", "UTC", $created_at)),
|
dbesc($created_at),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($subject),
|
dbesc($subject),
|
||||||
dbesc($participants)
|
dbesc($participants)
|
||||||
|
@ -2071,7 +2082,7 @@ class diaspora {
|
||||||
$guid = notags(unxmlify($data->guid));
|
$guid = notags(unxmlify($data->guid));
|
||||||
$author = notags(unxmlify($data->author));
|
$author = notags(unxmlify($data->author));
|
||||||
$public = notags(unxmlify($data->public));
|
$public = notags(unxmlify($data->public));
|
||||||
$created_at = notags(unxmlify($data->created_at));
|
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||||
|
|
||||||
$contact = self::allowed_contact_by_handle($importer, $author, false);
|
$contact = self::allowed_contact_by_handle($importer, $author, false);
|
||||||
if (!$contact)
|
if (!$contact)
|
||||||
|
@ -2118,7 +2129,7 @@ class diaspora {
|
||||||
|
|
||||||
$datarray["plink"] = self::plink($author, $guid);
|
$datarray["plink"] = self::plink($author, $guid);
|
||||||
$datarray["private"] = (($public == "false") ? 1 : 0);
|
$datarray["private"] = (($public == "false") ? 1 : 0);
|
||||||
$datarray["changed"] = $datarray["created"] = $datarray["edited"] = datetime_convert("UTC", "UTC", $created_at);
|
$datarray["changed"] = $datarray["created"] = $datarray["edited"] = $created_at;
|
||||||
|
|
||||||
$datarray["object-type"] = $original_item["object-type"];
|
$datarray["object-type"] = $original_item["object-type"];
|
||||||
|
|
||||||
|
@ -2239,12 +2250,11 @@ class diaspora {
|
||||||
* @return int The message id of the newly created item
|
* @return int The message id of the newly created item
|
||||||
*/
|
*/
|
||||||
private function receive_status_message($importer, $data, $xml) {
|
private function receive_status_message($importer, $data, $xml) {
|
||||||
|
|
||||||
$raw_message = unxmlify($data->raw_message);
|
$raw_message = unxmlify($data->raw_message);
|
||||||
$guid = notags(unxmlify($data->guid));
|
$guid = notags(unxmlify($data->guid));
|
||||||
$author = notags(unxmlify($data->author));
|
$author = notags(unxmlify($data->author));
|
||||||
$public = notags(unxmlify($data->public));
|
$public = notags(unxmlify($data->public));
|
||||||
$created_at = notags(unxmlify($data->created_at));
|
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
|
||||||
$provider_display_name = notags(unxmlify($data->provider_display_name));
|
$provider_display_name = notags(unxmlify($data->provider_display_name));
|
||||||
|
|
||||||
/// @todo enable support for polls
|
/// @todo enable support for polls
|
||||||
|
@ -2312,7 +2322,7 @@ class diaspora {
|
||||||
|
|
||||||
$datarray["plink"] = self::plink($author, $guid);
|
$datarray["plink"] = self::plink($author, $guid);
|
||||||
$datarray["private"] = (($public == "false") ? 1 : 0);
|
$datarray["private"] = (($public == "false") ? 1 : 0);
|
||||||
$datarray["changed"] = $datarray["created"] = $datarray["edited"] = datetime_convert("UTC", "UTC", $created_at);
|
$datarray["changed"] = $datarray["created"] = $datarray["edited"] = $created_at;
|
||||||
|
|
||||||
if (isset($address["address"]))
|
if (isset($address["address"]))
|
||||||
$datarray["location"] = $address["address"];
|
$datarray["location"] = $address["address"];
|
||||||
|
|
Loading…
Reference in a new issue