]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote branch 'upstream/master'
authorMichael Vogel <icarus@dabo.de>
Fri, 29 Jun 2012 19:43:49 +0000 (21:43 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 29 Jun 2012 19:43:49 +0000 (21:43 +0200)
Conflicts:
include/items.php

1  2 
include/items.php

index fbd4af5f3df367065b5fd2ebab74e39065e97c06,f5821961b001022c92f5a9022ac2cf727f4f4f76..aed0a8e6845f88ed6e7bbdb35d4d9ddf4858a67a
@@@ -3472,3 -3524,52 +3526,51 @@@ function posted_date_widget($url,$uid,$
        ));
        return $o;
  }
 -
+ function store_diaspora_retract_sig($item, $user, $baseurl) {
+       // Note that we can't add a target_author_signature
+       // if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
+       // the comment, that means we're the home of the post, and Diaspora will only
+       // check the parent_author_signature of retractions that it doesn't have to relay further
+       //
+       // I don't think this function gets called for an "unlike," but I'll check anyway
+       $enabled = intval(get_config('system','diaspora_enabled'));
+       if(! $enabled) {
+               logger('drop_item: diaspora support disabled, not storing retraction signature', LOGGER_DEBUG);
+               return;
+       }
+       logger('drop_item: storing diaspora retraction signature');
+       $signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
+       if(local_user() == $item['uid']) {
+               $handle = $user['nickname'] . '@' . substr($baseurl, strpos($baseurl,'://') + 3);
+               $authorsig = base64_encode(rsa_sign($signed_text,$user['prvkey'],'sha256'));
+       }
+       else {
+               $r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
+                       $item['contact-id']
+               );
+               if(count($r)) {
+                       // The below handle only works for NETWORK_DFRN. I think that's ok, because this function
+                       // only handles DFRN deletes
+                       $handle_baseurl_start = strpos($r['url'],'://') + 3;
+                       $handle_baseurl_length = strpos($r['url'],'/profile') - $handle_baseurl_start;
+                       $handle = $r['nick'] . '@' . substr($r['url'], $handle_baseurl_start, $handle_baseurl_length);
+                       $authorsig = '';
+               }
+       }
+       if(isset($handle))
+               q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
+                       intval($item['id']),
+                       dbesc($signed_text),
+                       dbesc($authorsig),
+                       dbesc($handle)
+               );
+       return;
+ }