aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-04-29 16:30:11 -0700
committerzotlabs <mike@macgirvin.com>2017-04-29 16:30:11 -0700
commit230617208ba4ba81a7c9a289ba44da7319500397 (patch)
tree285d1517911d5d46e95d5734f6a88e50bebf8f70
parent033cf6138071c1707b3bb448524761f086b8a445 (diff)
downloadvolse-hubzilla-230617208ba4ba81a7c9a289ba44da7319500397.tar.gz
volse-hubzilla-230617208ba4ba81a7c9a289ba44da7319500397.tar.bz2
volse-hubzilla-230617208ba4ba81a7c9a289ba44da7319500397.zip
more work on client side e2ee
-rw-r--r--Zotlabs/Module/Mail.php26
-rw-r--r--include/message.php5
2 files changed, 25 insertions, 6 deletions
diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php
index a240ccdae..f6add7778 100644
--- a/Zotlabs/Module/Mail.php
+++ b/Zotlabs/Module/Mail.php
@@ -160,6 +160,25 @@ class Mail extends \Zotlabs\Web\Controller {
'$header' => t('Messages'),
));
+ if(argc() == 3 && intval(argv(1)) && argv(2) === 'download') {
+
+ $r = q("select * from mail where id = %d and channel_id = %d",
+ intval(argv(1)),
+ intval(local_channel())
+ );
+
+ if($r) {
+
+ header('Content-type: ' . $r[0]['mail_mimetype']);
+ header('Content-disposition: attachment; filename="' . t('message') . '-' . $r[0]['id'] . '"' );
+ $body = (($r[0]['mail_obscured']) ? base64url_decode(str_rot47($r[0]['body'])) : $r[0]['body']);
+ echo $body;
+ killme();
+ }
+
+ }
+
+
if((argc() == 4) && (argv(2) === 'drop')) {
if(! intval(argv(3)))
return;
@@ -352,6 +371,11 @@ class Mail extends \Zotlabs\Web\Controller {
foreach($messages as $message) {
$s = theme_attachments($message);
+
+ if($message['mail_raw'])
+ $message['body'] = mail_prepare_binary([ 'id' => $message['id'] ]);
+ else
+ $message['body'] = zidify_links(smilies(bbcode($message['body'])));
$mails[] = array(
'mailbox' => $mailbox,
@@ -364,7 +388,7 @@ class Mail extends \Zotlabs\Web\Controller {
'to_url' => chanlink_hash($message['to_xchan']),
'to_photo' => $message['to']['xchan_photo_s'],
'subject' => $message['title'],
- 'body' => zidify_links(smilies(bbcode($message['body']))),
+ 'body' => $message['body'],
'attachments' => $s,
'delete' => t('Delete message'),
'dreport' => t('Delivery report'),
diff --git a/include/message.php b/include/message.php
index 261a6a673..61c3e8afd 100644
--- a/include/message.php
+++ b/include/message.php
@@ -366,9 +366,6 @@ 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;
@@ -407,8 +404,6 @@ 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'] ]);
}