Relaying of Diaspora comments now work with the new fields as well.

This commit is contained in:
Michael 2016-12-28 13:30:55 +00:00
parent 6a511066c4
commit ca0e6cba02

View file

@ -3465,26 +3465,13 @@ class Diaspora {
$message = self::construct_like($r[0], $contact); $message = self::construct_like($r[0], $contact);
$message["author_signature"] = self::signature($contact, $message); $message["author_signature"] = self::signature($contact, $message);
// In the future we will store the signature more flexible to support new fields. // We now store the signature more flexible to dynamically support new fields.
// Right now we cannot change this since old Friendica versions (prior to 3.5) can only handle this format. // This will break Diaspora compatibility with Friendica versions prior to 3.5.
// (We are transmitting this data here via DFRN) q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
intval($message_id),
$signed_text = $message["positive"].";".$message["guid"].";".$message["target_type"].";". dbesc(json_encode($message))
$message["parent_guid"].";".$message["diaspora_handle"];
q("INSERT INTO `sign` (`iid`,`signed_text`,`signature`,`signer`) VALUES (%d,'%s','%s','%s')",
intval($post_id),
dbesc($signed_text),
dbesc($message["author_signature"]),
dbesc($message["diaspora_handle"])
); );
// This here will replace the lines above, once Diaspora changed its protocol
//q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
// intval($message_id),
// dbesc(json_encode($message))
//);
logger('Stored diaspora like signature'); logger('Stored diaspora like signature');
return true; return true;
} }
@ -3511,25 +3498,13 @@ class Diaspora {
$message = self::construct_comment($item, $contact); $message = self::construct_comment($item, $contact);
$message["author_signature"] = self::signature($contact, $message); $message["author_signature"] = self::signature($contact, $message);
// In the future we will store the signature more flexible to support new fields. // We now store the signature more flexible to dynamically support new fields.
// Right now we cannot change this since old Friendica versions (prior to 3.5) can only handle this format. // This will break Diaspora compatibility with Friendica versions prior to 3.5.
// (We are transmitting this data here via DFRN) q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
$signed_text = $message["guid"].";".$message["parent_guid"].";".
$message["text"].";".$message["diaspora_handle"];
q("INSERT INTO `sign` (`iid`,`signed_text`,`signature`,`signer`) VALUES (%d,'%s','%s','%s')",
intval($message_id), intval($message_id),
dbesc($signed_text), dbesc(json_encode($message))
dbesc($message["author_signature"]),
dbesc($message["diaspora_handle"])
); );
// This here will replace the lines above, once Diaspora changed its protocol
//q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
// intval($message_id),
// dbesc(json_encode($message))
//);
logger('Stored diaspora comment signature'); logger('Stored diaspora comment signature');
return true; return true;
} }