Diaspora: Now the application name is transmitted as well with a post.

This commit is contained in:
Michael Vogel 2014-04-22 00:58:17 +02:00
parent 10d36c324a
commit 2c3a5d72fd

View file

@ -262,7 +262,7 @@ function diaspora_pubmsg_build($msg,$user,$contact,$prvkey,$pubkey) {
logger('diaspora_pubmsg_build: ' . $msg, LOGGER_DATA); logger('diaspora_pubmsg_build: ' . $msg, LOGGER_DATA);
$handle = $user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3); $handle = $user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
// $b64_data = base64_encode($msg); // $b64_data = base64_encode($msg);
@ -276,7 +276,7 @@ function diaspora_pubmsg_build($msg,$user,$contact,$prvkey,$pubkey) {
$encoding = 'base64url'; $encoding = 'base64url';
$alg = 'RSA-SHA256'; $alg = 'RSA-SHA256';
$signable_data = $data . '.' . base64url_encode($type) . '.' $signable_data = $data . '.' . base64url_encode($type) . '.'
. base64url_encode($encoding) . '.' . base64url_encode($alg) ; . base64url_encode($encoding) . '.' . base64url_encode($alg) ;
$signature = rsa_sign($signable_data,$prvkey); $signature = rsa_sign($signable_data,$prvkey);
@ -345,7 +345,7 @@ function diaspora_msg_build($msg,$user,$contact,$prvkey,$pubkey,$public = false)
$encoding = 'base64url'; $encoding = 'base64url';
$alg = 'RSA-SHA256'; $alg = 'RSA-SHA256';
$signable_data = $data . '.' . base64url_encode($type) . '.' $signable_data = $data . '.' . base64url_encode($type) . '.'
. base64url_encode($encoding) . '.' . base64url_encode($alg) ; . base64url_encode($encoding) . '.' . base64url_encode($alg) ;
$signature = rsa_sign($signable_data,$prvkey); $signature = rsa_sign($signable_data,$prvkey);
@ -713,7 +713,7 @@ function diaspora_request($importer,$xml) {
$photos = import_profile_photo($contact_record['photo'],$importer['uid'],$contact_record['id']); $photos = import_profile_photo($contact_record['photo'],$importer['uid'],$contact_record['id']);
// technically they are sharing with us (CONTACT_IS_SHARING), // technically they are sharing with us (CONTACT_IS_SHARING),
// but if our page-type is PAGE_COMMUNITY or PAGE_SOAPBOX // but if our page-type is PAGE_COMMUNITY or PAGE_SOAPBOX
// we are going to change the relationship and make them a follower. // we are going to change the relationship and make them a follower.
@ -1603,7 +1603,7 @@ function diaspora_conversation($importer,$xml,$msg) {
'verb' => ACTIVITY_POST, 'verb' => ACTIVITY_POST,
'otype' => 'mail' 'otype' => 'mail'
)); ));
} }
return; return;
} }
@ -2301,7 +2301,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
$body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n"; $body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n";
} }
} }
} }
$public = (($item['private']) ? 'false' : 'true'); $public = (($item['private']) ? 'false' : 'true');
@ -2309,13 +2309,17 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
require_once('include/datetime.php'); require_once('include/datetime.php');
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C');
// To-Do
// Detect a share element and do a reshare
// see: https://github.com/Raven24/diaspora-federation/blob/master/lib/diaspora-federation/entities/reshare.rb
$tpl = get_markup_template('diaspora_post.tpl'); $tpl = get_markup_template('diaspora_post.tpl');
$msg = replace_macros($tpl, array( $msg = replace_macros($tpl, array(
'$body' => $body, '$body' => $body,
'$guid' => $item['guid'], '$guid' => $item['guid'],
'$handle' => xmlify($myaddr), '$handle' => xmlify($myaddr),
'$public' => $public, '$public' => $public,
'$created' => $created '$created' => $created,
'$provider' => $item["app"]
)); ));
logger('diaspora_send_status: ' . $owner['username'] . ' -> ' . $contact['name'] . ' base message: ' . $msg, LOGGER_DATA); logger('diaspora_send_status: ' . $owner['username'] . ' -> ' . $contact['name'] . ' base message: ' . $msg, LOGGER_DATA);