From b85cbb139e63d97b646aca22866aa1e440b386c8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 18 Feb 2004 16:20:19 +0000 Subject: Use the trust to decide the validity signature status. (Better way of 2004-02-18 Jeffrey Stedfast * camel-gpg-context.c (gpg_verify): Use the trust to decide the validity signature status. (Better way of solving yesterday's problem) * camel-cipher-context.h: Revert change from yesterday. svn path=/trunk/; revision=24779 --- camel/ChangeLog | 8 ++++++++ camel/camel-cipher-context.h | 10 ---------- camel/camel-gpg-context.c | 9 +++++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index ba595e60b0..766aa70734 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2004-02-18 Jeffrey Stedfast + + * camel-gpg-context.c (gpg_verify): Use the trust to decide the + validity signature status. (Better way of solving yesterday's + problem) + + * camel-cipher-context.h: Revert change from yesterday. + 2004-02-17 Jeffrey Stedfast * camel-gpg-context.c (gpg_verify): Set the trust. diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h index 6aef6ab13b..4b5dbaed42 100644 --- a/camel/camel-cipher-context.h +++ b/camel/camel-cipher-context.h @@ -62,15 +62,6 @@ enum _camel_cipher_validity_sign_t { CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN, }; -enum _camel_cipher_validity_trust_t { - CAMEL_CIPHER_VALIDITY_TRUST_NONE, - CAMEL_CIPHER_VALIDITY_TRUST_NEVER, - CAMEL_CIPHER_VALIDITY_TRUST_UNDEFINED, - CAMEL_CIPHER_VALIDITY_TRUST_MARGINAL, - CAMEL_CIPHER_VALIDITY_TRUST_FULLY, - CAMEL_CIPHER_VALIDITY_TRUST_ULTIMATE -}; - enum _camel_cipher_validity_encrypt_t { CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE, CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK, @@ -98,7 +89,6 @@ struct _CamelCipherValidity { struct { enum _camel_cipher_validity_sign_t status; - enum _camel_cipher_validity_trust_t trust; char *description; EDList signers; /* CamelCipherCertInfo's */ } sign; diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c index ca235bd0d1..306211ab99 100644 --- a/camel/camel-gpg-context.c +++ b/camel/camel-gpg-context.c @@ -1441,9 +1441,14 @@ gpg_verify (CamelCipherContext *context, CamelMimePart *ipart, CamelException *e valid = gpg_ctx_op_wait (gpg) == 0; validity = camel_cipher_validity_new (); diagnostics = gpg_ctx_get_diagnostics (gpg); - camel_cipher_validity_set_valid (validity, valid); camel_cipher_validity_set_description (validity, diagnostics); - validity->sign.trust = gpg->trust; + if (valid && gpg->trust > GPG_TRUST_NEVER) { + if (gpg->trust == GPG_TRUST_UNDEFINED) + validity->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN; + else + validity->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_GOOD; + } else + validity->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_BAD; gpg_ctx_free (gpg); if (sigfile) { -- cgit v1.2.3