aboutsummaryrefslogtreecommitdiffstats
path: root/include/diaspora.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-28 19:22:27 -0700
committerFriendika <info@friendika.com>2011-08-28 19:22:27 -0700
commitf29f228463d35f574d6d285be0cf337b7d39c541 (patch)
treeaa7e977a25536397506c6c30f8e4d67eb85320d6 /include/diaspora.php
parent030dcbd467d5faf01e6f62b9cd9b1be6f8974dcc (diff)
downloadvolse-hubzilla-f29f228463d35f574d6d285be0cf337b7d39c541.tar.gz
volse-hubzilla-f29f228463d35f574d6d285be0cf337b7d39c541.tar.bz2
volse-hubzilla-f29f228463d35f574d6d285be0cf337b7d39c541.zip
bring Diaspora message signing back to the source author - whether they like it or not.
Diffstat (limited to 'include/diaspora.php')
-rw-r--r--include/diaspora.php49
1 files changed, 24 insertions, 25 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index 10b342289..6cba0ecec 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -1063,18 +1063,6 @@ function diaspora_send_relay($item,$owner,$contact) {
$body = $item['body'];
- $itemcontact = q("select * from contact where `id` = %d limit 1",
- intval($item['contact-id'])
- );
- if(count($itemcontact)) {
- if(! $itemcontact[0]['self']) {
- $prefix = sprintf( t('[Relayed] Comment authored by %s from network %s'),
- '['. $item['author-name'] . ']' . '(' . $item['author-link'] . ')',
- network_to_name($itemcontact['network'])) . "\n";
- $body = $prefix . $body;
- }
- }
-
$text = html_entity_decode(bb2diaspora($body));
// fetch the original signature if somebody sent the post to us to relay
@@ -1092,23 +1080,34 @@ function diaspora_send_relay($item,$owner,$contact) {
}
else {
+ $itemcontact = q("select * from contact where `id` = %d limit 1",
+ intval($item['contact-id'])
+ );
+ if(count($itemcontact)) {
+ if(! $itemcontact[0]['self']) {
+ $prefix = sprintf( t('[Relayed] Comment authored by %s from network %s'),
+ '['. $item['author-name'] . ']' . '(' . $item['author-link'] . ')',
+ network_to_name($itemcontact['network'])) . "\n";
+ $body = $prefix . $body;
+ }
+ }
+ else {
+ if($like)
+ $signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
+ else
+ $signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
+ $authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha'));
- if($like)
- $signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
- else
- $signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
-
- $authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha'));
-
- q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
- intval($item['id']),
- dbesc($signed_text),
- dbesc(base64_encode($authorsig)),
- dbesc($myaddr)
- );
+ q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
+ intval($item['id']),
+ dbesc($signed_text),
+ dbesc(base64_encode($authorsig)),
+ dbesc($myaddr)
+ );
+ }
}
// sign it