more work client mail crypto

This commit is contained in:
zotlabs 2017-04-27 20:22:28 -07:00 committed by Mario Vavti
parent 25760e30f9
commit fdf639e1fb

View File

@ -35,13 +35,15 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
$body = cleanup_bbcode($body); $body = cleanup_bbcode($body);
$results = linkify_tags($a, $body, $uid); $results = linkify_tags($a, $body, $uid);
if(! $raw) {
if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match)) if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match)) {
$attaches = $match[1]; $attaches = $match[1];
}
}
$attachments = ''; $attachments = '';
if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) { if((! $raw) && preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
$attachments = array(); $attachments = array();
foreach($match[2] as $mtch) { foreach($match[2] as $mtch) {
$hash = substr($mtch,0,strpos($mtch,',')); $hash = substr($mtch,0,strpos($mtch,','));
@ -184,7 +186,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
if($subject) if($subject)
$subject = str_rot47(base64url_encode($subject)); $subject = str_rot47(base64url_encode($subject));
if($body) if(($body )&& (! $raw))
$body = str_rot47(base64url_encode($body)); $body = str_rot47(base64url_encode($body));
$sig = ''; // placeholder $sig = ''; // placeholder
@ -353,6 +355,9 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
if($r[$k]['body']) if($r[$k]['body'])
$r[$k]['body'] = base64url_decode(str_rot47($r[$k]['body'])); $r[$k]['body'] = base64url_decode(str_rot47($r[$k]['body']));
} }
if($r[$k]['mail_raw'])
$r[$k]['body'] = mail_prepare_binary([ 'id' => $r[$k]['id'] ]);
} }
return $r; return $r;
@ -391,6 +396,8 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee
if($messages[$k]['body']) if($messages[$k]['body'])
$messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body'])); $messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body']));
} }
if($messages[$k]['mail_raw'])
$messages[$k]['body'] = mail_prepare_binary([ 'id' => $messages[$k]['id'] ]);
} }
@ -514,6 +521,9 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda
if($messages[$k]['body']) if($messages[$k]['body'])
$messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body'])); $messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body']));
} }
if($messages[$k]['mail_raw'])
$messages[$k]['body'] = mail_prepare_binary([ 'id' => $messages[$k]['id'] ]);
} }