aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-04-27 20:22:28 -0700
committerzotlabs <mike@macgirvin.com>2017-04-27 20:22:28 -0700
commit70e17f91940cb7347d59a6b0d0f59facc2c3ce5c (patch)
treebbc924c22f8d2c2666d75b46840d42b254d52cb2
parent89e7e5e4fbafa9bac7263513315f89cfe7ac02fb (diff)
downloadvolse-hubzilla-70e17f91940cb7347d59a6b0d0f59facc2c3ce5c.tar.gz
volse-hubzilla-70e17f91940cb7347d59a6b0d0f59facc2c3ce5c.tar.bz2
volse-hubzilla-70e17f91940cb7347d59a6b0d0f59facc2c3ce5c.zip
more work client mail crypto
-rw-r--r--include/message.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/message.php b/include/message.php
index fd9c6ece1..261a6a673 100644
--- a/include/message.php
+++ b/include/message.php
@@ -45,13 +45,15 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
$body = cleanup_bbcode($body);
$results = linkify_tags($a, $body, $uid);
-
- if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match))
- $attaches = $match[1];
+ if(! $raw) {
+ if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match)) {
+ $attaches = $match[1];
+ }
+ }
$attachments = '';
- if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
+ if((! $raw) && preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
$attachments = array();
foreach($match[2] as $mtch) {
$hash = substr($mtch,0,strpos($mtch,','));
@@ -194,7 +196,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
if($subject)
$subject = str_rot47(base64url_encode($subject));
- if($body)
+ if(($body )&& (! $raw))
$body = str_rot47(base64url_encode($body));
$sig = ''; // placeholder
@@ -364,6 +366,9 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
if($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;
@@ -402,6 +407,8 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee
if($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'] ]);
}
@@ -525,6 +532,9 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda
if($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'] ]);
+
}