gmime r1316 - in trunk: . docs/reference gmime tests



Author: fejj
Date: Sat May 31 20:49:49 2008
New Revision: 1316
URL: http://svn.gnome.org/viewvc/gmime?rev=1316&view=rev

Log:
2008-05-31  Jeffrey Stedfast  <fejj novell com>

	* gmime/gmime-gpg-context.c: Updated.

	* gmime/gmime-cipher-context.c (g_mime_signer_next): New function
	to ease binding.
	(g_mime_signer_set_status): Same.
	(g_mime_signer_get_status): Same.
	(g_mime_signer_set_error): Same.
	(g_mime_signer_get_error): Same.
	(g_mime_signer_set_trust): Same.
	(g_mime_signer_get_trust): Same.
	(g_mime_signer_set_fingerprint): Same.
	(g_mime_signer_get_fingerprint): Same.
	(g_mime_signer_set_key_id): Same.
	(g_mime_signer_get_key_id): Same.
	(g_mime_signer_set_name): Same.
	(g_mime_signer_get_name): Same.
	(g_mime_signer_set_sig_created): Same.
	(g_mime_signer_get_sig_created): Same.
	(g_mime_signer_set_sig_expire): Same.
	(g_mime_signer_get_sig_expire): Same.



Modified:
   trunk/ChangeLog
   trunk/docs/reference/gmime-sections.txt
   trunk/docs/reference/gmime.hierarchy
   trunk/gmime/gmime-cipher-context.c
   trunk/gmime/gmime-cipher-context.h
   trunk/gmime/gmime-disposition.c
   trunk/gmime/gmime-gpg-context.c
   trunk/gmime/gmime-header.c
   trunk/tests/test-pgpmime.c

Modified: trunk/docs/reference/gmime-sections.txt
==============================================================================
--- trunk/docs/reference/gmime-sections.txt	(original)
+++ trunk/docs/reference/gmime-sections.txt	Sat May 31 20:49:49 2008
@@ -1052,6 +1052,23 @@
 <SUBSECTION>
 g_mime_signer_new
 g_mime_signer_free
+g_mime_signer_next
+g_mime_signer_get_status
+g_mime_signer_set_status
+g_mime_signer_get_errors
+g_mime_signer_set_errors
+g_mime_signer_get_trust
+g_mime_signer_set_trust
+g_mime_signer_get_fingerprint
+g_mime_signer_set_fingerprint
+g_mime_signer_get_key_id
+g_mime_signer_set_key_id
+g_mime_signer_get_name
+g_mime_signer_set_name
+g_mime_signer_get_created
+g_mime_signer_set_created
+g_mime_signer_get_expires
+g_mime_signer_set_expires
 <SUBSECTION>
 g_mime_signature_validity_new
 g_mime_signature_validity_free

Modified: trunk/docs/reference/gmime.hierarchy
==============================================================================
--- trunk/docs/reference/gmime.hierarchy	(original)
+++ trunk/docs/reference/gmime.hierarchy	Sat May 31 20:49:49 2008
@@ -36,3 +36,4 @@
     GMimeStreamMmap
     GMimeStreamNull
 GInterface
+  GTypePlugin

Modified: trunk/gmime/gmime-cipher-context.c
==============================================================================
--- trunk/gmime/gmime-cipher-context.c	(original)
+++ trunk/gmime/gmime-cipher-context.c	Sat May 31 20:49:49 2008
@@ -415,8 +415,8 @@
 	signer->status = GMIME_SIGNER_STATUS_NONE;
 	signer->errors = GMIME_SIGNER_ERROR_NONE;
 	signer->trust = GMIME_SIGNER_TRUST_NONE;
-	signer->sig_created = (time_t) 0;
-	signer->sig_expire = (time_t) 0;
+	signer->created = (time_t) 0;
+	signer->expires = (time_t) 0;
 	signer->fingerprint = NULL;
 	signer->keyid = NULL;
 	signer->name = NULL;
