Upcoming GMime 3.0 changes

Jeffrey Stedfast jestedfa at microsoft.com
Mon Mar 13 15:43:14 PDT 2017


Hello notmuch devs,

I'm sending this email to inform you guys of some upcoming GMime 3.0 features and other changes that I've implemented.

1. Probably the most import change coming to GMime 3.0 is that each header field/value pair has its own raw value cache instead of using a cached stream of the entire head block, thus forcing the complete invalidation of the header cache when anything changed in the headers. In GMime 2.6, once the header cache was invalidated, each header would get re-folded when written back out to disk. This was obviously not ideal.

2. Next up is the replacement of the old custom GnuPG back-end with GpgMe. Also included with this change is full support for S/MIME via both multipart/signed and application/pkcs7-mime content-types using gpgsm (via GpgMe). During this change, I also took the liberty of simplifying the crypto API's a bit and so I was able to make it such that g_mime_multipart_signed_verify(), for example, no longer requires you to pass it a GMimeCryptoContext. Instead, GMime parses the Content-Type's protocol parameter and uses that to instantiate the correct crypto context (GMimeGpgContext for PGP and GMimePkcs7Context for S/MIME). Many of the various state properties have been replaced with bitflags that can be passed to encrypt() and decrypt(). The sign() method now also takes a detach argument (might make this into a bitflag instead?) in order to support encapsulated signing.

3. The GMimeMessage API's have been improved a bit. Gone are the old GMimeMessage API's that return strings for the From and Reply-To headers. Instead, *all* GMimeMessage API's return an InternetAddressList pointer which can be used to manipulate the parsed address header. Also improved is the g_mime_message_set_subject() method which now takes an optional charset parameter (or NULL to use the default).

4. New in GMime 3.0 is the GMimeParserOptions struct which can be passed to GMimeParser and other parser functions exposed in the lower-level API's. This structure helps define how strict/forgiving the various parsing routines should be with the input. This replaces the need for g_mime_init()'s flags so you can change these settings on the fly now.

5. Another new feature is GMimeTextPart which makes getting/setting text on a GMimePart simpler. GMimeTextPart is a subclass of GMimePart, so all of the GMimePart API's that you are used to still work but now you also have access to convenient functions like g_mime_text_part_get_text() and g_mime_text_part_set_text() which removes the need for creating streams, data wrappers, and setting them on the part.

6. Brand new rfc822 address parser which is more tolerant than the previous generation parser. What's not to love?

7. And finally we get to a nifty feature that I just hacked up while waiting for some other code to compile (hey, it takes an hour to compile... I needed something to do!) which is that GMimeParser now scans for -----BEGIN PGP MESSAGE-----/-----END PGP MESSAGE----- and -----BEGIN PGP SIGNED MESSAGE-----/-----END PGP SIGNED MESSAGE----- markers while looking for MIME boundaries and sets some state on the corresponding GMimePart that you can use to quickly decide if the part contains encapsulated OpenPGP data.


Note: for the full list of API changes made, see https://github.com/jstedfast/gmime/blob/master/PORTING

Jeff



More information about the notmuch mailing list