We now should send all data in the new format
This commit is contained in:
parent
a453ae4f66
commit
0dc1c932f8
|
@ -29,8 +29,6 @@ require_once 'include/cache.php';
|
|||
*/
|
||||
class Diaspora {
|
||||
|
||||
private static $new = false;
|
||||
|
||||
/**
|
||||
* @brief Return a list of relay servers
|
||||
*
|
||||
|
@ -2843,6 +2841,8 @@ class Diaspora {
|
|||
*/
|
||||
private static function build_message($msg, $user, $contact, $prvkey, $pubkey, $public = false) {
|
||||
|
||||
//$new = Config::get('system', 'new_diaspora', null, true);
|
||||
|
||||
if ($public)
|
||||
$magic_env = self::build_public_message($msg,$user,$contact,$prvkey,$pubkey);
|
||||
else
|
||||
|
@ -2951,11 +2951,8 @@ class Diaspora {
|
|||
*/
|
||||
public static function build_post_xml($type, $message) {
|
||||
|
||||
if (!self::$new) {
|
||||
$data = array("XML" => array("post" => array($type => $message)));
|
||||
} else {
|
||||
$data = array($type => $message);
|
||||
}
|
||||
|
||||
return xml::from_array($data, $xml);
|
||||
}
|
||||
|
||||
|
@ -3006,12 +3003,15 @@ class Diaspora {
|
|||
*/
|
||||
public static function send_share($owner,$contact) {
|
||||
|
||||
$message = array("sender_handle" => self::my_handle($owner),
|
||||
"recipient_handle" => $contact["addr"]);
|
||||
/// @todo support the different possible combinations of "following" and "sharing"
|
||||
$message = array("author" => self::my_handle($owner),
|
||||
"recipient" => $contact["addr"],
|
||||
"following" => "true",
|
||||
"sharing" => "true");
|
||||
|
||||
logger("Send share ".print_r($message, true), LOGGER_DEBUG);
|
||||
|
||||
return self::build_and_transmit($owner, $contact, "request", $message);
|
||||
return self::build_and_transmit($owner, $contact, "contact", $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3024,8 +3024,6 @@ class Diaspora {
|
|||
*/
|
||||
public static function send_unshare($owner,$contact) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$message = array("author" => self::my_handle($owner),
|
||||
"target_guid" => $owner["guid"],
|
||||
"target_type" => "Person");
|
||||
|
@ -3201,8 +3199,6 @@ class Diaspora {
|
|||
*/
|
||||
public static function build_status($item, $owner) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$cachekey = "diaspora:build_status:".$item['guid'];
|
||||
|
||||
$result = Cache::get($cachekey);
|
||||
|
@ -3216,8 +3212,6 @@ class Diaspora {
|
|||
|
||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||
|
||||
//self::$new = Config::get('system', 'new_diaspora', null, true);
|
||||
|
||||
// Detect a share element and do a reshare
|
||||
if (!$item['private'] && ($ret = self::is_reshare($item["body"]))) {
|
||||
$message = array("author" => $myaddr,
|
||||
|
@ -3320,8 +3314,6 @@ class Diaspora {
|
|||
*/
|
||||
private static function construct_like($item, $owner) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
|
||||
dbesc($item["thr-parent"]));
|
||||
if (!dbm::is_result($p))
|
||||
|
@ -3354,8 +3346,6 @@ class Diaspora {
|
|||
*/
|
||||
private static function construct_attend($item, $owner) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
|
||||
dbesc($item["thr-parent"]));
|
||||
if (!dbm::is_result($p))
|
||||
|
@ -3395,8 +3385,6 @@ class Diaspora {
|
|||
*/
|
||||
private static function construct_comment($item, $owner) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$cachekey = "diaspora:construct_comment:".$item['guid'];
|
||||
|
||||
$result = Cache::get($cachekey);
|
||||
|
@ -3479,19 +3467,17 @@ class Diaspora {
|
|||
$signed_parts = explode(";", $signature['signed_text']);
|
||||
|
||||
if ($item["deleted"])
|
||||
$message = array("parent_author_signature" => "",
|
||||
$message = array("author" => $signature['signer'],
|
||||
"target_guid" => $signed_parts[0],
|
||||
"target_type" => $signed_parts[1],
|
||||
"sender_handle" => $signature['signer'],
|
||||
"target_author_signature" => $signature['signature']);
|
||||
"target_type" => $signed_parts[1]);
|
||||
elseif ($item['verb'] === ACTIVITY_LIKE)
|
||||
$message = array("positive" => $signed_parts[0],
|
||||
$message = array("author" => $signed_parts[4],
|
||||
"guid" => $signed_parts[1],
|
||||
"target_type" => $signed_parts[2],
|
||||
"parent_guid" => $signed_parts[3],
|
||||
"parent_author_signature" => "",
|
||||
"parent_type" => $signed_parts[2],
|
||||
"positive" => $signed_parts[0],
|
||||
"author_signature" => $signature['signature'],
|
||||
"diaspora_handle" => $signed_parts[4]);
|
||||
"parent_author_signature" => "");
|
||||
else {
|
||||
// Remove the comment guid
|
||||
$guid = array_shift($signed_parts);
|
||||
|
@ -3505,12 +3491,12 @@ class Diaspora {
|
|||
// Glue the parts together
|
||||
$text = implode(";", $signed_parts);
|
||||
|
||||
$message = array("guid" => $guid,
|
||||
$message = array("author" => $handle,
|
||||
"guid" => $guid,
|
||||
"parent_guid" => $parent_guid,
|
||||
"parent_author_signature" => "",
|
||||
"author_signature" => $signature['signature'],
|
||||
"text" => implode(";", $signed_parts),
|
||||
"diaspora_handle" => $handle);
|
||||
"author_signature" => $signature['signature'],
|
||||
"parent_author_signature" => "");
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
@ -3559,10 +3545,12 @@ class Diaspora {
|
|||
if (is_array($msg)) {
|
||||
foreach ($msg AS $field => $data) {
|
||||
if (!$item["deleted"]) {
|
||||
if ($field == "author")
|
||||
$field = "diaspora_handle";
|
||||
if ($field == "parent_type")
|
||||
$field = "target_type";
|
||||
if ($field == "diaspora_handle") {
|
||||
$field = "author";
|
||||
}
|
||||
if ($field == "target_type") {
|
||||
$field = "parent_type";
|
||||
}
|
||||
}
|
||||
|
||||
$message[$field] = $data;
|
||||
|
@ -3591,8 +3579,6 @@ class Diaspora {
|
|||
*/
|
||||
public static function send_retraction($item, $owner, $contact, $public_batch = false, $relay = false) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$itemaddr = self::handle_from_contact($item["contact-id"], $item["gcontact-id"]);
|
||||
|
||||
$msg_type = "retraction";
|
||||
|
@ -3618,8 +3604,6 @@ class Diaspora {
|
|||
*/
|
||||
public static function send_mail($item, $owner, $contact) {
|
||||
|
||||
self::$new = true;
|
||||
|
||||
$myaddr = self::my_handle($owner);
|
||||
|
||||
$r = q("SELECT * FROM `conv` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
|
@ -3737,7 +3721,7 @@ class Diaspora {
|
|||
$tags = trim($tags);
|
||||
}
|
||||
|
||||
$message = array("diaspora_handle" => $handle,
|
||||
$message = array("author" => $handle,
|
||||
"first_name" => $first,
|
||||
"last_name" => $last,
|
||||
"image_url" => $large,
|
||||
|
@ -3748,6 +3732,7 @@ class Diaspora {
|
|||
"bio" => $about,
|
||||
"location" => $location,
|
||||
"searchable" => $searchable,
|
||||
"nsfw" => "false",
|
||||
"tag_string" => $tags);
|
||||
|
||||
foreach ($recips as $recip) {
|
||||
|
|
Loading…
Reference in a new issue