@@ -443,6 +443,290 @@
 
 
 /**
+ * g_mime_signer_next:
+ * @signer: a #GMimeSigner
+ *
+ * Advance to the next signer.
+ *
+ * Returns: the next #GMimeSigner or %NULL when complete.
+ **/
+GMimeSigner *
+g_mime_signer_next (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, NULL);
+	
+	return signer->next;
+}
+
+
+/**
+ * g_mime_signer_set_status:
+ * @signer: a #GMimeSigner
+ * @status: a #GMimeSignerStatus
+ *
+ * Set the status on the signer.
+ **/
+void
+g_mime_signer_set_status (GMimeSigner *signer, GMimeSignerStatus status)
+{
+	g_return_if_fail (signer != NULL);
+	
+	signer->status = status;
+}
+
+
+/**
+ * g_mime_signer_get_status:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer status.
+ *
+ * Returns: the signer status.
+ **/
+GMimeSignerStatus
+g_mime_signer_get_status (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, GMIME_SIGNER_STATUS_NONE);
+	
+	return signer->status;
+}
+
+
+/**
+ * g_mime_signer_set_errors:
+ * @signer: a #GMimeSigner
+ * @error: a #GMimeSignerError
+ *
+ * Set the errors on the signer.
+ **/
+void
+g_mime_signer_set_errors (GMimeSigner *signer, GMimeSignerError errors)
+{
+	g_return_if_fail (signer != NULL);
+	
+	signer->errors = errors;
+}
+
+
+/**
+ * g_mime_signer_get_errors:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer errors.
+ *
+ * Returns: the signer errors.
+ **/
+GMimeSignerError
+g_mime_signer_get_error (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, GMIME_SIGNER_ERROR_NONE);
+	
+	return signer->errors;
+}
+
+
+/**
+ * g_mime_signer_set_trust:
+ * @signer: a #GMimeSigner
+ * @trust: a #GMimeSignerTrust
+ *
+ * Set the signer trust.
+ **/
+void
+g_mime_signer_set_trust (GMimeSigner *signer, GMimeSignerTrust trust)
+{
+	g_return_if_fail (signer != NULL);
+	
+	signer->trust = trust;
+}
+
+
+/**
+ * g_mime_signer_get_trust:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer trust.
+ *
+ * Returns: the signer trust.
+ **/
+GMimeSignerTrust
+g_mime_signer_get_trust (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, GMIME_SIGNER_TRUST_NONE);
+	
+	return signer->trust;
+}
+
+
+/**
+ * g_mime_signer_set_fingerprint:
+ * @signer: a #GMimeSigner
+ * @fingerprint: fingerprint string
+ *
+ * Set the signer's key fingerprint.
+ **/
+void
+g_mime_signer_set_fingerprint (GMimeSigner *signer, const char *fingerprint)
+{
+	g_return_if_fail (signer != NULL);
+	
+	g_free (signer->fingerprint);
+	signer->fingerprint = g_strdup (fingerprint);
+}
+
+
+/**
+ * g_mime_signer_get_fingerprint:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer's key fingerprint.
+ *
+ * Returns: the signer's key fingerprint.
+ **/
+const char *
+g_mime_signer_get_fingerprint (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, NULL);
+	
+	return signer->fingerprint;
+}
+
+
+/**
+ * g_mime_signer_set_key_id:
+ * @signer: a #GMimeSigner
+ * @key_id: key id
+ *
+ * Set the signer's key id.
+ **/
+void
+g_mime_signer_set_key_id (GMimeSigner *signer, const char *key_id)
+{
+	g_return_if_fail (signer != NULL);
+	
+	g_free (signer->keyid);
+	signer->keyid = g_strdup (key_id);
+}
+
+
+/**
+ * g_mime_signer_get_key_id:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer's key id.
+ *
+ * Returns: the signer's key id.
+ **/
+const char *
+g_mime_signer_get_key_id (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, NULL);
+	
+	return signer->keyid;
+}
+
+
+/**
+ * g_mime_signer_set_name:
+ * @signer: a #GMimeSigner
+ * @name: signer's name
+ *
+ * Set the signer's name.
+ **/
+void
+g_mime_signer_set_name (GMimeSigner *signer, const char *name)
+{
+	g_return_if_fail (signer != NULL);
+	
+	g_free (signer->name);
+	signer->name = g_strdup (name);
+}
+
+
+/**
+ * g_mime_signer_get_name:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer trust.
+ *
+ * Returns: the signer trust.
+ **/
+const char *
+g_mime_signer_get_name (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, NULL);
+	
+	return signer->name;
+}
+
+
+/**
+ * g_mime_signer_set_created:
+ * @signer: a #GMimeSigner
+ * @created: creation date
+ *
+ * Set the signer's key creation date.
+ **/
+void
+g_mime_signer_set_created (GMimeSigner *signer, time_t created)
+{
+	g_return_if_fail (signer != NULL);
+	
+	signer->created = created;
+}
+
+
+/**
+ * g_mime_signer_get_created:
+ * @signer: a #GMimeSigner
+ *
+ * Get the creation date of the signer's key.
+ *
+ * Returns: the creation date of the signer's key.
+ **/
+time_t
+g_mime_signer_get_created (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, (time_t) -1);
+	
+	return signer->created;
+}
+
+
+/**
+ * g_mime_signer_set_expires:
+ * @signer: a #GMimeSigner
+ * @expires: expiration date
+ *
+ * Set the signer's key expiration date.
+ **/
+void
+g_mime_signer_set_expires (GMimeSigner *signer, time_t expires)
+{
+	g_return_if_fail (signer != NULL);
+	
+	signer->expires = expires;
+}
+
+
+/**
+ * g_mime_signer_get_expires:
+ * @signer: a #GMimeSigner
+ *
+ * Get the expiration date of the signer's key.
+ *
+ * Returns: the expiration date of the signer's key.
+ **/
+time_t
+g_mime_signer_get_expires (GMimeSigner *signer)
+{
+	g_return_val_if_fail (signer != NULL, (time_t) -1);
+	
+	return signer->expires;
+}
+
+
+/**
  * g_mime_signature_validity_new:
  *
  * Creates a new #GMimeSignatureValidity.

Modified: trunk/gmime/gmime-cipher-context.h
==============================================================================
--- trunk/gmime/gmime-cipher-context.h	(original)
+++ trunk/gmime/gmime-cipher-context.h	Sat May 31 20:49:49 2008
@@ -52,6 +52,10 @@
  * @GMIME_CIPHER_HASH_MD2: The MD2 hash algorithm.
  * @GMIME_CIPHER_HASH_MD5: The MD5 hash algorithm.
  * @GMIME_CIPHER_HASH_SHA1: The SHA-1 hash algorithm.
+ * @GMIME_CIPHER_HASH_SHA224: The SHA-224 hash algorithm.
+ * @GMIME_CIPHER_HASH_SHA256: The SHA-256 hash algorithm.
+ * @GMIME_CIPHER_HASH_SHA384: The SHA-384 hash algorithm.
+ * @GMIME_CIPHER_HASH_SHA512: The SHA-512 hash algorithm.
  * @GMIME_CIPHER_HASH_RIPEMD160: The RIPEMD-160 hash algorithm.
  * @GMIME_CIPHER_HASH_TIGER192: The TIGER-192 hash algorithm.
  * @GMIME_CIPHER_HASH_HAVAL5160: The HAVAL-5160 hash algorithm.
@@ -63,6 +67,10 @@
 	GMIME_CIPHER_HASH_MD2,
 	GMIME_CIPHER_HASH_MD5,
 	GMIME_CIPHER_HASH_SHA1,
+	GMIME_CIPHER_HASH_SHA224,
+	GMIME_CIPHER_HASH_SHA256,
+	GMIME_CIPHER_HASH_SHA384,
+	GMIME_CIPHER_HASH_SHA512,
 	GMIME_CIPHER_HASH_RIPEMD160,
 	GMIME_CIPHER_HASH_TIGER192,
 	GMIME_CIPHER_HASH_HAVAL5160
@@ -209,8 +217,8 @@
  * @errors: A bitfield of #GMimeSignerError values.
  * @trust: A #GMimeSignerTrust.
  * @unused: Unused expansion bits for future use; ignore this.
- * @sig_created: The creation date of the signature.
- * @sig_expire: The expiration date of the signature.
+ * @created: The creation date of the signature.
+ * @expires: The expiration date of the signature.
  * @fingerprint: A hex string representing the signer's fingerprint.
  * @keyid: The signer's key id.
  * @name: The name of the person or entity.
@@ -223,9 +231,9 @@
 	unsigned int errors:4;    /* bitfield of GMimeSignerError's */
 	unsigned int trust:3;     /* GMimeSignerTrust */
 	unsigned int unused:23;   /* unused expansion bits */
