aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-04-29 16:30:11 -0700
committerMario Vavti <mario@mariovavti.com>2017-05-01 15:12:43 +0200
commitcbc906c438ceefe7265700a4a4e44527b3738e4c (patch)
treeb443934d1cbc859f9c542d0fd12ce0158e3df377 /Zotlabs/Module
parentd57169fcf6120dc4d653856eb2207f0fbc73b3bf (diff)
downloadvolse-hubzilla-cbc906c438ceefe7265700a4a4e44527b3738e4c.tar.gz
volse-hubzilla-cbc906c438ceefe7265700a4a4e44527b3738e4c.tar.bz2
volse-hubzilla-cbc906c438ceefe7265700a4a4e44527b3738e4c.zip
more work on client side e2ee
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Mail.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php
index 52f1ddf32..d605a78a9 100644
--- a/Zotlabs/Module/Mail.php
+++ b/Zotlabs/Module/Mail.php
@@ -178,6 +178,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;
@@ -370,6 +389,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,
@@ -382,7 +406,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'),