gmime r1289 - in trunk: . docs/reference examples gmime
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: gmime r1289 - in trunk: . docs/reference examples gmime
- Date: Wed, 28 May 2008 00:32:39 +0000 (UTC)
Author: fejj
Date: Wed May 28 00:32:38 2008
New Revision: 1289
URL: http://svn.gnome.org/viewvc/gmime?rev=1289&view=rev
Log:
2008-05-27 Jeffrey Stedfast <fejj novell com>
* examples/basic-example.c: Fixed to use GMimeSignatureValidity.
* gmime/gmime-cipher-context.c (g_mime_cipher_*): Removed, since
we're not going to maintain compatability with 2.2, no sense
keeping these wrappers around.
(g_mime_cipher_validity_*): Removed. No one should still be using
these...
Modified:
trunk/ChangeLog
trunk/docs/reference/gmime-sections.txt
trunk/examples/basic-example.c
trunk/gmime/gmime-cipher-context.c
trunk/gmime/gmime-cipher-context.h
trunk/gmime/gmime-gpg-context.c
Modified: trunk/docs/reference/gmime-sections.txt
==============================================================================
--- trunk/docs/reference/gmime-sections.txt (original)
+++ trunk/docs/reference/gmime-sections.txt Wed May 28 00:32:38 2008
@@ -1013,7 +1013,6 @@
<FILE>gmime-cipher-context</FILE>
GMimeCipherHash
GMimeCipherContext
-GMimeCipherValidity
GMimeSignatureValidity
GMimeSignatureStatus
GMimeSignerStatus
@@ -1048,15 +1047,6 @@
g_mime_signature_validity_set_details
g_mime_signature_validity_get_signers
g_mime_signature_validity_add_signer
-<SUBSECTION>
-g_mime_cipher_validity_init
-g_mime_cipher_validity_new
-g_mime_cipher_validity_clear
-g_mime_cipher_validity_free
-g_mime_cipher_validity_get_valid
-g_mime_cipher_validity_set_valid
-g_mime_cipher_validity_get_description
-g_mime_cipher_validity_set_description
<SUBSECTION Private>
g_mime_cipher_context_get_type
Modified: trunk/examples/basic-example.c
==============================================================================
--- trunk/examples/basic-example.c (original)
+++ trunk/examples/basic-example.c Wed May 28 00:32:38 2008
@@ -191,8 +191,10 @@
if (GMIME_IS_MULTIPART_SIGNED (part)) {
/* this is a multipart/signed part, so we can verify the pgp signature */
GMimeMultipartSigned *mps = (GMimeMultipartSigned *) part;
- GMimeCipherValidity *validity;
+ GMimeSignatureValidity *validity;
+ GMimeSignatureStatus status;
GError *err = NULL;
+ const char *str;
if (!(validity = g_mime_multipart_signed_verify (mps, ctx, &err))) {
/* an error occured - probably couldn't start gpg? */
@@ -205,10 +207,26 @@
g_error_free (err);
} else {
/* print out validity info - GOOD vs BAD and "why" */
- printf ("PGP signature is %s:\n%s\n", g_mime_cipher_validity_get_valid (validity) ? "GOOD" : "BAD",
- g_mime_cipher_validity_get_description (validity));
+ status = g_mime_signature_validity_get_status (validity);
+ switch (status) {
+ case GMIME_SIGNATURE_STATUS_GOOD:
+ str = "Good";
+ break;
+ case GMIME_SIGNATURE_STATUS_BAD:
+ str = "Bad";
+ break;
+ case GMIME_SIGNATURE_STATUS_UNKNOWN:
+ str = "Unknown";
+ break;
+ default:
+ str = NULL;
+ break;
+ }
- g_mime_cipher_validity_free (validity);
+ printf ("PGP signature is %s:\n%s\n", str,
+ g_mime_signature_validity_get_details (validity));
+
+ g_mime_signature_validity_free (validity);
}
}
}
Modified: trunk/gmime/gmime-cipher-context.c
==============================================================================
--- trunk/gmime/gmime-cipher-context.c (original)
+++ trunk/gmime/gmime-cipher-context.c Wed May 28 00:32:38 2008
@@ -604,348 +604,3 @@
s->next = signer;
}
}
-
-
-
-
-
-/**
- * g_mime_cipher_validity_new:
- *
- * Creates a new validity structure.
- *
- * WARNING: This interface has been deprecated. Use
- * g_mime_signature_validity_new() instead.
- *
- * Returns a new #GMimeCipherValidity.
- **/
-GMimeCipherValidity *
-g_mime_cipher_validity_new (void)
-{
- return g_mime_signature_validity_new ();
-}
-
-
-/**
- * g_mime_cipher_validity_init:
- * @validity: validity structure
- *
- * Initializes the validity structure.
- *
- * WARNING: This interface has been deprecated.
- **/
-void
-g_mime_cipher_validity_init (GMimeCipherValidity *validity)
-{
- g_assert (validity != NULL);
-
- validity->status = GMIME_SIGNATURE_STATUS_NONE;
- validity->details = NULL;
- validity->signers = NULL;
-}
-
-
-/**
- * g_mime_cipher_validity_get_valid:
- * @validity: validity structure
- *
- * Gets the validity of the validity structure @validity.
- *
- * WARNING: This interface has been deprecated. Use
- * g_mime_signature_validity_get_status() instead.
- *
- * Returns %TRUE if @validity is valid or %FALSE otherwise.
- **/
-gboolean
-g_mime_cipher_validity_get_valid (GMimeCipherValidity *validity)
-{
- if (validity == NULL)
- return FALSE;
-
- return validity->status == GMIME_SIGNATURE_STATUS_GOOD;
-}
-
-
-/**
- * g_mime_cipher_validity_set_valid:
- * @validity: validity structure
- * @valid: %TRUE if valid else %FALSE
- *
- * Sets the validness on the validity structure.
- *
- * WARNING: This interface has been deprecated. Use
- * g_mime_signature_validity_set_status() instead.
- **/
-void
-g_mime_cipher_validity_set_valid (GMimeCipherValidity *validity, gboolean valid)
-{
- g_assert (validity != NULL);
-
- validity->status = valid ? GMIME_SIGNATURE_STATUS_GOOD : GMIME_SIGNATURE_STATUS_BAD;
-}
-
-
-/**
- * g_mime_cipher_validity_get_description:
- * @validity: validity structure
- *
- * Gets the description set on the validity structure @validity.
- *
- * WARNING: This interface has been deprecated. Use
- * g_mime_signature_validity_get_details() instead.
- *
- * Returns any description set on the validity structure.
- **/
-const char *
-g_mime_cipher_validity_get_description (GMimeCipherValidity *validity)
-{
- return g_mime_signature_validity_get_details (validity);
-}
-
-
-/**
- * g_mime_cipher_validity_set_description:
- * @validity: validity structure
- * @description: validity description
- *
- * Sets the description on the validity structure.
- *
- * WARNING: This interface has been deprecated. Use
- * g_mime_signature_validity_set_details() instead.
- **/
-void
-g_mime_cipher_validity_set_description (GMimeCipherValidity *validity, const char *description)
-{
- g_mime_signature_validity_set_details (validity, description);
-}
-
-
-/**
- * g_mime_cipher_validity_clear:
- * @validity: validity structure
- *
- * Clears the contents of the validity structure.
- *
- * WARNING: This interface has been deprecated.
- **/
-void
-g_mime_cipher_validity_clear (GMimeCipherValidity *validity)
-{
- GMimeSigner *signer, *next;
-
- g_assert (validity != NULL);
-
- validity->status = GMIME_SIGNATURE_STATUS_NONE;
- g_free (validity->details);
- validity->details = NULL;
-
- signer = validity->signers;
- while (signer != NULL) {
- next = signer->next;
- g_free (signer->fingerprint);
- g_free (signer->keyid);
- g_free (signer->name);
- g_free (signer);
- signer = next;
- }
-}
-
-
-/**
- * g_mime_cipher_validity_free:
- * @validity: validity structure
- *
- * Frees the memory used by @validity back to the system.
- *
- * WARNING: This interface has been deprecated. Use
- * g_mime_signature_validity_free() instead.
- **/
-void
-g_mime_cipher_validity_free (GMimeCipherValidity *validity)
-{
- g_mime_signature_validity_free (validity);
-}
-
-
-/**
- * g_mime_cipher_hash_id:
- * @ctx: Cipher Context
- * @hash: hash name
- *
- * Gets the hash id based on the hash name @hash.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_hash_id() instead.
- *
- * Returns the equivalent hash id or #GMIME_CIPHER_HASH_DEFAULT on fail.
- **/
-GMimeCipherHash
-g_mime_cipher_hash_id (GMimeCipherContext *ctx, const char *hash)
-{
- return g_mime_cipher_context_hash_id (ctx, hash);
-}
-
-
-/**
- * g_mime_cipher_hash_name:
- * @ctx: Cipher Context
- * @hash: hash id
- *
- * Gets the hash name based on the hash id @hash.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_hash_name() instead.
- *
- * Returns the equivalent hash name or %NULL on fail.
- **/
-const char *
-g_mime_cipher_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
-{
- return g_mime_cipher_context_hash_name (ctx, hash);
-}
-
-
-/**
- * g_mime_cipher_sign:
- * @ctx: Cipher Context
- * @userid: private key to use to sign the stream
- * @hash: preferred Message-Integrity-Check hash algorithm
- * @istream: input stream
- * @ostream: output stream
- * @err: exception
- *
- * Signs the input stream and writes the resulting signature to the
- * output stream.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_sign() instead.
- *
- * Returns %0 on success or %-1 on fail.
- **/
-int
-g_mime_cipher_sign (GMimeCipherContext *ctx, const char *userid, GMimeCipherHash hash,
- GMimeStream *istream, GMimeStream *ostream, GError **err)
-{
- return g_mime_cipher_context_sign (ctx, userid, hash, istream, ostream, err);
-}
-
-
-/**
- * g_mime_cipher_verify:
- * @ctx: Cipher Context
- * @hash: secure hash used
- * @istream: input stream
- * @sigstream: optional detached-signature stream
- * @err: exception
- *
- * Verifies the signature. If @istream is a clearsigned stream,
- * you should pass %NULL as the sigstream parameter. Otherwise
- * @sigstream is assumed to be the signature stream and is used to
- * verify the integirity of the @istream.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_verify() instead.
- *
- * Returns a #GMimeSignatureValidity structure containing information
- * about the integrity of the input stream or %NULL on failure to
- * execute at all.
- **/
-GMimeSignatureValidity *
-g_mime_cipher_verify (GMimeCipherContext *ctx, GMimeCipherHash hash, GMimeStream *istream,
- GMimeStream *sigstream, GError **err)
-{
- return g_mime_cipher_context_verify (ctx, hash, istream, sigstream, err);
-}
-
-
-/**
- * g_mime_cipher_encrypt:
- * @ctx: Cipher Context
- * @sign: sign as well as encrypt
- * @userid: key id (or email address) to use when signing (assuming @sign is %TRUE)
- * @recipients: an array of recipient key ids and/or email addresses
- * @istream: cleartext input stream
- * @ostream: ciphertext output stream
- * @err: exception
- *
- * Encrypts (and optionally signs) the cleartext input stream and
- * writes the resulting ciphertext to the output stream.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_encrypt() instead.
- *
- * Returns %0 on success or %-1 on fail.
- **/
-int
-g_mime_cipher_encrypt (GMimeCipherContext *ctx, gboolean sign, const char *userid, GPtrArray *recipients,
- GMimeStream *istream, GMimeStream *ostream, GError **err)
-{
- return g_mime_cipher_context_encrypt (ctx, sign, userid, recipients, istream, ostream, err);
-}
-
-
-/**
- * g_mime_cipher_decrypt:
- * @ctx: Cipher Context
- * @istream: input/ciphertext stream
- * @ostream: output/cleartext stream
- * @err: exception
- *
- * Decrypts the ciphertext input stream and writes the resulting
- * cleartext to the output stream.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_decrypt() instead.
- *
- * Returns %0 on success or %-1 for fail.
- **/
-int
-g_mime_cipher_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
- GMimeStream *ostream, GError **err)
-{
- return g_mime_cipher_context_decrypt (ctx, istream, ostream, err);
-}
-
-
-/**
- * g_mime_cipher_import_keys:
- * @ctx: Cipher Context
- * @istream: input stream (containing keys)
- * @err: exception
- *
- * Imports a stream of keys/certificates contained within @istream
- * into the key/certificate database controlled by @ctx.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_import_keys() instead.
- *
- * Returns %0 on success or %-1 on fail.
- **/
-int
-g_mime_cipher_import_keys (GMimeCipherContext *ctx, GMimeStream *istream, GError **err)
-{
- return g_mime_cipher_context_import_keys (ctx, istream, err);
-}
-
-
-/**
- * g_mime_cipher_export_keys:
- * @ctx: Cipher Context
- * @keys: an array of key ids
- * @ostream: output stream
- * @err: exception
- *
- * Exports the keys/certificates in @keys to the stream @ostream from
- * the key/certificate database controlled by @ctx.
- *
- * WARNING: This interface is deprecated. Use
- * g_mime_cipher_context_export_keys() instead.
- *
- * Returns %0 on success or %-1 on fail.
- **/
-int
-g_mime_cipher_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
- GMimeStream *ostream, GError **err)
-{
- return g_mime_cipher_context_export_keys (ctx, keys, ostream, err);
-}
Modified: trunk/gmime/gmime-cipher-context.h
==============================================================================
--- trunk/gmime/gmime-cipher-context.h (original)
+++ trunk/gmime/gmime-cipher-context.h Wed May 28 00:32:38 2008
@@ -141,37 +141,6 @@
int g_mime_cipher_context_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err);
-#ifndef GMIME_DISABLE_DEPRECATED
-/* hash routines */
-GMimeCipherHash g_mime_cipher_hash_id (GMimeCipherContext *ctx, const char *hash);
-
-const char * g_mime_cipher_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash);
-
-/* cipher routines */
-int g_mime_cipher_sign (GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GMimeStream *istream,
- GMimeStream *ostream, GError **err);
-
-GMimeSignatureValidity *g_mime_cipher_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
- GMimeStream *istream, GMimeStream *sigstream,
- GError **err);
-
-int g_mime_cipher_encrypt (GMimeCipherContext *ctx, gboolean sign,
- const char *userid, GPtrArray *recipients,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
-
-int g_mime_cipher_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
- GMimeStream *ostream, GError **err);
-
-/* key/certificate routines */
-int g_mime_cipher_import_keys (GMimeCipherContext *ctx, GMimeStream *istream,
- GError **err);
-
-int g_mime_cipher_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
- GMimeStream *ostream, GError **err);
-#endif /* GMIME_DISABLE_DEPRECATED */
-
/* signature status structures and functions */
@@ -311,31 +280,6 @@
const GMimeSigner *g_mime_signature_validity_get_signers (GMimeSignatureValidity *validity);
void g_mime_signature_validity_add_signer (GMimeSignatureValidity *validity, GMimeSigner *signer);
-
-#ifndef GMIME_DISABLE_DEPRECATED
-
-/* for backward compatability */
-typedef struct _GMimeSignatureValidity GMimeCipherValidity;
-
-GMimeCipherValidity *g_mime_cipher_validity_new (void);
-
-void g_mime_cipher_validity_init (GMimeCipherValidity *validity);
-
-gboolean g_mime_cipher_validity_get_valid (GMimeCipherValidity *validity);
-
-void g_mime_cipher_validity_set_valid (GMimeCipherValidity *validity, gboolean valid);
-
-const char *g_mime_cipher_validity_get_description (GMimeCipherValidity *validity);
-
-void g_mime_cipher_validity_set_description (GMimeCipherValidity *validity,
- const char *description);
-
-void g_mime_cipher_validity_clear (GMimeCipherValidity *validity);
-
-void g_mime_cipher_validity_free (GMimeCipherValidity *validity);
-
-#endif /* GMIME_DISABLE_DEPRECATED */
-
G_END_DECLS
#endif /* __GMIME_CIPHER_CONTEXT_H__ */
Modified: trunk/gmime/gmime-gpg-context.c
==============================================================================
--- trunk/gmime/gmime-gpg-context.c (original)
+++ trunk/gmime/gmime-gpg-context.c Wed May 28 00:32:38 2008
@@ -79,9 +79,9 @@
GMimeCipherHash hash, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static GMimeCipherValidity *gpg_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
- GMimeStream *istream, GMimeStream *sigstream,
- GError **err);
+static GMimeSignatureValidity *gpg_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
+ GMimeStream *istream, GMimeStream *sigstream,
+ GError **err);
static int gpg_encrypt (GMimeCipherContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]