-	time_t sig_created;
-	time_t sig_expire;
 	char *fingerprint;
+	time_t created;
+	time_t expires;
 	char *keyid;
 	char *name;
 };
@@ -234,6 +242,33 @@
 GMimeSigner *g_mime_signer_new (void);
 void         g_mime_signer_free (GMimeSigner *signer);
 
+GMimeSigner *g_mime_signer_next (GMimeSigner *signer);
+
+void g_mime_signer_set_status (GMimeSigner *signer, GMimeSignerStatus status);
+GMimeSignerStatus g_mime_signer_get_status (GMimeSigner *signer);
+
+void g_mime_signer_set_errors (GMimeSigner *signer, GMimeSignerError error);
+GMimeSignerError g_mime_signer_get_errors (GMimeSigner *signer);
+
+void g_mime_signer_set_trust (GMimeSigner *signer, GMimeSignerTrust trust);
+GMimeSignerTrust g_mime_signer_get_trust (GMimeSigner *signer);
+
+void g_mime_signer_set_fingerprint (GMimeSigner *signer, const char *fingerprint);
+const char *g_mime_signer_get_fingerprint (GMimeSigner *signer);
+
+void g_mime_signer_set_key_id (GMimeSigner *signer, const char *key_id);
+const char *g_mime_signer_get_key_id (GMimeSigner *signer);
+
+void g_mime_signer_set_name (GMimeSigner *signer, const char *name);
+const char *g_mime_signer_get_name (GMimeSigner *signer);
+
+void g_mime_signer_set_created (GMimeSigner *signer, time_t created);
+time_t g_mime_signer_get_created (GMimeSigner *signer);
+
+void g_mime_signer_set_expires (GMimeSigner *signer, time_t expires);
+time_t g_mime_signer_get_expires (GMimeSigner *signer);
+
+
 
 /**
  * GMimeSignatureStatus:

Modified: trunk/gmime/gmime-disposition.c
==============================================================================
--- trunk/gmime/gmime-disposition.c	(original)
+++ trunk/gmime/gmime-disposition.c	Sat May 31 20:49:49 2008
@@ -182,6 +182,8 @@
  * @disposition: a #GMimeContentDisposition object
  *
  * Gets the Content-Disposition parameter list.
+ *
+ * Returns: the list of #GMimeParam's set on @disposition.
  **/
 const GMimeParam *
 g_mime_content_disposition_get_params (const GMimeContentDisposition *disposition)

