summaryrefslogtreecommitdiff
path: root/community/balsa
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2012-01-20 20:41:20 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2012-01-20 20:41:20 -0300
commit33fcf0e7b95e530b849e59e90fdea4001e01283d (patch)
tree5eab4f238207cce42c8351067ade9999df065a1f /community/balsa
parent3b0910bf6527c3b761d9579b2ed37a9a42595fa3 (diff)
parenta1922d0ec660fdc1892f2783515f781c090df0a9 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community/gnash/PKGBUILD community/libopenraw/PKGBUILD community/smalltalk/PKGBUILD core/coreutils/PKGBUILD core/libarchive/PKGBUILD extra/dhcp/PKGBUILD extra/gmime/PKGBUILD extra/gvfs/PKGBUILD extra/kdeutils/PKGBUILD extra/libreoffice/PKGBUILD extra/lirc/PKGBUILD extra/php-suhosin/PKGBUILD extra/qtwebkit/PKGBUILD extra/sdl_image/PKGBUILD extra/sdl_net/PKGBUILD extra/sdl_ttf/PKGBUILD extra/spamassassin/PKGBUILD extra/tftp-hpa/PKGBUILD extra/totem-plparser/PKGBUILD extra/tumbler/PKGBUILD extra/vim/PKGBUILD extra/wipe/PKGBUILD extra/xfce4-netload-plugin/PKGBUILD kde-unstable/kdebase-workspace/PKGBUILD kde-unstable/kdebase-workspace/kde-np.pam kde-unstable/kdebase-workspace/kde.pam multilib/binutils-multilib/PKGBUILD multilib/chuck/PKGBUILD multilib/dev86/PKGBUILD multilib/gcc-multilib/PKGBUILD multilib/jack2-multilib/PKGBUILD multilib/lib32-gdk-pixbuf2/PKGBUILD multilib/lib32-glib2/PKGBUILD multilib/lib32-glibc/PKGBUILD multilib/lib32-glibc/lib32-glibc.conf multilib/lib32-gtk2/PKGBUILD multilib/lib32-libpulse/PKGBUILD multilib/lib32-pango/PKGBUILD multilib/lib32-sdl_image/PKGBUILD multilib/lib32-sdl_ttf/PKGBUILD multilib/libtool-multilib/PKGBUILD multilib/nspluginwrapper/PKGBUILD multilib/q4wine/PKGBUILD multilib/wine/PKGBUILD staging/php/PKGBUILD staging/php/php-fpm.conf.in.patch staging/php/php.ini.patch
Diffstat (limited to 'community/balsa')
-rw-r--r--community/balsa/PKGBUILD55
-rw-r--r--community/balsa/balsa.install7
-rw-r--r--community/balsa/gmime26.patch1372
3 files changed, 1405 insertions, 29 deletions
diff --git a/community/balsa/PKGBUILD b/community/balsa/PKGBUILD
index da1d77a3f..9bc637420 100644
--- a/community/balsa/PKGBUILD
+++ b/community/balsa/PKGBUILD
@@ -1,44 +1,47 @@
-# $Id: PKGBUILD 51383 2011-07-08 03:41:33Z bfanella $
+# $Id: PKGBUILD 62139 2012-01-16 19:52:55Z dreisner $
# Maintainer : Ionut Biru <ibiru@archlinux.org>
# Maintainer: Brad Fanella <bradfanella@archlinux.us>
# Contributor: Roman Kyrylych <roman@archlinux.org>
pkgname=balsa
-pkgver=2.4.10
+pkgver=2.4.11
pkgrel=1
pkgdesc="An e-mail client for GNOME"
arch=('i686' 'x86_64' 'mips64el')
license=('GPL')
url='http://pawsa.fedorapeople.org/balsa/'
-depends=('gmime' 'libwebkit' 'libesmtp' 'libnotify' 'gpgme' 'gtksourceview2' 'gtkspell' 'gnome-icon-theme')
-makedepends=('perlxml' 'gnome-doc-utils' 'intltool' 'namcap')
+depends=('gmime' 'libwebkit' 'libesmtp' 'libnotify' 'gpgme' 'gtksourceview2' 'gtkspell' 'gnome-icon-theme' 'desktop-file-utils')
+makedepends=('perlxml' 'gnome-doc-utils' 'intltool')
install=balsa.install
-source=(http://pawsa.fedorapeople.org/${pkgname}/${pkgname}-${pkgver}.tar.bz2)
-md5sums=('fa2b7cb9d248912ac2e3dcc08cd6aa5b')
+source=(http://pawsa.fedorapeople.org/${pkgname}/${pkgname}-${pkgver}.tar.bz2
+ gmime26.patch)
+md5sums=('915c622b6385aa4f83d5eee8f31ee8e8'
+ '108d33f533558a371189441edce7d7e6')
build() {
- cd ${srcdir}/${pkgname}-${pkgver}
+ cd "${srcdir}/${pkgname}-${pkgver}"
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --with-ssl \
- --with-gpgme=gpgme-config \
- --with-gss \
- --with-ldap \
- --with-gtksourceview \
- --with-gtkspell \
- --with-rubrica \
- --with-sqlite \
- --without-nm \
- --without-gnome \
- --with-html-widget=webkit
-
- make
+ patch -Np1 -i "${srcdir}/gmime26.patch"
+ autoreconf -fi
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --with-ssl \
+ --with-gpgme=gpgme-config \
+ --with-gss \
+ --with-ldap \
+ --with-gtksourceview \
+ --with-gtkspell \
+ --with-rubrica \
+ --with-sqlite \
+ --without-nm \
+ --without-gnome \
+ --with-html-widget=webkit
+ make
}
package() {
- cd ${srcdir}/${pkgname}-${pkgver}
-
- make GTK_UPDATE_ICON_CACHE=/bin/true DESTDIR="${pkgdir}" install
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make GTK_UPDATE_ICON_CACHE=/bin/true DESTDIR="${pkgdir}" install
}
diff --git a/community/balsa/balsa.install b/community/balsa/balsa.install
index cb9a7a5c3..1f167b5e9 100644
--- a/community/balsa/balsa.install
+++ b/community/balsa/balsa.install
@@ -1,11 +1,12 @@
post_install() {
- gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+ gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor
+ update-desktop-database -q
}
post_upgrade() {
- post_install $1
+ post_install $1
}
post_remove() {
- post_install $1
+ post_install $1
}
diff --git a/community/balsa/gmime26.patch b/community/balsa/gmime26.patch
new file mode 100644
index 000000000..fe4e6a9fa
--- /dev/null
+++ b/community/balsa/gmime26.patch
@@ -0,0 +1,1372 @@
+From 393d0077495cb750ee47bab6ec44a60906a95179 Mon Sep 17 00:00:00 2001
+From: Peter Bloomfield <PeterBloomfield@bellsouth.net>
+Date: Mon, 28 Nov 2011 03:00:55 +0000
+Subject: Build with GMime 2.6.0
+
+ * configure.in: check for GMime >= 2.5.7
+ * libbalsa/gmime-application-pkcs7.c
+ (g_mime_application_pkcs7_sign), (g_mime_application_pkcs7_verify),
+ (g_mime_application_pkcs7_encrypt),
+ (g_mime_application_pkcs7_decrypt): build with GMime >= 2.5.7.
+ * libbalsa/gmime-application-pkcs7.h: ditto.
+ * libbalsa/gmime-gpgme-context.c (g_mime_gpgme_context_get_type),
+ (g_mime_gpgme_context_class_init), (g_mime_gpgme_context_finalize),
+ (g_mime_gpgme_digest_id): ditto.
+ * libbalsa/gmime-gpgme-context.h: ditto.
+ * libbalsa/gmime-part-rfc2440.c (g_mime_part_rfc2440_sign_encrypt),
+ (g_mime_part_rfc2440_verify), (g_mime_part_rfc2440_decrypt):
+ ditto.
+ * libbalsa/gmime-part-rfc2440.h: ditto.
+ * libbalsa/rfc3156.c (password_request_func),
+ (libbalsa_sign_mime_object), (libbalsa_encrypt_mime_object),
+ (libbalsa_body_check_signature), (libbalsa_body_decrypt): ditto.
+---
+diff --git a/ChangeLog b/ChangeLog
+index bd95e68..d5c62f5 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,25 @@
++2011-11-27 Peter Bloomfield
++
++ Build with GMime 2.6.0
++
++ * configure.in: check for GMime >= 2.5.7
++ * libbalsa/gmime-application-pkcs7.c
++ (g_mime_application_pkcs7_sign), (g_mime_application_pkcs7_verify),
++ (g_mime_application_pkcs7_encrypt),
++ (g_mime_application_pkcs7_decrypt): build with GMime >= 2.5.7.
++ * libbalsa/gmime-application-pkcs7.h: ditto.
++ * libbalsa/gmime-gpgme-context.c (g_mime_gpgme_context_get_type),
++ (g_mime_gpgme_context_class_init), (g_mime_gpgme_context_finalize),
++ (g_mime_gpgme_digest_id): ditto.
++ * libbalsa/gmime-gpgme-context.h: ditto.
++ * libbalsa/gmime-part-rfc2440.c (g_mime_part_rfc2440_sign_encrypt),
++ (g_mime_part_rfc2440_verify), (g_mime_part_rfc2440_decrypt):
++ ditto.
++ * libbalsa/gmime-part-rfc2440.h: ditto.
++ * libbalsa/rfc3156.c (password_request_func),
++ (libbalsa_sign_mime_object), (libbalsa_encrypt_mime_object),
++ (libbalsa_body_check_signature), (libbalsa_body_decrypt): ditto.
++
+ 2011-11-22 Pawel Salek
+
+ * NEWS, configure.in: release balsa-2.4.11
+diff --git a/configure.in b/configure.in
+index 4a8320e..64d99f3 100644
+--- a/configure.in
++++ b/configure.in
+@@ -307,7 +307,12 @@ fi
+ case "$with_gmime" in
+ 2.4) ;;
+ 2.6) AC_DEFINE([HAVE_GMIME_2_6], [1],
+- [Defined to build with GMime version 2.5 or 2.6]) ;;
++ [Defined to build with GMime version 2.5 or 2.6])
++ if $PKG_CONFIG --atleast-version=2.5.7 gmime-2.6; then
++ AC_DEFINE([HAVE_GMIME_2_5_7], [1],
++ [Defined when GMime version is at least 2.5.7])
++ fi
++ ;;
+ *) AC_MSG_ERROR([unknown GMime version $with_gmime]) ;;
+ esac
+
+diff --git a/libbalsa/gmime-application-pkcs7.c b/libbalsa/gmime-application-pkcs7.c
+index 12f4f8f..63b8087 100644
+--- a/libbalsa/gmime-application-pkcs7.c
++++ b/libbalsa/gmime-application-pkcs7.c
+@@ -96,8 +96,14 @@ g_mime_application_pkcs7_sign (GMimePart *pkcs7, GMimeObject *content,
+ GMimeFilter *crlf_filter, *from_filter;
+
+ g_return_val_if_fail (GMIME_IS_PART (pkcs7), -1);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (ctx->sign_protocol != NULL, -1);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
++ g_return_val_if_fail(g_mime_crypto_context_get_signature_protocol(ctx)
++ != NULL, -1);
++#endif /* HAVE_GMIME_2_5_7 */
+ g_return_val_if_fail (GMIME_IS_OBJECT (content), -1);
+
+ /* Prepare all the parts for signing... */
+@@ -127,7 +133,14 @@ g_mime_application_pkcs7_sign (GMimePart *pkcs7, GMimeObject *content,
+ sig_data_stream = g_mime_stream_mem_new ();
+
+ /* get the signed content */
+- if (g_mime_cipher_context_sign (ctx, userid, GMIME_CIPHER_HASH_DEFAULT, filtered_stream, sig_data_stream, err) == -1) {
++#ifndef HAVE_GMIME_2_5_7
++ if (g_mime_cipher_context_sign (ctx, userid, GMIME_CIPHER_HASH_DEFAULT, filtered_stream, sig_data_stream, err) == -1)
++#else /* HAVE_GMIME_2_5_7 */
++ if (g_mime_crypto_context_sign
++ (ctx, userid, GMIME_CIPHER_HASH_DEFAULT, filtered_stream,
++ sig_data_stream, err) == -1)
++#endif /* HAVE_GMIME_2_5_7 */
++ {
+ g_object_unref (filtered_stream);
+ g_object_unref (sig_data_stream);
+ g_object_unref (stream);
+@@ -168,9 +181,15 @@ g_mime_application_pkcs7_sign (GMimePart *pkcs7, GMimeObject *content,
+ * decrypting it again. In this case, validity is undefined.
+ */
+ GMimeObject *
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_application_pkcs7_verify(GMimePart * pkcs7,
+ GMimeSignatureValidity ** validity,
+ GMimeCipherContext * ctx, GError ** err)
++#else /* HAVE_GMIME_2_5_7 */
++g_mime_application_pkcs7_verify(GMimePart * pkcs7,
++ GMimeSignatureList ** list,
++ GMimeCryptoContext * ctx, GError ** err)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeObject *decrypted;
+ GMimeDataWrapper *wrapper;
+@@ -181,8 +200,14 @@ g_mime_application_pkcs7_verify(GMimePart * pkcs7,
+ const char *smime_type;
+
+ g_return_val_if_fail(GMIME_IS_PART(pkcs7), NULL);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail(GMIME_IS_CIPHER_CONTEXT(ctx), NULL);
+ g_return_val_if_fail(ctx->encrypt_protocol != NULL, NULL);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail(GMIME_IS_CRYPTO_CONTEXT(ctx), NULL);
++ g_return_val_if_fail(g_mime_crypto_context_get_encryption_protocol(ctx)
++ != NULL, NULL);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* some sanity checks */
+ smime_type =
+@@ -208,9 +233,16 @@ g_mime_application_pkcs7_verify(GMimePart * pkcs7,
+ g_object_unref(crlf_filter);
+
+ /* get the cleartext */
++#ifndef HAVE_GMIME_2_5_7
+ *validity = g_mime_cipher_context_verify(ctx, GMIME_CIPHER_HASH_DEFAULT,
+ ciphertext, filtered_stream, err);
+- if (!*validity) {
++ if (!*validity)
++#else /* HAVE_GMIME_2_5_7 */
++ *list = g_mime_crypto_context_verify(ctx, GMIME_CIPHER_ALGO_DEFAULT,
++ ciphertext, filtered_stream, err);
++ if (!*list)
++#endif /* HAVE_GMIME_2_5_7 */
++ {
+ g_object_unref(filtered_stream);
+ g_object_unref(ciphertext);
+ g_object_unref(stream);
+@@ -248,7 +280,12 @@ g_mime_application_pkcs7_verify(GMimePart * pkcs7,
+ */
+ int
+ g_mime_application_pkcs7_encrypt (GMimePart *pkcs7, GMimeObject *content,
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext *ctx, GPtrArray *recipients,
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext *ctx,
++ GPtrArray *recipients,
++#endif /* HAVE_GMIME_2_5_7 */
+ GError **err)
+ {
+ GMimeDataWrapper *wrapper;
+@@ -257,8 +294,14 @@ g_mime_application_pkcs7_encrypt (GMimePart *pkcs7, GMimeObject *content,
+ GMimeFilter *crlf_filter;
+
+ g_return_val_if_fail (GMIME_IS_PART (pkcs7), -1);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (ctx->encrypt_protocol != NULL, -1);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
++ g_return_val_if_fail(g_mime_crypto_context_get_encryption_protocol(ctx)
++ != NULL, -1);
++#endif /* HAVE_GMIME_2_5_7 */
+ g_return_val_if_fail (GMIME_IS_OBJECT (content), -1);
+
+ /* get the cleartext */
+@@ -279,7 +322,15 @@ g_mime_application_pkcs7_encrypt (GMimePart *pkcs7, GMimeObject *content,
+
+ /* encrypt the content stream */
+ ciphertext = g_mime_stream_mem_new ();
+- if (g_mime_cipher_context_encrypt (ctx, FALSE, NULL, recipients, stream, ciphertext, err) == -1) {
++#ifndef HAVE_GMIME_2_5_7
++ if (g_mime_cipher_context_encrypt (ctx, FALSE, NULL, recipients, stream, ciphertext, err) == -1)
++#else /* HAVE_GMIME_2_5_7 */
++ if (g_mime_crypto_context_encrypt
++ (ctx, FALSE, NULL,
++ GMIME_CIPHER_ALGO_DEFAULT,
++ recipients, stream, ciphertext, err) == -1)
++#endif /* HAVE_GMIME_2_5_7 */
++ {
+ g_object_unref (ciphertext);
+ g_object_unref (stream);
+ return -1;
+@@ -313,8 +364,14 @@ g_mime_application_pkcs7_encrypt (GMimePart *pkcs7, GMimeObject *content,
+ * err with more information about the reason.
+ */
+ GMimeObject *
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_application_pkcs7_decrypt (GMimePart *pkcs7, GMimeCipherContext *ctx,
+ GError **err)
++#else /* HAVE_GMIME_2_5_7 */
++g_mime_application_pkcs7_decrypt (GMimePart *pkcs7,
++ GMimeCryptoContext *ctx,
++ GError **err)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeObject *decrypted;
+ GMimeDataWrapper *wrapper;
+@@ -325,8 +382,14 @@ g_mime_application_pkcs7_decrypt (GMimePart *pkcs7, GMimeCipherContext *ctx,
+ const char *smime_type;
+
+ g_return_val_if_fail(GMIME_IS_PART(pkcs7), NULL);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail(GMIME_IS_CIPHER_CONTEXT(ctx), NULL);
+ g_return_val_if_fail(ctx->encrypt_protocol != NULL, NULL);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail(GMIME_IS_CRYPTO_CONTEXT(ctx), NULL);
++ g_return_val_if_fail(g_mime_crypto_context_get_encryption_protocol(ctx)
++ != NULL, NULL);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* some sanity checks */
+ smime_type =
+@@ -353,7 +416,13 @@ g_mime_application_pkcs7_decrypt (GMimePart *pkcs7, GMimeCipherContext *ctx,
+ g_object_unref(crlf_filter);
+
+ /* get the cleartext */
+- if (g_mime_cipher_context_decrypt(ctx, ciphertext, filtered_stream, err) == NULL) {
++#ifndef HAVE_GMIME_2_5_7
++ if (g_mime_cipher_context_decrypt(ctx, ciphertext, filtered_stream, err) == NULL)
++#else /* HAVE_GMIME_2_5_7 */
++ if (g_mime_crypto_context_decrypt
++ (ctx, ciphertext, filtered_stream, err) == NULL)
++#endif /* HAVE_GMIME_2_5_7 */
++ {
+ g_object_unref(filtered_stream);
+ g_object_unref(ciphertext);
+ g_object_unref(stream);
+diff --git a/libbalsa/gmime-application-pkcs7.h b/libbalsa/gmime-application-pkcs7.h
+index 03fa401..6678ff5 100644
+--- a/libbalsa/gmime-application-pkcs7.h
++++ b/libbalsa/gmime-application-pkcs7.h
+@@ -28,7 +28,11 @@ extern "C" {
+ #endif /* __cplusplus */
+
+ #include <gmime/gmime-part.h>
++#ifndef HAVE_GMIME_2_5_7
+ #include <gmime/gmime-cipher-context.h>
++#else /* HAVE_GMIME_2_5_7 */
++#include <gmime/gmime-crypto-context.h>
++#endif /* HAVE_GMIME_2_5_7 */
+
+ #undef HAS_APPLICATION_PKCS7_MIME_SIGNED_SUPPORT
+
+@@ -39,21 +43,40 @@ extern "C" {
+ * Balsa always encodes S/MIME signed stuff as multipart/signed. */
+ int g_mime_application_pkcs7_sign(GMimePart * pkcs7,
+ GMimeObject * content,
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext * ctx,
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext * ctx,
++#endif /* HAVE_GMIME_2_5_7 */
+ const char *userid, GError ** err);
+ #endif
+
++#ifndef HAVE_GMIME_2_5_7
+ GMimeObject *g_mime_application_pkcs7_verify(GMimePart * pkcs7,
+ GMimeSignatureValidity ** validity,
+ GMimeCipherContext * ctx, GError ** err);
++#else /* HAVE_GMIME_2_5_7 */
++GMimeObject *g_mime_application_pkcs7_verify(GMimePart * pkcs7,
++ GMimeSignatureList ** validity,
++ GMimeCryptoContext * ctx, GError ** err);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ int g_mime_application_pkcs7_encrypt(GMimePart * pkcs7,
+ GMimeObject * content,
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext * ctx,
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext * ctx,
++#endif /* HAVE_GMIME_2_5_7 */
+ GPtrArray * recipients, GError ** err);
+
++#ifndef HAVE_GMIME_2_5_7
+ GMimeObject *g_mime_application_pkcs7_decrypt(GMimePart * pkcs7,
+ GMimeCipherContext * ctx, GError ** err);
++#else /* HAVE_GMIME_2_5_7 */
++GMimeObject *g_mime_application_pkcs7_decrypt(GMimePart * pkcs7,
++ GMimeCryptoContext * ctx, GError ** err);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ #ifdef __cplusplus
+ }
+diff --git a/libbalsa/gmime-gpgme-context.c b/libbalsa/gmime-gpgme-context.c
+index 24b140b..0c56f94 100644
+--- a/libbalsa/gmime-gpgme-context.c
++++ b/libbalsa/gmime-gpgme-context.c
+@@ -27,6 +27,9 @@
+ #include <unistd.h>
+ #include <glib.h>
+ #include <gmime/gmime.h>
++#ifdef HAVE_GMIME_2_5_7
++#include <gmime/gmime-certificate.h>
++#endif /* HAVE_GMIME_2_5_7 */
+ #include <gpgme.h>
+ #include <time.h>
+ #include <glib/gi18n.h>
+@@ -44,6 +47,7 @@ static gboolean g_mime_gpgme_context_check_protocol(GMimeGpgmeContextClass
+ protocol,
+ GError ** error);
+
++#ifndef HAVE_GMIME_2_5_7
+ static GMimeCipherHash g_mime_gpgme_hash_id(GMimeCipherContext * ctx,
+ const char *hash);
+
+@@ -70,6 +74,46 @@ static GMimeSignatureValidity *g_mime_gpgme_decrypt(GMimeCipherContext *
+ GMimeStream * istream,
+ GMimeStream * ostream,
+ GError ** err);
++#else /* HAVE_GMIME_2_5_7 */
++static GMimeDigestAlgo g_mime_gpgme_digest_id(GMimeCryptoContext * ctx,
++ const char *hash);
++
++static const char *g_mime_gpgme_digest_name(GMimeCryptoContext * ctx,
++ GMimeDigestAlgo hash);
++
++static const char
++ *g_mime_gpgme_get_signature_protocol(GMimeCryptoContext * context);
++static const char
++ *g_mime_gpgme_get_encryption_protocol(GMimeCryptoContext * context);
++static const char
++ *g_mime_gpgme_get_key_exchange_protocol(GMimeCryptoContext * context);
++
++static int g_mime_gpgme_sign(GMimeCryptoContext * ctx,
++ const char * userid,
++ GMimeDigestAlgo hash,
++ GMimeStream * istream,
++ GMimeStream * ostream,
++ GError ** err);
++
++static GMimeSignatureList *g_mime_gpgme_verify(GMimeCryptoContext * ctx,
++ GMimeDigestAlgo hash,
++ GMimeStream * istream,
++ GMimeStream * sigstream,
++ GError ** err);
++
++static int g_mime_gpgme_encrypt(GMimeCryptoContext * ctx,
++ gboolean sign,
++ const char *userid,
++ GMimeDigestAlgo digest,
++ GPtrArray * recipients,
++ GMimeStream * istream,
++ GMimeStream * ostream, GError ** err);
++
++static GMimeDecryptResult *g_mime_gpgme_decrypt(GMimeCryptoContext * ctx,
++ GMimeStream * istream,
++ GMimeStream * ostream,
++ GError ** err);
++#endif /* HAVE_GMIME_2_5_7 */
+
+
+ /* internal passphrase callback */
+@@ -102,7 +146,11 @@ static void g_set_error_from_gpgme(GError ** error, gpgme_error_t gpgme_err,
+ const gchar * message);
+
+
++#ifndef HAVE_GMIME_2_5_7
+ static GMimeCipherContextClass *parent_class = NULL;
++#else /* HAVE_GMIME_2_5_7 */
++static GMimeCryptoContextClass *parent_class = NULL;
++#endif /* HAVE_GMIME_2_5_7 */
+
+
+ GType
+@@ -124,8 +172,13 @@ g_mime_gpgme_context_get_type(void)
+ };
+
+ type =
++#ifndef HAVE_GMIME_2_5_7
+ g_type_register_static(GMIME_TYPE_CIPHER_CONTEXT,
+ "GMimeGpgmeContext", &info, 0);
++#else /* HAVE_GMIME_2_5_7 */
++ g_type_register_static(GMIME_TYPE_CRYPTO_CONTEXT,
++ "GMimeGpgmeContext", &info, 0);
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+ return type;
+@@ -136,19 +189,39 @@ static void
+ g_mime_gpgme_context_class_init(GMimeGpgmeContextClass * klass)
+ {
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContextClass *cipher_class =
+ GMIME_CIPHER_CONTEXT_CLASS(klass);
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContextClass *crypto_class =
++ GMIME_CRYPTO_CONTEXT_CLASS(klass);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ parent_class = g_type_class_ref(G_TYPE_OBJECT);
+
+ object_class->finalize = g_mime_gpgme_context_finalize;
+
++#ifndef HAVE_GMIME_2_5_7
+ cipher_class->hash_id = g_mime_gpgme_hash_id;
+ cipher_class->hash_name = g_mime_gpgme_hash_name;
+ cipher_class->sign = g_mime_gpgme_sign;
+ cipher_class->verify = g_mime_gpgme_verify;
+ cipher_class->encrypt = g_mime_gpgme_encrypt;
+ cipher_class->decrypt = g_mime_gpgme_decrypt;
++#else /* HAVE_GMIME_2_5_7 */
++ crypto_class->digest_id = g_mime_gpgme_digest_id;
++ crypto_class->digest_name = g_mime_gpgme_digest_name;
++ crypto_class->get_signature_protocol =
++ g_mime_gpgme_get_signature_protocol;
++ crypto_class->get_encryption_protocol =
++ g_mime_gpgme_get_encryption_protocol;
++ crypto_class->get_key_exchange_protocol =
++ g_mime_gpgme_get_key_exchange_protocol;
++ crypto_class->sign = g_mime_gpgme_sign;
++ crypto_class->verify = g_mime_gpgme_verify;
++ crypto_class->encrypt = g_mime_gpgme_encrypt;
++ crypto_class->decrypt = g_mime_gpgme_decrypt;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) ==
+ GPG_ERR_NO_ERROR)
+@@ -190,7 +263,11 @@ g_mime_gpgme_context_finalize(GObject * object)
+ }
+
+ #if !defined(HAVE_GMIME_2_6)
++#ifndef HAVE_GMIME_2_5_7
+ g_object_unref(GMIME_CIPHER_CONTEXT(ctx)->session);
++#else /* HAVE_GMIME_2_5_7 */
++ g_object_unref(GMIME_CRYPTO_CONTEXT(ctx)->session);
++#endif /* HAVE_GMIME_2_5_7 */
+ #endif /* HAVE_GMIME_2_6 */
+
+ G_OBJECT_CLASS(parent_class)->finalize(object);
+@@ -200,15 +277,26 @@ g_mime_gpgme_context_finalize(GObject * object)
+ /*
+ * Convert a hash algorithm name to a number
+ */
++#ifndef HAVE_GMIME_2_5_7
+ static GMimeCipherHash
+ g_mime_gpgme_hash_id(GMimeCipherContext * ctx, const char *hash)
++#else /* HAVE_GMIME_2_5_7 */
++static GMimeDigestAlgo
++g_mime_gpgme_digest_id(GMimeCryptoContext * ctx, const char *hash)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
++#ifndef HAVE_GMIME_2_5_7
+ if (hash == NULL)
+ return GMIME_CIPHER_HASH_DEFAULT;
++#else /* HAVE_GMIME_2_5_7 */
++ if (hash == NULL)
++ return GMIME_DIGEST_ALGO_DEFAULT;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ if (!g_ascii_strcasecmp(hash, "pgp-"))
+ hash += 4;
+
++#ifndef HAVE_GMIME_2_5_7
+ if (!g_ascii_strcasecmp(hash, "md2"))
+ return GMIME_CIPHER_HASH_MD2;
+ else if (!g_ascii_strcasecmp(hash, "md5"))
+@@ -223,6 +311,22 @@ g_mime_gpgme_hash_id(GMimeCipherContext * ctx, const char *hash)
+ return GMIME_CIPHER_HASH_HAVAL5160;
+
+ return GMIME_CIPHER_HASH_DEFAULT;
++#else /* HAVE_GMIME_2_5_7 */
++ if (!g_ascii_strcasecmp(hash, "md2"))
++ return GMIME_DIGEST_ALGO_MD2;
++ else if (!g_ascii_strcasecmp(hash, "md5"))
++ return GMIME_DIGEST_ALGO_MD5;
++ else if (!g_ascii_strcasecmp(hash, "sha1"))
++ return GMIME_DIGEST_ALGO_SHA1;
++ else if (!g_ascii_strcasecmp(hash, "ripemd160"))
++ return GMIME_DIGEST_ALGO_RIPEMD160;
++ else if (!g_ascii_strcasecmp(hash, "tiger192"))
++ return GMIME_DIGEST_ALGO_TIGER192;
++ else if (!g_ascii_strcasecmp(hash, "haval-5-160"))
++ return GMIME_DIGEST_ALGO_HAVAL5160;
++
++ return GMIME_DIGEST_ALGO_DEFAULT;
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+
+@@ -230,7 +334,11 @@ g_mime_gpgme_hash_id(GMimeCipherContext * ctx, const char *hash)
+ * Convert a hash algorithm number to a string
+ */
+ static const char *
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_gpgme_hash_name(GMimeCipherContext * context, GMimeCipherHash hash)
++#else /* HAVE_GMIME_2_5_7 */
++g_mime_gpgme_digest_name(GMimeCryptoContext * context, GMimeDigestAlgo hash)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeGpgmeContext *ctx = GMIME_GPGME_CONTEXT(context);
+ char *p;
+@@ -239,6 +347,7 @@ g_mime_gpgme_hash_name(GMimeCipherContext * context, GMimeCipherHash hash)
+ g_return_val_if_fail(ctx->gpgme_ctx, NULL);
+
+ /* note: this is only a subset of the hash algorithms gpg(me) supports */
++#ifndef HAVE_GMIME_2_5_7
+ switch (hash) {
+ case GMIME_CIPHER_HASH_MD2:
+ p = "pgp-md2";
+@@ -258,6 +367,27 @@ g_mime_gpgme_hash_name(GMimeCipherContext * context, GMimeCipherHash hash)
+ case GMIME_CIPHER_HASH_HAVAL5160:
+ p = "pgp-haval-5-160";
+ break;
++#else /* HAVE_GMIME_2_5_7 */
++ switch (hash) {
++ case GMIME_DIGEST_ALGO_MD2:
++ p = "pgp-md2";
++ break;
++ case GMIME_DIGEST_ALGO_MD5:
++ p = "pgp-md5";
++ break;
++ case GMIME_DIGEST_ALGO_SHA1:
++ p = "pgp-sha1";
++ break;
++ case GMIME_DIGEST_ALGO_RIPEMD160:
++ p = "pgp-ripemd160";
++ break;
++ case GMIME_DIGEST_ALGO_TIGER192:
++ p = "pgp-tiger192";
++ break;
++ case GMIME_DIGEST_ALGO_HAVAL5160:
++ p = "pgp-haval-5-160";
++ break;
++#endif /* HAVE_GMIME_2_5_7 */
+ default:
+ if (!(p = ctx->micalg))
+ return p;
+@@ -270,6 +400,29 @@ g_mime_gpgme_hash_name(GMimeCipherContext * context, GMimeCipherHash hash)
+ return p;
+ }
+
++#ifdef HAVE_GMIME_2_5_7
++static const char *
++g_mime_gpgme_get_signature_protocol(GMimeCryptoContext * context)
++{
++ GMimeGpgmeContext *ctx = GMIME_GPGME_CONTEXT(context);
++ return ctx->sign_protocol;
++}
++
++static const char *
++g_mime_gpgme_get_encryption_protocol(GMimeCryptoContext * context)
++{
++ GMimeGpgmeContext *ctx = GMIME_GPGME_CONTEXT(context);
++ return ctx->encrypt_protocol;
++}
++
++static const char *
++g_mime_gpgme_get_key_exchange_protocol(GMimeCryptoContext * context)
++{
++ GMimeGpgmeContext *ctx = GMIME_GPGME_CONTEXT(context);
++ return ctx->key_protocol;
++}
++
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /*
+ * Wrapper to convert the passphrase returned from the gmime session to gpgme.
+@@ -279,7 +432,11 @@ g_mime_session_passphrase(void *HOOK, const char *UID_HINT,
+ const char *PASSPHRASE_INFO, int PREV_WAS_BAD,
+ int FD)
+ {
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext *ctx = GMIME_CIPHER_CONTEXT(HOOK);
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext *ctx = GMIME_CRYPTO_CONTEXT(HOOK);
++#endif /* HAVE_GMIME_2_5_7 */
+ #if defined(HAVE_GMIME_2_6)
+ GMimeStream *stream;
+ gboolean rc;
+@@ -366,9 +523,15 @@ cb_data_release(void *handle)
+ * arg, but set the value in the context.
+ */
+ static int
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_gpgme_sign(GMimeCipherContext * context, const char *userid,
+ GMimeCipherHash hash, GMimeStream * istream,
+ GMimeStream * ostream, GError ** error)
++#else /* HAVE_GMIME_2_5_7 */
++g_mime_gpgme_sign(GMimeCryptoContext * context, const char *userid,
++ GMimeDigestAlgo hash, GMimeStream * istream,
++ GMimeStream * ostream, GError ** error)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeGpgmeContext *ctx = (GMimeGpgmeContext *) context;
+ gpgme_sig_mode_t sig_mode;
+@@ -460,6 +623,7 @@ g_mime_gpgme_sign(GMimeCipherContext * context, const char *userid,
+ }
+
+
++#ifndef HAVE_GMIME_2_5_7
+ /*
+ * In standard mode, verify that sigstream contains a detached signature for
+ * istream. In single-part mode (RFC 2440, RFC 2633 application/pkcs7-mime),
+@@ -471,13 +635,33 @@ static GMimeSignatureValidity *
+ g_mime_gpgme_verify(GMimeCipherContext * context, GMimeCipherHash hash,
+ GMimeStream * istream, GMimeStream * sigstream,
+ GError ** error)
++#else /* HAVE_GMIME_2_5_7 */
++/*
++ * In standard mode, verify that sigstream contains a detached signature for
++ * istream. In single-part mode (RFC 2440, RFC 2633 application/pkcs7-mime),
++ * istream contains clearsigned data, and sigstream will be filled with the
++ * verified plaintext. The routine returns a GMimeSignatureList object.
++ * More information is saved in the context's signature object.
++ * On error error is set accordingly.
++ */
++static GMimeSignatureList *
++g_mime_gpgme_verify(GMimeCryptoContext * context, GMimeDigestAlgo hash,
++ GMimeStream * istream, GMimeStream * sigstream,
++ GError ** error)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeGpgmeContext *ctx = (GMimeGpgmeContext *) context;
+ gpgme_ctx_t gpgme_ctx;
+ gpgme_protocol_t protocol;
+ gpgme_error_t err;
+ gpgme_data_t msg, sig;
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *validity;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeSignatureList *list;
++ GMimeSignature *signature;
++
++#endif /* HAVE_GMIME_2_5_7 */
+ struct gpgme_data_cbs cbs = {
+ (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd, /* read method */
+ (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
+@@ -521,6 +705,7 @@ g_mime_gpgme_verify(GMimeCipherContext * context, GMimeCipherHash hash,
+ ctx->sig_state =
+ g_mime_gpgme_sigstat_new_from_gpgme_ctx(gpgme_ctx);
+
++#ifndef HAVE_GMIME_2_5_7
+ validity = g_mime_signature_validity_new();
+ if (ctx->sig_state) {
+ switch (ctx->sig_state->status)
+@@ -536,12 +721,44 @@ g_mime_gpgme_verify(GMimeCipherContext * context, GMimeCipherHash hash,
+ }
+ } else
+ g_mime_signature_validity_set_status(validity, GMIME_SIGNATURE_STATUS_UNKNOWN);
++#else /* HAVE_GMIME_2_5_7 */
++ list = g_mime_signature_list_new();
++ signature = g_mime_signature_new();
++ g_mime_signature_list_add(list, signature);
++
++ if (ctx->sig_state) {
++ switch (ctx->sig_state->status)
++ {
++ case GPG_ERR_NO_ERROR:
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_GOOD);
++ break;
++ case GPG_ERR_NOT_SIGNED:
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_ERROR);
++ g_mime_signature_set_errors(signature,
++ GMIME_SIGNATURE_ERROR_NONE);
++ break;
++ default:
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_BAD);
++ }
++ } else {
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_ERROR);
++ g_mime_signature_set_errors(signature, GMIME_SIGNATURE_ERROR_NONE);
++ }
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* release gmgme data buffers */
+ gpgme_data_release(msg);
+ gpgme_data_release(sig);
+
++#ifndef HAVE_GMIME_2_5_7
+ return validity;
++#else /* HAVE_GMIME_2_5_7 */
++ return list;
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+
+@@ -549,10 +766,19 @@ g_mime_gpgme_verify(GMimeCipherContext * context, GMimeCipherHash hash,
+ * Encrypt istream to ostream for recipients. If sign is set, sign by userid.
+ */
+ static int
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_gpgme_encrypt(GMimeCipherContext * context, gboolean sign,
+ const char *userid, GPtrArray * recipients,
+ GMimeStream * istream, GMimeStream * ostream,
+ GError ** error)
++#else /* HAVE_GMIME_2_5_7 */
++g_mime_gpgme_encrypt(GMimeCryptoContext * context, gboolean sign,
++ const char *userid,
++ GMimeDigestAlgo digest,
++ GPtrArray * recipients,
++ GMimeStream * istream, GMimeStream * ostream,
++ GError ** error)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeGpgmeContext *ctx = (GMimeGpgmeContext *) context;
+ gpgme_ctx_t gpgme_ctx;
+@@ -653,9 +879,15 @@ g_mime_gpgme_encrypt(GMimeCipherContext * context, gboolean sign,
+ * Decrypt istream to ostream. In RFC 2440 mode, also try to check an included
+ * signature (if any).
+ */
++#ifndef HAVE_GMIME_2_5_7
+ static GMimeSignatureValidity *
+ g_mime_gpgme_decrypt(GMimeCipherContext * context, GMimeStream * istream,
+ GMimeStream * ostream, GError ** error)
++#else /* HAVE_GMIME_2_5_7 */
++static GMimeDecryptResult *
++g_mime_gpgme_decrypt(GMimeCryptoContext * context, GMimeStream * istream,
++ GMimeStream * ostream, GError ** error)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ GMimeGpgmeContext *ctx = (GMimeGpgmeContext *) context;
+ gpgme_ctx_t gpgme_ctx;
+@@ -668,7 +900,13 @@ g_mime_gpgme_decrypt(GMimeCipherContext * context, GMimeStream * istream,
+ NULL, /* seek method */
+ cb_data_release /* release method */
+ };
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *validity;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeDecryptResult *result;
++ GMimeSignatureList *list;
++ GMimeSignature *signature;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* some paranoia checks */
+ g_return_val_if_fail(ctx, NULL);
+@@ -716,6 +954,7 @@ g_mime_gpgme_decrypt(GMimeCipherContext * context, GMimeStream * istream,
+ /* try to get information about the signature (if any) */
+ ctx->sig_state = g_mime_gpgme_sigstat_new_from_gpgme_ctx(gpgme_ctx);
+
++#ifndef HAVE_GMIME_2_5_7
+ validity = g_mime_signature_validity_new();
+ if (ctx->sig_state) {
+ switch (ctx->sig_state->status)
+@@ -733,14 +972,57 @@ g_mime_gpgme_decrypt(GMimeCipherContext * context, GMimeStream * istream,
+ g_mime_signature_validity_set_status(validity, GMIME_SIGNATURE_STATUS_UNKNOWN);
+
+ return validity;
++#else /* HAVE_GMIME_2_5_7 */
++ list = g_mime_signature_list_new();
++ signature = g_mime_signature_new();
++ g_mime_signature_list_add(list, signature);
++ result = g_mime_decrypt_result_new();
++ g_mime_decrypt_result_set_signatures(result, list);
++
++ if (ctx->sig_state) {
++ switch (ctx->sig_state->status)
++ {
++ case GPG_ERR_NO_ERROR:
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_GOOD);
++ break;
++ case GPG_ERR_NOT_SIGNED:
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_ERROR);
++ g_mime_signature_set_errors(signature,
++ GMIME_SIGNATURE_ERROR_NONE);
++ break;
++ default:
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_BAD);
++ }
++ } else {
++ g_mime_signature_set_status(signature,
++ GMIME_SIGNATURE_STATUS_ERROR);
++ g_mime_signature_set_errors(signature, GMIME_SIGNATURE_ERROR_NONE);
++ }
++
++ return result;
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+
++#ifndef HAVE_GMIME_2_5_7
+ /*
+ * Create a new gpgme cipher context with protocol. If anything fails, return
+ * NULL and set error.
+ */
++#else /* HAVE_GMIME_2_5_7 */
++/*
++ * Create a new gpgme crypto context with protocol. If anything fails, return
++ * NULL and set error.
++ */
++#endif /* HAVE_GMIME_2_5_7 */
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext *
++#else /* HAVE_GMIME_2_5_7 */
++GMimeCryptoContext *
++#endif /* HAVE_GMIME_2_5_7 */
+ #if defined(HAVE_GMIME_2_6)
+ g_mime_gpgme_context_new(GMimePasswordRequestFunc request_passwd,
+ gpgme_protocol_t protocol, GError ** error)
+@@ -749,7 +1031,11 @@ g_mime_gpgme_context_new(GMimeSession * session,
+ gpgme_protocol_t protocol, GError ** error)
+ #endif /* HAVE_GMIME_2_6 */
+ {
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext *cipher;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext *crypto;
++#endif /* HAVE_GMIME_2_5_7 */
+ GMimeGpgmeContext *ctx;
+ gpgme_error_t err;
+ gpgme_ctx_t gpgme_ctx;
+@@ -766,14 +1052,22 @@ g_mime_gpgme_context_new(GMimeSession * session,
+ return NULL;
+ }
+
++#ifndef HAVE_GMIME_2_5_7
+ /* create the cipher context */
++#else /* HAVE_GMIME_2_5_7 */
++ /* create the crypto context */
++#endif /* HAVE_GMIME_2_5_7 */
+ ctx = g_object_new(GMIME_TYPE_GPGME_CONTEXT, NULL, NULL);
+ if (!ctx) {
+ gpgme_release(gpgme_ctx);
+ return NULL;
+ } else
+ ctx->gpgme_ctx = gpgme_ctx;
++#ifndef HAVE_GMIME_2_5_7
+ cipher = (GMimeCipherContext *) ctx;
++#else /* HAVE_GMIME_2_5_7 */
++ crypto = (GMimeCryptoContext *) ctx;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* check if the requested protocol is available */
+ if (!g_mime_gpgme_context_check_protocol
+@@ -785,23 +1079,47 @@ g_mime_gpgme_context_new(GMimeSession * session,
+
+ /* setup according to requested protocol */
+ #if defined(HAVE_GMIME_2_6)
++#ifndef HAVE_GMIME_2_5_7
+ cipher->request_passwd = request_passwd;
++#else /* HAVE_GMIME_2_5_7 */
++ crypto->request_passwd = request_passwd;
++#endif /* HAVE_GMIME_2_5_7 */
+ #else /* HAVE_GMIME_2_6 */
++#ifndef HAVE_GMIME_2_5_7
+ cipher->session = session;
++#else /* HAVE_GMIME_2_5_7 */
++ crypto->session = session;
++#endif /* HAVE_GMIME_2_5_7 */
+ g_object_ref(session);
+ #endif /* HAVE_GMIME_2_6 */
+ gpgme_set_protocol(gpgme_ctx, protocol);
+ if (protocol == GPGME_PROTOCOL_OpenPGP) {
++#ifndef HAVE_GMIME_2_5_7
+ cipher->sign_protocol = "application/pgp-signature";
+ cipher->encrypt_protocol = "application/pgp-encrypted";
+ cipher->key_protocol = NULL; /* FIXME */
++#else /* HAVE_GMIME_2_5_7 */
++ ctx->sign_protocol = "application/pgp-signature";
++ ctx->encrypt_protocol = "application/pgp-encrypted";
++ ctx->key_protocol = NULL; /* FIXME */
++#endif /* HAVE_GMIME_2_5_7 */
+ } else {
++#ifndef HAVE_GMIME_2_5_7
+ cipher->sign_protocol = "application/pkcs7-signature";
+ cipher->encrypt_protocol = "application/pkcs7-mime";
+ cipher->key_protocol = NULL; /* FIXME */
++#else /* HAVE_GMIME_2_5_7 */
++ ctx->sign_protocol = "application/pkcs7-signature";
++ ctx->encrypt_protocol = "application/pkcs7-mime";
++ ctx->key_protocol = NULL; /* FIXME */
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
++#ifndef HAVE_GMIME_2_5_7
+ return cipher;
++#else /* HAVE_GMIME_2_5_7 */
++ return crypto;
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+
+diff --git a/libbalsa/gmime-gpgme-context.h b/libbalsa/gmime-gpgme-context.h
+index 585d927..19c5fae 100644
+--- a/libbalsa/gmime-gpgme-context.h
++++ b/libbalsa/gmime-gpgme-context.h
+@@ -63,7 +63,11 @@ typedef gboolean(*GMimeGpgmeKeyTrustCB) (const gchar * name,
+ GMimeGpgmeContext * ctx);
+
+ struct _GMimeGpgmeContext {
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext parent_object;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext parent_object;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ gpgme_ctx_t gpgme_ctx; /* gpgme context */
+ gboolean singlepart_mode; /* set context to single-part mode (RFC 2440, 2633) */
+@@ -73,11 +77,21 @@ struct _GMimeGpgmeContext {
+ GMimeGpgmeKeySelectCB key_select_cb; /* key selection callback */
+ GMimeGpgmeKeyTrustCB key_trust_cb; /* low trust key cb */
+ gpgme_passphrase_cb_t passphrase_cb; /* passphrase callback */
++#ifdef HAVE_GMIME_2_5_7
++
++ const gchar *sign_protocol;
++ const gchar *encrypt_protocol;
++ const gchar *key_protocol;
++#endif /* HAVE_GMIME_2_5_7 */
+ };
+
+
+ struct _GMimeGpgmeContextClass {
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContextClass parent_class;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContextClass parent_class;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ gboolean has_proto_openpgp;
+ gboolean has_proto_cms;
+@@ -86,10 +100,17 @@ struct _GMimeGpgmeContextClass {
+
+ GType g_mime_gpgme_context_get_type(void);
+ #if defined(HAVE_GMIME_2_6)
++#ifndef HAVE_GMIME_2_5_7
+ GMimeCipherContext *g_mime_gpgme_context_new(GMimePasswordRequestFunc
+ request_passwd,
+ gpgme_protocol_t protocol,
+ GError ** error);
++#else /* HAVE_GMIME_2_5_7 */
++GMimeCryptoContext *g_mime_gpgme_context_new(GMimePasswordRequestFunc
++ request_passwd,
++ gpgme_protocol_t protocol,
++ GError ** error);
++#endif /* HAVE_GMIME_2_5_7 */
+ #else /* HAVE_GMIME_2_6 */
+ GMimeCipherContext *g_mime_gpgme_context_new(GMimeSession * session,
+ gpgme_protocol_t protocol,
+diff --git a/libbalsa/gmime-part-rfc2440.c b/libbalsa/gmime-part-rfc2440.c
+index 795d2e1..e79c4cb 100644
+--- a/libbalsa/gmime-part-rfc2440.c
++++ b/libbalsa/gmime-part-rfc2440.c
+@@ -112,8 +112,13 @@ g_mime_part_rfc2440_sign_encrypt(GMimePart * part,
+
+ g_return_val_if_fail(GMIME_IS_PART(part), -1);
+ g_return_val_if_fail(GMIME_IS_GPGME_CONTEXT(ctx), -1);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail(GMIME_CIPHER_CONTEXT(ctx)->sign_protocol != NULL,
+ -1);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail(g_mime_crypto_context_get_signature_protocol
++ (GMIME_CRYPTO_CONTEXT(ctx)) != NULL, -1);
++#endif /* HAVE_GMIME_2_5_7 */
+ g_return_val_if_fail(recipients != NULL || sign_userid != NULL, -1);
+
+ /* get the raw content */
+@@ -131,14 +136,27 @@ g_mime_part_rfc2440_sign_encrypt(GMimePart * part,
+ ctx->singlepart_mode = TRUE;
+ if (recipients == NULL)
+ result =
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_cipher_context_sign(GMIME_CIPHER_CONTEXT(ctx), sign_userid,
+ GMIME_CIPHER_HASH_DEFAULT, stream,
+ cipherstream, err);
++#else /* HAVE_GMIME_2_5_7 */
++ g_mime_crypto_context_sign(GMIME_CRYPTO_CONTEXT(ctx), sign_userid,
++ GMIME_CIPHER_ALGO_DEFAULT, stream,
++ cipherstream, err);
++#endif /* HAVE_GMIME_2_5_7 */
+ else
+ result =
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_cipher_context_encrypt(GMIME_CIPHER_CONTEXT(ctx),
+ sign_userid != NULL, sign_userid,
+ recipients, stream, cipherstream, err);
++#else /* HAVE_GMIME_2_5_7 */
++ g_mime_crypto_context_encrypt(GMIME_CRYPTO_CONTEXT(ctx),
++ sign_userid != NULL, sign_userid,
++ GMIME_CIPHER_ALGO_DEFAULT,
++ recipients, stream, cipherstream, err);
++#endif /* HAVE_GMIME_2_5_7 */
+ if (result == -1) {
+ g_object_unref(cipherstream);
+ return -1;
+@@ -202,18 +220,31 @@ g_mime_part_rfc2440_sign_encrypt(GMimePart * part,
+ * set on err to provide more information. Upon success, the content
+ * of part is replaced by the verified output of the crypto engine.
+ */
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *
++#else /* HAVE_GMIME_2_5_7 */
++GMimeSignatureList *
++#endif /* HAVE_GMIME_2_5_7 */
+ g_mime_part_rfc2440_verify(GMimePart * part,
+ GMimeGpgmeContext * ctx, GError ** err)
+ {
+ GMimeStream *stream, *plainstream;
+ GMimeDataWrapper * wrapper;
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *valid;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeSignatureList *list;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ g_return_val_if_fail(GMIME_IS_PART(part), NULL);
+ g_return_val_if_fail(GMIME_IS_GPGME_CONTEXT(ctx), NULL);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail(GMIME_CIPHER_CONTEXT(ctx)->sign_protocol != NULL,
+ NULL);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail(g_mime_crypto_context_get_signature_protocol
++ (GMIME_CRYPTO_CONTEXT(ctx)) != NULL, NULL);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* get the raw content */
+ wrapper = g_mime_part_get_content_object(GMIME_PART(part));
+@@ -227,13 +258,25 @@ g_mime_part_rfc2440_verify(GMimePart * part,
+
+ /* verify the signature */
+ ctx->singlepart_mode = TRUE;
++#ifndef HAVE_GMIME_2_5_7
+ valid =
+ g_mime_cipher_context_verify(GMIME_CIPHER_CONTEXT(ctx),
+ GMIME_CIPHER_HASH_DEFAULT, stream,
+ plainstream, err);
++#else /* HAVE_GMIME_2_5_7 */
++ list =
++ g_mime_crypto_context_verify(GMIME_CRYPTO_CONTEXT(ctx),
++ GMIME_CIPHER_ALGO_DEFAULT, stream,
++ plainstream, err);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* upon success, replace the signed content by the checked one */
+- if (valid) {
++#ifndef HAVE_GMIME_2_5_7
++ if (valid)
++#else /* HAVE_GMIME_2_5_7 */
++ if (list)
++#endif /* HAVE_GMIME_2_5_7 */
++ {
+ GMimeDataWrapper *wrapper = g_mime_data_wrapper_new();
+
+ g_mime_data_wrapper_set_stream(wrapper, plainstream);
+@@ -242,7 +285,11 @@ g_mime_part_rfc2440_verify(GMimePart * part,
+ }
+ g_object_unref(plainstream);
+
++#ifndef HAVE_GMIME_2_5_7
+ return valid;
++#else /* HAVE_GMIME_2_5_7 */
++ return list;
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+
+@@ -255,19 +302,32 @@ g_mime_part_rfc2440_verify(GMimePart * part,
+ * verified and the result is placed in ctx by the underlying gpgme
+ * context.
+ */
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *
++#else /* HAVE_GMIME_2_5_7 */
++GMimeDecryptResult *
++#endif /* HAVE_GMIME_2_5_7 */
+ g_mime_part_rfc2440_decrypt(GMimePart * part,
+ GMimeGpgmeContext * ctx, GError ** err)
+ {
+ GMimeStream *stream, *plainstream;
+ GMimeDataWrapper * wrapper;
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *result;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeDecryptResult *result;
++#endif /* HAVE_GMIME_2_5_7 */
+ gchar *headbuf = g_malloc0(1024);
+
+ g_return_val_if_fail(GMIME_IS_PART(part), NULL);
+ g_return_val_if_fail(GMIME_IS_GPGME_CONTEXT(ctx), NULL);
++#ifndef HAVE_GMIME_2_5_7
+ g_return_val_if_fail(GMIME_CIPHER_CONTEXT(ctx)->encrypt_protocol !=
+ NULL, NULL);
++#else /* HAVE_GMIME_2_5_7 */
++ g_return_val_if_fail(g_mime_crypto_context_get_encryption_protocol
++ (GMIME_CRYPTO_CONTEXT(ctx)) != NULL, NULL);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ /* get the raw content */
+ wrapper = g_mime_part_get_content_object(part);
+@@ -284,8 +344,13 @@ g_mime_part_rfc2440_decrypt(GMimePart * part,
+
+ /* decrypt and (if possible) verify the input */
+ result =
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_cipher_context_decrypt(GMIME_CIPHER_CONTEXT(ctx), stream,
+ plainstream, err);
++#else /* HAVE_GMIME_2_5_7 */
++ g_mime_crypto_context_decrypt(GMIME_CRYPTO_CONTEXT(ctx), stream,
++ plainstream, err);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ if (result != NULL) {
+ GMimeStream *filter_stream;
+diff --git a/libbalsa/gmime-part-rfc2440.h b/libbalsa/gmime-part-rfc2440.h
+index 48be5a4..cc1901a 100644
+--- a/libbalsa/gmime-part-rfc2440.h
++++ b/libbalsa/gmime-part-rfc2440.h
+@@ -53,12 +53,21 @@ int g_mime_part_rfc2440_sign_encrypt(GMimePart * part,
+ GPtrArray * recipients,
+ const char *sign_userid,
+ GError ** err);
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *g_mime_part_rfc2440_verify(GMimePart * part,
+ GMimeGpgmeContext * ctx,
+ GError ** err);
+ GMimeSignatureValidity *g_mime_part_rfc2440_decrypt(GMimePart * part,
+ GMimeGpgmeContext *
+ ctx, GError ** err);
++#else /* HAVE_GMIME_2_5_7 */
++GMimeSignatureList *g_mime_part_rfc2440_verify(GMimePart * part,
++ GMimeGpgmeContext * ctx,
++ GError ** err);
++GMimeDecryptResult *g_mime_part_rfc2440_decrypt(GMimePart * part,
++ GMimeGpgmeContext * ctx,
++ GError ** err);
++#endif /* HAVE_GMIME_2_5_7 */
+
+ #ifdef __cplusplus
+ }
+diff --git a/libbalsa/rfc3156.c b/libbalsa/rfc3156.c
+index a56e12c..df4a2e1 100644
+--- a/libbalsa/rfc3156.c
++++ b/libbalsa/rfc3156.c
+@@ -268,9 +268,15 @@ libbalsa_message_body_protection(LibBalsaMessageBody * body)
+
+ #if defined(HAVE_GMIME_2_6)
+ static gboolean
++#ifndef HAVE_GMIME_2_5_7
+ password_request_func(GMimeCipherContext * ctx, const char *user_id,
+ const char *prompt_ctx, gboolean reprompt,
+ GMimeStream * response, GError ** err)
++#else /* HAVE_GMIME_2_5_7 */
++password_request_func(GMimeCryptoContext * ctx, const char *user_id,
++ const char *prompt_ctx, gboolean reprompt,
++ GMimeStream * response, GError ** err)
++#endif /* HAVE_GMIME_2_5_7 */
+ {
+ gint fd;
+ gchar *name_used;
+@@ -366,9 +372,16 @@ libbalsa_sign_mime_object(GMimeObject ** content, const gchar * rfc822_for,
+ return FALSE;
+ }
+
++#ifndef HAVE_GMIME_2_5_7
+ if (g_mime_multipart_signed_sign
+ (mps, *content, GMIME_CIPHER_CONTEXT(ctx), rfc822_for,
+- GMIME_CIPHER_HASH_DEFAULT, error) != 0) {
++ GMIME_CIPHER_HASH_DEFAULT, error) != 0)
++#else /* HAVE_GMIME_2_5_7 */
++ if (g_mime_multipart_signed_sign
++ (mps, *content, GMIME_CRYPTO_CONTEXT(ctx), rfc822_for,
++ GMIME_DIGEST_ALGO_DEFAULT, error) != 0)
++#endif /* HAVE_GMIME_2_5_7 */
++ {
+ g_object_unref(mps);
+ g_object_unref(ctx);
+ #if !defined(HAVE_GMIME_2_6)
+@@ -458,10 +471,18 @@ libbalsa_encrypt_mime_object(GMimeObject ** content, GList * rfc822_for,
+
+ encrypted_obj = GMIME_OBJECT(mpe);
+ result =
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_multipart_encrypted_encrypt(mpe, *content,
+ GMIME_CIPHER_CONTEXT(ctx),
+ FALSE, NULL,
+ recipients, error);
++#else /* HAVE_GMIME_2_5_7 */
++ g_mime_multipart_encrypted_encrypt(mpe, *content,
++ GMIME_CRYPTO_CONTEXT(ctx),
++ FALSE, NULL,
++ GMIME_DIGEST_ALGO_DEFAULT,
++ recipients, error);
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+ #ifdef HAVE_SMIME
+ else {
+@@ -471,9 +492,15 @@ libbalsa_encrypt_mime_object(GMimeObject ** content, GList * rfc822_for,
+ encrypted_obj = GMIME_OBJECT(pkcs7);
+ ctx->singlepart_mode = TRUE;
+ result =
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_application_pkcs7_encrypt(pkcs7, *content,
+ GMIME_CIPHER_CONTEXT(ctx),
+ recipients, error);
++#else /* HAVE_GMIME_2_5_7 */
++ g_mime_application_pkcs7_encrypt(pkcs7, *content,
++ GMIME_CRYPTO_CONTEXT(ctx),
++ recipients, error);
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+ #endif
+
+@@ -565,8 +592,14 @@ libbalsa_body_check_signature(LibBalsaMessageBody * body,
+ #if !defined(HAVE_GMIME_2_6)
+ GMimeSession *session;
+ #endif /* HAVE_GMIME_2_6 */
+- GMimeCipherContext *ctx;
++#ifndef HAVE_GMIME_2_5_7
++ GMimeCipherContext *g_mime_ctx;
+ GMimeSignatureValidity *valid;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeCryptoContext *g_mime_ctx;
++ GMimeSignatureList *valid;
++#endif /* HAVE_GMIME_2_5_7 */
++ GMimeGpgmeContext *ctx;
+ GError *error = NULL;
+
+ /* paranoia checks */
+@@ -592,12 +625,12 @@ libbalsa_body_check_signature(LibBalsaMessageBody * body,
+ /* try to create GMimeGpgMEContext */
+ #if !defined(HAVE_GMIME_2_6)
+ session = g_object_new(g_mime_session_get_type(), NULL, NULL);
+- ctx = g_mime_gpgme_context_new(session, protocol, &error);
++ g_mime_ctx = g_mime_gpgme_context_new(session, protocol, &error);
+ #else /* HAVE_GMIME_2_6 */
+- ctx =
++ g_mime_ctx =
+ g_mime_gpgme_context_new(password_request_func, protocol, &error);
+ #endif /* HAVE_GMIME_2_6 */
+- if (ctx == NULL) {
++ if (g_mime_ctx == NULL) {
+ if (error) {
+ libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
+ _("creating a gpgme context failed"),
+@@ -613,6 +646,7 @@ libbalsa_body_check_signature(LibBalsaMessageBody * body,
+ body->parts->next->sig_info->status = GPGME_SIG_STAT_ERROR;
+ return FALSE;
+ }
++ ctx = GMIME_GPGME_CONTEXT(g_mime_ctx);
+
+ /* S/MIME uses the protocol application/pkcs7-signature, but some ancient
+ mailers, not yet knowing RFC 2633, use application/x-pkcs7-signature,
+@@ -622,14 +656,19 @@ libbalsa_body_check_signature(LibBalsaMessageBody * body,
+ g_mime_object_get_content_type_parameter(GMIME_OBJECT (body->mime_part),
+ "protocol");
+ if (!g_ascii_strcasecmp(cms_protocol, "application/x-pkcs7-signature"))
++#ifndef HAVE_GMIME_2_5_7
++ g_mime_ctx->sign_protocol = cms_protocol;
++#else /* HAVE_GMIME_2_5_7 */
+ ctx->sign_protocol = cms_protocol;
++#endif /* HAVE_GMIME_2_5_7 */
+ }
+
+ /* verify the signature */
+
+ libbalsa_mailbox_lock_store(body->message->mailbox);
+ valid = g_mime_multipart_signed_verify(GMIME_MULTIPART_SIGNED
+- (body->mime_part), ctx, &error);
++ (body->mime_part), g_mime_ctx,
++ &error);
+ libbalsa_mailbox_unlock_store(body->message->mailbox);
+
+ if (valid == NULL) {
+@@ -642,12 +681,16 @@ libbalsa_body_check_signature(LibBalsaMessageBody * body,
+ libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+ _("signature verification failed"));
+ }
+- if (GMIME_GPGME_CONTEXT(ctx)->sig_state) {
+- body->parts->next->sig_info = GMIME_GPGME_CONTEXT(ctx)->sig_state;
++ if (ctx->sig_state) {
++ body->parts->next->sig_info = ctx->sig_state;
+ g_object_ref(G_OBJECT(body->parts->next->sig_info));
+ }
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_signature_validity_free(valid);
+- g_object_unref(ctx);
++#else /* HAVE_GMIME_2_5_7 */
++ g_object_unref(valid);
++#endif /* HAVE_GMIME_2_5_7 */
++ g_object_unref(g_mime_ctx);
+ #if !defined(HAVE_GMIME_2_6)
+ g_object_unref(session);
+ #endif /* HAVE_GMIME_2_6 */
+@@ -747,14 +790,26 @@ libbalsa_body_decrypt(LibBalsaMessageBody * body,
+ libbalsa_mailbox_lock_store(body->message->mailbox);
+ if (protocol == GPGME_PROTOCOL_OpenPGP)
+ mime_obj =
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_multipart_encrypted_decrypt(GMIME_MULTIPART_ENCRYPTED(body->mime_part),
+ GMIME_CIPHER_CONTEXT(ctx),
+ &error);
++#else /* HAVE_GMIME_2_5_7 */
++ g_mime_multipart_encrypted_decrypt(GMIME_MULTIPART_ENCRYPTED(body->mime_part),
++ GMIME_CRYPTO_CONTEXT(ctx),
++ NULL,
++ &error);
++#endif /* HAVE_GMIME_2_5_7 */
+ #ifdef HAVE_SMIME
+ else if (smime_signed) {
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *valid;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeSignatureList *valid;
++#endif /* HAVE_GMIME_2_5_7 */
+
+ ctx->singlepart_mode = TRUE;
++#ifndef HAVE_GMIME_2_5_7
+ mime_obj =
+ g_mime_application_pkcs7_verify(GMIME_PART(body->mime_part),
+ &valid,
+@@ -766,6 +821,19 @@ libbalsa_body_decrypt(LibBalsaMessageBody * body,
+ g_mime_application_pkcs7_decrypt(GMIME_PART(body->mime_part),
+ GMIME_CIPHER_CONTEXT(ctx),
+ &error);
++#else /* HAVE_GMIME_2_5_7 */
++ mime_obj =
++ g_mime_application_pkcs7_verify(GMIME_PART(body->mime_part),
++ &valid,
++ GMIME_CRYPTO_CONTEXT(ctx),
++ &error);
++ g_object_unref(valid);
++ } else
++ mime_obj =
++ g_mime_application_pkcs7_decrypt(GMIME_PART(body->mime_part),
++ GMIME_CRYPTO_CONTEXT(ctx),
++ &error);
++#endif /* HAVE_GMIME_2_5_7 */
+ #endif
+ libbalsa_mailbox_unlock_store(body->message->mailbox);
+
+@@ -906,7 +974,11 @@ libbalsa_rfc2440_verify(GMimePart * part, GMimeGpgmeSigstat ** sig_info)
+ GMimeSession *session;
+ #endif /* HAVE_GMIME_2_6 */
+ GMimeGpgmeContext *ctx;
++#ifndef HAVE_GMIME_2_5_7
+ GMimeSignatureValidity *valid;
++#else /* HAVE_GMIME_2_5_7 */
++ GMimeSignatureList *valid;
++#endif /* HAVE_GMIME_2_5_7 */
+ GError *error = NULL;
+ gpgme_error_t retval;
+
+@@ -978,7 +1050,11 @@ libbalsa_rfc2440_verify(GMimePart * part, GMimeGpgmeSigstat ** sig_info)
+ }
+
+ /* clean up */
++#ifndef HAVE_GMIME_2_5_7
+ g_mime_signature_validity_free(valid);
++#else /* HAVE_GMIME_2_5_7 */
++ g_object_unref(valid);
++#endif /* HAVE_GMIME_2_5_7 */
+ retval = ctx->sig_state->status;
+ g_object_unref(ctx);
+ #if !defined(HAVE_GMIME_2_6)
+--
+cgit v0.9.0.2