[gmime] Updated Pkcs7 error messages



commit 888089546e179b4ed8f59a7100b162075dd3bc6f
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Fri Oct 16 11:48:27 2009 -0400

    Updated Pkcs7 error messages

 gmime/gmime-pkcs7-context.c |   11 +++++++++--
 tests/test-mime.c           |    7 +++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index 399f0e1..8cb727b 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -295,7 +295,10 @@ pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GErro
 	int errval = 0;
 	
 	if ((error = gpgme_op_keylist_start (pkcs7->ctx, name, secret)) != GPG_ERR_NO_ERROR) {
-		g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
+		if (secret)
+			g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list secret keys for \"%s\""), name);
+		else
+			g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
 		return NULL;
 	}
 	
@@ -331,7 +334,11 @@ pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GErro
 	gpgme_op_keylist_end (pkcs7->ctx);
 	
 	if (error != GPG_ERR_NO_ERROR && error != GPG_ERR_EOF) {
-		g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
+		if (secret)
+			g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list secret keys for \"%s\""), name);
+		else
+			g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
+		
 		return NULL;
 	}
 	
diff --git a/tests/test-mime.c b/tests/test-mime.c
index fe9711d..3217077 100644
--- a/tests/test-mime.c
+++ b/tests/test-mime.c
@@ -166,6 +166,13 @@ static struct {
 	{ "Canonical Patch Queue Manager<pqm pqm ubuntu com>",
 	  "Canonical Patch Queue Manager <pqm pqm ubuntu com>",
 	  "Canonical Patch Queue Manager <pqm pqm ubuntu com>" },
+	/* Some examples pulled from rfc5322 */
+	{ "Pete(A nice \\) chap) <pete(his account)@silly.test(his host)>",
+	  "Pete <pete silly test>",
+	  "Pete <pete silly test>" },
+	{ "A Group(Some people):Chris Jones <c@(Chris's host.)public.example>, joe example org, John <jdoe one test> (my dear friend); (the end of the group)",
+	  "A Group: Chris Jones <c public example>, joe example org, John <jdoe one test>;",
+	  "A Group: Chris Jones <c public example>, joe example org, John <jdoe one test>;" },
 };
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]