Modified: trunk/gmime/gmime-gpg-context.c
==============================================================================
--- trunk/gmime/gmime-gpg-context.c	(original)
+++ trunk/gmime/gmime-gpg-context.c	Sat May 31 20:49:49 2008
@@ -184,6 +184,14 @@
 		return GMIME_CIPHER_HASH_MD5;
 	else if (!g_ascii_strcasecmp (hash, "sha1"))
 		return GMIME_CIPHER_HASH_SHA1;
+	else if (!g_ascii_strcasecmp (hash, "sha224"))
+		return GMIME_CIPHER_HASH_SHA224;
+	else if (!g_ascii_strcasecmp (hash, "sha256"))
+		return GMIME_CIPHER_HASH_SHA256;
+	else if (!g_ascii_strcasecmp (hash, "sha384"))
+		return GMIME_CIPHER_HASH_SHA384;
+	else if (!g_ascii_strcasecmp (hash, "sha512"))
+		return GMIME_CIPHER_HASH_SHA512;
 	else if (!g_ascii_strcasecmp (hash, "ripemd160"))
 		return GMIME_CIPHER_HASH_RIPEMD160;
 	else if (!g_ascii_strcasecmp (hash, "tiger192"))
@@ -204,6 +212,14 @@
 		return "pgp-md5";
 	case GMIME_CIPHER_HASH_SHA1:
 		return "pgp-sha1";
