aboutsummaryrefslogtreecommitdiffstats
path: root/include/diaspora.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/diaspora.php')
-rwxr-xr-xinclude/diaspora.php56
1 files changed, 23 insertions, 33 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index 9b2e4623a..fc7dbfa18 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -174,7 +174,7 @@ function diaspora_process_outbound($arr) {
$target_item = $arr['target_item'];
- if($target_item && array_key_exists('item_flags',$target_item) && ($target_item['item_flags'] & ITEM_OBSCURED)) {
+ if($target_item && array_key_exists('item_obscured',$target_item) && intval($target_item['item_obscured'])) {
$key = get_config('system','prvkey');
if($target_item['title'])
$target_item['title'] = crypto_unencapsulate(json_decode($target_item['title'],true),$key);
@@ -223,7 +223,7 @@ function diaspora_process_outbound($arr) {
if(! $contact['xchan_pubkey'])
continue;
- if(($target_item['item_restrict'] & ITEM_DELETED)
+ if(intval($target_item['item_deleted'])
&& (($target_item['mid'] === $target_item['parent_mid']) || $arr['followup'])) {
// send both top-level retractions and relayable retractions for owner to relay
diaspora_send_retraction($target_item,$arr['channel'],$contact);
@@ -252,8 +252,8 @@ function diaspora_process_outbound($arr) {
$contact = $arr['hub'];
- if(($target_item['deleted'])
- && ($target_item['mid'] === $target_item['parent_mod'])) {
+ if(intval($target_item['item_deleted'])
+ && ($target_item['mid'] === $target_item['parent_mid'])) {
// top-level retraction
logger('delivery: diaspora retract: ' . $loc);
diaspora_send_retraction($target_item,$arr['channel'],$contact,true);
@@ -329,7 +329,7 @@ function find_diaspora_person_by_handle($handle) {
if(! $person) {
// try webfinger. Make sure to distinguish between diaspora,
- // redmatrix w/diaspora protocol and friendica w/diaspora protocol.
+ // hubzilla w/diaspora protocol and friendica w/diaspora protocol.
$result = discover_by_webbie($handle);
if($result) {
@@ -708,6 +708,7 @@ function diaspora_request($importer,$xml) {
$msg = t('You have started sharing with a $Projectname premium channel.');
$msg .= t('$Projectname premium channels are not available for sharing with Diaspora members. This sharing request has been blocked.') . "\r";
+
$msg .= t('Please do not reply to this message, as this channel is not sharing with you and any reply will not be seen by the recipient.') . "\r";
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C');
@@ -964,9 +965,8 @@ function diaspora_post($importer,$xml,$msg) {
$datarray['app'] = $app;
- $datarray['item_flags'] = ITEM_THREAD_TOP;
$datarray['item_unseen'] = 1;
-
+ $datarray['item_thread_top'] = 1;
$tgroup = tgroup_check($importer['channel_id'],$datarray);
@@ -975,7 +975,6 @@ function diaspora_post($importer,$xml,$msg) {
return 202;
}
-
$result = item_store($datarray);
return;
@@ -1523,7 +1522,7 @@ function diaspora_comment($importer,$xml,$msg) {
$key = get_config('system','pubkey');
$x = array('signer' => $diaspora_handle, 'body' => $text,
'signed_text' => $signed_data, 'signature' => base64_encode($author_signature));
- $datarray['diaspora_meta'] = json_encode(crypto_encapsulate(json_encode($x),$key));
+ $datarray['diaspora_meta'] = json_encode($x);
}
@@ -1547,7 +1546,7 @@ function diaspora_comment($importer,$xml,$msg) {
if($result && $result['success'])
$message_id = $result['item_id'];
- if(($parent_item['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) {
+ if(intval($parent_item['item_origin']) && (! $parent_author_signature)) {
// if the message isn't already being relayed, notify others
// the existence of parent_author_signature means the parent_author or owner
// is already relaying.
@@ -1704,11 +1703,10 @@ function diaspora_conversation($importer,$xml,$msg) {
continue;
}
- $key = get_config('system','pubkey');
if($subject)
- $subject = json_encode(crypto_encapsulate($subject,$key));
+ $subject = str_rot47(base64url_encode($subject));
if($body)
- $body = json_encode(crypto_encapsulate($body,$key));
+ $body = str_rot47(base64url_encode($body));
q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_flags`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s')",
intval($importer['channel_id']),
@@ -1838,9 +1836,9 @@ function diaspora_message($importer,$xml,$msg) {
$key = get_config('system','pubkey');
if($subject)
- $subject = json_encode(crypto_encapsulate($subject,$key));
+ $subject = str_rot47(base64url_encode($subject));
if($body)
- $body = json_encode(crypto_encapsulate($body,$key));
+ $body = str_rot47(base64url_encode($body));
q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_flags`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', '%d','%s','%s','%s')",
intval($importer['channel_id']),
@@ -2137,7 +2135,7 @@ function diaspora_like($importer,$xml,$msg) {
$key = get_config('system','pubkey');
$x = array('signer' => $diaspora_handle, 'body' => $text,
'signed_text' => $signed_data, 'signature' => base64_encode($author_signature));
- $arr['diaspora_meta'] = json_encode(crypto_encapsulate(json_encode($x),$key));
+ $arr['diaspora_meta'] = json_encode($x);
}
$x = item_store($arr);
@@ -2149,7 +2147,7 @@ function diaspora_like($importer,$xml,$msg) {
// the existence of parent_author_signature means the parent_author or owner
// is already relaying. The parent_item['origin'] indicates the message was created on our system
- if(($parent_item['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature))
+ if(intval($parent_item['item_origin']) && (! $parent_author_signature))
proc_run('php','include/notifier.php','comment-import',$message_id);
return;
@@ -2258,19 +2256,12 @@ function diaspora_signed_retraction($importer,$xml,$msg) {
$r[0]['parent']
);
if($p) {
- if(($p[0]['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) {
-// FIXME so we can relay this
-// q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
-// $r[0]['id'],
-// dbesc($signed_data),
-// dbesc($sig),
-// dbesc($diaspora_handle)
-// );
+ if(intval($p[0]['item_origin']) && (! $parent_author_signature)) {
// the existence of parent_author_signature would have meant the parent_author or owner
// is already relaying.
- logger('diaspora_signed_retraction: relaying relayable_retraction');
+ logger('diaspora_signed_retraction: relaying relayable_retraction');
proc_run('php','include/notifier.php','drop',$r[0]['id']);
}
}
@@ -2611,7 +2602,7 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
$target_type = 'Post';
$positive = 'true';
- if(($item_['item_restrict'] & ITEM_DELETED))
+ if(intval($item['item_deleted']))
logger('diaspora_send_followup: received deleted "like". Those should go to diaspora_send_retraction');
}
else {
@@ -2707,7 +2698,7 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$relay_retract = false;
$sql_sign_id = 'iid';
- if( $item['item_restrict'] & ITEM_DELETED) {
+ if( intval($item['item_deleted'])) {
$relay_retract = true;
$target_type = ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
@@ -2719,7 +2710,7 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$like = true;
$target_type = ( $parent['mid'] === $parent['parent_mid'] ? 'Post' : 'Comment');
-// $positive = (($item['item_restrict'] & ITEM_DELETED) ? 'false' : 'true');
+// $positive = (intval($item['item_deleted']) ? 'false' : 'true');
$positive = 'true';
$tpl = get_markup_template('diaspora_like_relay.tpl');
@@ -2869,11 +2860,10 @@ function diaspora_send_mail($item,$owner,$contact) {
);
if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) {
- $key = get_config('system','prvkey');
-// if($item['title'])
-// $item['title'] = crypto_unencapsulate(json_decode_plus($item['title']),$key);
+ if($item['title'])
+ $item['title'] = base64url_decode(str_rot47($item['title']));
if($item['body'])
- $item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key);
+ $item['body'] = base64url_decode(str_rot47($item['body']));
}