Merge pull request #388 from fermionic/diaspora-signature-small-cleanup

small cleanup
This commit is contained in:
fermionic 2012-07-10 18:30:55 -07:00
commit bb817cb76d
3 changed files with 1 additions and 14 deletions

View File

@ -3683,7 +3683,7 @@ function store_diaspora_retract_sig($item, $user, $baseurl) {
} }
else { else {
$r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1", $r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
$item['contact-id'] $item['contact-id'] // If this function gets called, drop_item() has already checked remote_user() == $item['contact-id']
); );
if(count($r)) { if(count($r)) {
// The below handle only works for NETWORK_DFRN. I think that's ok, because this function // The below handle only works for NETWORK_DFRN. I think that's ok, because this function

View File

@ -1039,16 +1039,11 @@ function store_diaspora_comment_sig($datarray, $author, $uprvkey, $parent_item,
require_once('include/bb2diaspora.php'); require_once('include/bb2diaspora.php');
$signed_body = html_entity_decode(bb2diaspora($datarray['body'])); $signed_body = html_entity_decode(bb2diaspora($datarray['body']));
// $myaddr = $user['nickname'] . '@' . substr($baseurl, strpos($baseurl,'://') + 3);
// if( $author['network'] === NETWORK_DIASPORA)
// $diaspora_handle = $author['addr'];
// else {
// Only works for NETWORK_DFRN // Only works for NETWORK_DFRN
$contact_baseurl_start = strpos($author['url'],'://') + 3; $contact_baseurl_start = strpos($author['url'],'://') + 3;
$contact_baseurl_length = strpos($author['url'],'/profile') - $contact_baseurl_start; $contact_baseurl_length = strpos($author['url'],'/profile') - $contact_baseurl_start;
$contact_baseurl = substr($author['url'], $contact_baseurl_start, $contact_baseurl_length); $contact_baseurl = substr($author['url'], $contact_baseurl_start, $contact_baseurl_length);
$diaspora_handle = $author['nick'] . '@' . $contact_baseurl; $diaspora_handle = $author['nick'] . '@' . $contact_baseurl;
// }
$signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $diaspora_handle; $signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $diaspora_handle;

View File

@ -245,9 +245,6 @@ function store_diaspora_like_retract_sig($activity, $item, $like_item, $contact)
if(($activity === ACTIVITY_LIKE) && (! $item['resource-id'])) { if(($activity === ACTIVITY_LIKE) && (! $item['resource-id'])) {
$signed_text = $like_item['guid'] . ';' . 'Like'; $signed_text = $like_item['guid'] . ';' . 'Like';
// if( $contact['network'] === NETWORK_DIASPORA)
// $diaspora_handle = $contact['addr'];
// else {
// Only works for NETWORK_DFRN // Only works for NETWORK_DFRN
$contact_baseurl_start = strpos($contact['url'],'://') + 3; $contact_baseurl_start = strpos($contact['url'],'://') + 3;
$contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start; $contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start;
@ -268,7 +265,6 @@ function store_diaspora_like_retract_sig($activity, $item, $like_item, $contact)
if( $r) if( $r)
$authorsig = base64_encode(rsa_sign($signed_text,$r['prvkey'],'sha256')); $authorsig = base64_encode(rsa_sign($signed_text,$r['prvkey'],'sha256'));
} }
// }
if(! isset($authorsig)) if(! isset($authorsig))
$authorsig = ''; $authorsig = '';
@ -299,9 +295,6 @@ function store_diaspora_like_sig($activity, $post_type, $contact, $post_id) {
logger('mod_like: storing diaspora like signature'); logger('mod_like: storing diaspora like signature');
if(($activity === ACTIVITY_LIKE) && ($post_type === t('status'))) { if(($activity === ACTIVITY_LIKE) && ($post_type === t('status'))) {
// if( $contact['network'] === NETWORK_DIASPORA)
// $diaspora_handle = $contact['addr'];
// else {
// Only works for NETWORK_DFRN // Only works for NETWORK_DFRN
$contact_baseurl_start = strpos($contact['url'],'://') + 3; $contact_baseurl_start = strpos($contact['url'],'://') + 3;
$contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start; $contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start;
@ -322,7 +315,6 @@ function store_diaspora_like_sig($activity, $post_type, $contact, $post_id) {
if( $r) if( $r)
$contact_uprvkey = $r['prvkey']; $contact_uprvkey = $r['prvkey'];
} }
// }
$r = q("SELECT guid, parent FROM `item` WHERE id = %d LIMIT 1", $r = q("SELECT guid, parent FROM `item` WHERE id = %d LIMIT 1",
intval($post_id) intval($post_id)