+	case GMIME_CIPHER_HASH_SHA224:
+		return "pgp-sha224";
+	case GMIME_CIPHER_HASH_SHA256:
+		return "pgp-sha256";
+	case GMIME_CIPHER_HASH_SHA384:
+		return "pgp-sha384";
+	case GMIME_CIPHER_HASH_SHA512:
+		return "pgp-sha512";
 	case GMIME_CIPHER_HASH_RIPEMD160:
 		return "pgp-ripemd160";
 	case GMIME_CIPHER_HASH_TIGER192:
@@ -1019,7 +1035,7 @@
 				status = next_token (status, NULL);
 				
 				/* get the signature expiration date (or 0 for never) */
-				signer->sig_expire = strtoul (status, NULL, 10);
+				signer->expires = strtoul (status, NULL, 10);
 				status = next_token (status, NULL);
 				
 				/* the last token is the 'rc' which we don't care about */
@@ -1049,14 +1065,14 @@
 				status = next_token (status, NULL);
 				
 				/* the third token is the signature creation date (or 0 for unknown?) */
-				signer->sig_created = strtoul (status, &inend, 10);
+				signer->created = strtoul (status, &inend, 10);
 				if (inend == status || *inend != ' ')
 					break;
 				
 				status = inend + 1;
 				
 				/* the fourth token is the signature expiration date (or 0 for never) */
-				signer->sig_expire = strtoul (status, NULL, 10);
+				signer->expires = strtoul (status, NULL, 10);
 				
 				/* ignore the rest... */
 			} else if (!strncmp (status, "TRUST_", 6)) {

Modified: trunk/gmime/gmime-header.c
==============================================================================
--- trunk/gmime/gmime-header.c	(original)
+++ trunk/gmime/gmime-header.c	Sat May 31 20:49:49 2008
@@ -365,8 +365,9 @@
 /**
  * g_mime_header_iter_set_value:
  * @iter: a #GMimeHeaderIter
+ * @value: new header value
  *
- * Sets the current header's value.
+ * Sets the current header's value to the new value.
  *
  * Returns: %TRUE if the value was set or %FALSE otherwise (indicates
  * invalid iter).

Modified: trunk/tests/test-pgpmime.c
==============================================================================
--- trunk/tests/test-pgpmime.c	(original)
+++ trunk/tests/test-pgpmime.c	Sat May 31 20:49:49 2008
@@ -172,9 +172,9 @@
 			break;
 		}
 		
-		fprintf (stdout, "\tSignature made on %s", ctime (&signer->sig_created));
-		if (signer->sig_expire != (time_t) 0)
-			fprintf (stdout, "\tSignature expires on %s", ctime (&signer->sig_expire));
+		fprintf (stdout, "\tSignature made on %s", ctime (&signer->created));
+		if (signer->expires != (time_t) 0)
+			fprintf (stdout, "\tSignature expires on %s", ctime (&signer->expires));
 		else
 			fprintf (stdout, "\tSignature never expires\n");
 		



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