aboutsummaryrefslogtreecommitdiffstats
path: root/include/diaspora.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-03 05:09:43 -0700
committerfriendica <info@friendica.com>2014-09-03 05:09:43 -0700
commite8ef515b6136ee79ff17e1c143a15e29691d3d81 (patch)
treed81e295924df1c4c9c792c4a25306b4eed16bc56 /include/diaspora.php
parent75d0f6329cc532c7f74927bdaa678d8d85f45a9e (diff)
downloadvolse-hubzilla-e8ef515b6136ee79ff17e1c143a15e29691d3d81.tar.gz
volse-hubzilla-e8ef515b6136ee79ff17e1c143a15e29691d3d81.tar.bz2
volse-hubzilla-e8ef515b6136ee79ff17e1c143a15e29691d3d81.zip
store diaspora meta info in the item table. It has to go there or it will kill us with complex joins. We can phase out the sign table once this all checks out.
Diffstat (limited to 'include/diaspora.php')
-rwxr-xr-xinclude/diaspora.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index c2f2b1ac9..fabcafa79 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -1343,6 +1343,11 @@ function diaspora_comment($importer,$xml,$msg) {
$datarray['body'] = $body;
$datarray['app'] = 'Diaspora';
+
+ if(! $parent_author_signature) {
+ $datarray['diaspora_meta'] = array('signer' => $diaspora_handle, 'body' => $text,
+ 'signed_text' => $signed_data, 'signature' => base64_encode($author_signature));
+ }
$result = item_store($datarray);
@@ -1908,6 +1913,12 @@ EOT;
$arr['unseen'] = 1;
$arr['last-child'] = 0;
+ if(! $parent_author_signature) {
+ $datarray['diaspora_meta'] = array('signer' => $diaspora_handle, 'body' => $text,
+ 'signed_text' => $signed_data, 'signature' => base64_encode($author_signature));
+ }
+
+
$message_id = item_store($arr);
@@ -2551,28 +2562,15 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$tpl = get_markup_template('diaspora_comment_relay.tpl');
}
-
- // fetch the original signature if the relayable was created by a Diaspora, Friendica-over Diaspora,
- // or zot user. Relayables for other networks are not supported.
-
- $r = q("select * from sign where " . $sql_sign_id . " = %d limit 1",
- intval($item['id'])
- );
- if($r) {
- $orig_sign = $r[0];
- $signed_text = $orig_sign['signed_text'];
- $authorsig = $orig_sign['signature'];
- $handle = $orig_sign['signer'];
+ $diaspora_meta = (($item['diaspora_meta']) ? json_decode($item['diaspora_meta'],true) : '');
+ if($diaspora_meta) {
+ $sender_signed_text = $diaspora_meta['signed_text'];
+ $authorsig = $diaspora_meta['signature'];
+ $handle = $diaspora_meta['signer'];
+ $text = $diaspora_meta['body'];
}
- else {
- // Author signature information (for likes, comments, and retractions of likes or comments,
- // whether from Diaspora or Friendica) must be placed in the `sign` table before this
- // function is called
-// $authorsig = $item['sig'];
+ else
logger('diaspora_send_relay: original author signature not found');
-// ignore - see below
-// return;
- }
/* Since the author signature is only checked by the parent, not by the relay recipients,
* I think it may not be necessary for us to do so much work to preserve all the original
@@ -2585,7 +2583,7 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
*
*
*/
-
+// bug - nomadic identity may/will affect diaspora_handle_from_contact
if(! $handle) {
if($item['author_xchan'] === $owner['channel_hash'])
$handle = $owner['channel_address'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
@@ -2597,12 +2595,14 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
return;
}
- if($relay_retract)
- $sender_signed_text = $item['mid'] . ';' . $target_type;
- elseif($like)
- $sender_signed_text = $item['mid'] . ';' . $target_type . ';' . $parent['mid'] . ';' . $positive . ';' . $handle;
- else
- $sender_signed_text = $item['mid'] . ';' . $parent['mid'] . ';' . $text . ';' . $handle;
+ if(! $sender_signed_text) {
+ if($relay_retract)
+ $sender_signed_text = $item['mid'] . ';' . $target_type;
+ elseif($like)
+ $sender_signed_text = $item['mid'] . ';' . $target_type . ';' . $parent['mid'] . ';' . $positive . ';' . $handle;
+ else
+ $sender_signed_text = $item['mid'] . ';' . $parent['mid'] . ';' . $text . ';' . $handle;
+ }
// Sign the relayable with the top-level owner's signature
//