A.L.E.C alec at alec.pl
Thu Jan 14 20:56:56 CET 2016

On 01/13/2016 10:00 AM, Владимир Горпенко wrote:
> Hello!
> I have some questions about RCube (1.2)
> 1. rcube_message.php, lines 114-120
>          if (!empty($this->headers->structure)) {
>             $this->get_mime_numbers($this->headers->structure);
>             $this->parse_structure($this->headers->structure);
>         }
>         else {
>             $this->body = $this->storage->get_body($uid);
>         }
> Is that the whole body of unstructured (not multipart) message is stored
> in memory? 

Only, if the server didn't returned BODYSTRUCTURE for any reason. In
most cases even plain text message has structure. So, this 'else' is
more of a fallback here.

> When you use S/MIME an encrypted email is unstructured and
> can be large (tens of megabytes). Of course, if the message is decrypted
> before this place (for example, in rcube_imap) the appearance of large
> unstructured letters unlikely.

rcube_imap is not a proper place to do decryption.

> 2. What for is the function get_part_content in rcube_message.php? This
> function gets part body from the storage object (i.e. imap object) and
> not exec hook 'message_part_body'. Will it cause problems in message
> decryption?

get_part_content() is deprecated (and should not be used), we use
get_part_body() now.

> 3. The same questions about get_body in rcube_storage.php.

You should not use this method for decryption purposes.
rcube_message::get_part_body() is all you need. Sometimes I use also
get_raw_body/get_raw_headers methods of storage object.

> Also note that some plugins communicate directly with the rcube_imap, to
> get the text of the message part.

So what?

> 4. Yes, 'message_part_structure' can change the structure of the part of
> the message. But, function parse_structure in which is the challenge of
> this hook, not always called. I do not quite understand the logic of RC
> and I ask you to say whether the hook  'message_part_structure'  will
> provide normal work in these situations:
> - S/MIME ecnrypted message is not multupart message. After decryption,
> it can be a multipart or not multipart message.
> - S/MIME signed message is usually a multipart message. After
> decryption, it can be a multipart or not multipart message.
> In both situations changing of part structure is not sufficient.

Enigma has the same requirements and it works, so it's possible.

> 5. Some of message headers (Content*) have to be changed on decryption
> or sign verification. How it can be done?

I'm not sure this is exactly the same you want to do, but see how Enigma
does this. Here's the message_part_structure hook handler:
All in all S/MIME is not much different that PGP/MIME in context of
message structure.

Also worth to take a look is the place where a message is displayed
You have to modify message structure in an appropriate way.

Aleksander 'A.L.E.C' Machniak
Kolab Groupware Developer        [http://kolab.org]
Roundcube Webmail Developer  [http://roundcube.net]
PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl

More information about the dev mailing list