Vladislav Bogdanov wrote:
- You're fetching text message body twice for checking if inline
message/part is signed/encrypted. This is of course not good for performance, you should store fetched body in memory for further use (e.g. by extending get_part_content function). It will be used probably once again in plugin and again for message displaying.
Mmmm... But what about memory usage? Encrypted/signed message could be rather big. And we could hit PHP memory limit easily. I'd prefer some kind of stream-operating parser/detector therefore.
Maybe use SEARCH instead:
s SEARCH UID XXX BODY "-----BEGIN PGP MESSAGE-----"
but this is not the same as regular expression. One way or another we'll need to fetch the body for display. Maybe we should handle message bodies via (cache) files.