roundcubemail/program/lib/Roundcube/rcube_imap_cache.php
private function message_object_prepare(&$msg, &$size = 0)
    {
        // Remove body too big
        if (isset($msg->body)) {
            $length = strlen($msg->body);

            if ($msg->body_modified || $size + $length > $this->threshold * 1024) {
                unset($msg->body);
            }
            else {
                $size += $length;
            }
        }

        // Fix mimetype which might be broken by some code when message is displayed
        // Another solution would be to use object's copy in rcube_message class
        // to prevent related issues, however I'm not sure which is better
        if ($msg->mimetype) {
            list($msg->ctype_primary, $msg->ctype_secondary) = explode('/', $msg->mimetype);
        }

        unset($msg->replaces);

        if (is_object($msg->structure)) {
            $this->message_object_prepare($msg->structure, $size);
        }

        if (is_array($msg->parts)) {
            foreach ($msg->parts as $part) {
                $this->message_object_prepare($part, $size);
            }
        }
    }
private function message_object_prepare(&$msg, &$size = 0)
    {
        // Remove body too big
        if (isset($msg->body)) {
            $length = strlen($msg->body);

            if ($msg->body_modified || $size + $length > $this->threshold * 1024) {
                unset($msg->body);
            }
            else {
                $size += $length;
            }
        }

        // Fix mimetype which might be broken by some code when message is displayed
        // Another solution would be to use object's copy in rcube_message class
        // to prevent related issues, however I'm not sure which is better
        if ($msg->mimetype) {
            list($msg->ctype_primary, $msg->ctype_secondary) = explode('/', $msg->mimetype);
        }

        unset($msg->replaces);

        if (is_object($msg->structure)) {
            $this->message_object_prepare($msg->structure, $size);
        }

        if (is_array($msg->parts)) {
            foreach ($msg->parts as $part) {
                $this->message_object_prepare($part, $size);
            }
        }
    }
private function message_object_prepare ( & $ msg , & $ size = 0 ) { // Remove body too big if ( isset ( $ msg -> body ) ) { $ length = strlen ( $ msg -> body ) ; if ( $ msg -> body_modified || $ size + $ length > $ this -> threshold * 1024 ) { unset ( $ msg -> body ) ; } else { $ size += $ length ; } } // Fix mimetype which might be broken by some code when message is displayed // Another solution would be to use object's copy in rcube_message class // to prevent related issues, however I'm not sure which is better if ( $ msg -> mimetype ) { list ( $ msg -> ctype_primary , $ msg -> ctype_secondary ) = explode ( '/' , $ msg -> mimetype ) ; } unset ( $ msg -> replaces ) ; if ( is_object ( $ msg -> structure ) ) { $ this -> message_object_prepare ( $ msg -> structure , $ size ) ; } if ( is_array ( $ msg -> parts ) ) { foreach ( $ msg -> parts as $ part ) { $ this -> message_object_prepare ( $ part , $ size ) ; } } }
Prepares message object to be stored in database.

@param rcube_message_header|rcube_message_part
Prepares message object to be stored in database .