From 2950ce49eff42eb08cd4363975a3292692cbccd8 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Mon, 11 Jun 2012 04:20:53 -0400 Subject: [PATCH] Merge branch 'master' of github.com:roundcube/roundcubemail --- program/include/rcmail.php | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index a10a2aa..8ec8cfe 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1997,6 +1997,31 @@ } + /** + * Returns real size (calculated) of the message part + * + * @param rcube_message_part Message part + * + * @return string Part size (and unit) + */ + public function message_part_size($part) + { + if (isset($part->d_parameters['size'])) { + $size = $this->show_bytes((int)$part->d_parameters['size']); + } + else { + $size = $part->size; + if ($part->encoding == 'base64') { + $size = $size / 1.33; + } + + $size = '~' . $this->show_bytes($size); + } + + return $size; + } + + /************************************************************************ ********* Deprecated methods (to be removed) ********* ***********************************************************************/ -- Gitblit v1.9.1