diff options
author | friendica <redmatrix@redmatrix.me> | 2015-04-19 13:41:12 -0700 |
---|---|---|
committer | friendica <redmatrix@redmatrix.me> | 2015-04-19 13:41:12 -0700 |
commit | 01efda6850db9347351f290da6026d6cbc0abe49 (patch) | |
tree | 5df63503014a1f7e06483ddf06cca0f21a44e23a /include | |
parent | 0883512e30af10ea7ed0f461afc8236a828e7d2b (diff) | |
download | volse-hubzilla-01efda6850db9347351f290da6026d6cbc0abe49.tar.gz volse-hubzilla-01efda6850db9347351f290da6026d6cbc0abe49.tar.bz2 volse-hubzilla-01efda6850db9347351f290da6026d6cbc0abe49.zip |
api - unobscure mail
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 8 | ||||
-rw-r--r-- | include/text.php | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/include/api.php b/include/api.php index e4b28bc54..4b413a835 100644 --- a/include/api.php +++ b/include/api.php @@ -1588,7 +1588,7 @@ require_once('include/items.php'); return($as); } - function api_format_messages($item, $recipient, $sender) { + function api_format_message($item, $recipient, $sender) { // standard meta information $ret = array( 'id' => $item['id'], @@ -1600,7 +1600,7 @@ require_once('include/items.php'); 'recipient_screen_name' => $recipient['screen_name'], 'recipient' => $recipient, ); - unobscure($item); + unobscure_mail($item); //don't send title to regular StatusNET requests to avoid confusing these apps if (x($_GET, 'getText')) { $ret['title'] = $item['title'] ; @@ -1963,7 +1963,7 @@ require_once('include/items.php'); if ($id>-1) { $r = q("SELECT * FROM `mail` WHERE id=%d", intval($id)); - $ret = api_format_messages($r[0], $recipient, $sender); + $ret = api_format_message($r[0], $recipient, $sender); } else { $ret = array("error"=>$id); @@ -2028,7 +2028,7 @@ require_once('include/items.php'); $sender = $user_info; } - $ret[]=api_format_messages($item, $recipient, $sender); + $ret[]=api_format_message($item, $recipient, $sender); } } diff --git a/include/text.php b/include/text.php index f1f6d41f0..f8a990f58 100644 --- a/include/text.php +++ b/include/text.php @@ -1188,6 +1188,17 @@ function unobscure(&$item) { } } +function unobscure_mail(&$item) { + 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['body']) + $item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key); + } +} + + function theme_attachments(&$item) { $arr = json_decode_plus($item['attach']); |