seems to work, but only for PGP/MIME messages.

There are some minor problems, though:

The header isn't cleaned up properly. Some references to PGP remain. Thunderbird displays the message correclty, but it probably shouldn't be there.
When the message was signed originally (which is probably was, when someone uses PGP) the signature get lost in the process. I have to look into this, but if the signature is calculated over the encrypted message, it would be invalid for the encrypted message. So maybe we have to do the signature check on the server and place a note in the message, or something like that.
A lot of testing is also required, maybe some functions fail and the error is not captured somewhere.