[evolution-data-server] Remove unused camel_cipher_context_export_keys_sync().



commit b73a072bafb7fb4a87aef5b93b428e92f218689a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Oct 1 23:11:30 2013 -0400

    Remove unused camel_cipher_context_export_keys_sync().
    
    Also removes the unused asynchronous functions:
    
      camel_cipher_context_export_keys()
      camel_cipher_context_export_keys_finish()

 camel/camel-cipher-context.c            |  200 -------------------------------
 camel/camel-cipher-context.h            |   35 ------
 camel/camel-gpg-context.c               |   64 +----------
 docs/reference/camel/camel-sections.txt |    3 -
 4 files changed, 2 insertions(+), 300 deletions(-)
---
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index 44a7dd8..02826e1 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -253,20 +253,6 @@ cipher_context_decrypt_sync (CamelCipherContext *context,
        return NULL;
 }
 
-static gint
-cipher_context_export_keys_sync (CamelCipherContext *context,
-                                 GPtrArray *keys,
-                                 CamelStream *ostream,
-                                 GCancellable *cancellable,
-                                 GError **error)
-{
-       g_set_error (
-               error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-               _("You may not export keys with this cipher"));
-
-       return FALSE;
-}
-
 static void
 cipher_context_sign_thread (GSimpleAsyncResult *simple,
                             GObject *object,
@@ -566,80 +552,6 @@ cipher_context_decrypt_finish (CamelCipherContext *context,
 }
 
 static void
-cipher_context_export_keys_thread (GSimpleAsyncResult *simple,
-                                   GObject *object,
-                                   GCancellable *cancellable)
-{
-       AsyncContext *async_context;
-       GError *error = NULL;
-
-       async_context = g_simple_async_result_get_op_res_gpointer (simple);
-
-       camel_cipher_context_export_keys_sync (
-               CAMEL_CIPHER_CONTEXT (object), async_context->strings,
-               async_context->stream, cancellable, &error);
-
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
-}
-
-static void
-cipher_context_export_keys (CamelCipherContext *context,
-                            GPtrArray *keys,
-                            CamelStream *ostream,
-                            gint io_priority,
-                            GCancellable *cancellable,
-                            GAsyncReadyCallback callback,
-                            gpointer user_data)
-{
-       GSimpleAsyncResult *simple;
-       AsyncContext *async_context;
-       guint ii;
-
-       async_context = g_slice_new0 (AsyncContext);
-       async_context->strings = g_ptr_array_new ();
-       async_context->stream = g_object_ref (ostream);
-
-       for (ii = 0; ii < keys->len; ii++)
-               g_ptr_array_add (
-                       async_context->strings,
-                       g_strdup (keys->pdata[ii]));
-
-       simple = g_simple_async_result_new (
-               G_OBJECT (context), callback,
-               user_data, cipher_context_export_keys);
-
-       g_simple_async_result_set_check_cancellable (simple, cancellable);
-
-       g_simple_async_result_set_op_res_gpointer (
-               simple, async_context, (GDestroyNotify) async_context_free);
-
-       g_simple_async_result_run_in_thread (
-               simple, cipher_context_export_keys_thread,
-               io_priority, cancellable);
-
-       g_object_unref (simple);
-}
-
-static gboolean
-cipher_context_export_keys_finish (CamelCipherContext *context,
-                                   GAsyncResult *result,
-                                   GError **error)
-{
-       GSimpleAsyncResult *simple;
-
-       g_return_val_if_fail (
-               g_simple_async_result_is_valid (
-               result, G_OBJECT (context),
-               cipher_context_export_keys), FALSE);
-
-       simple = G_SIMPLE_ASYNC_RESULT (result);
-
-       /* Assume success unless a GError is set. */
-       return !g_simple_async_result_propagate_error (simple, error);
-}
-
-static void
 camel_cipher_context_class_init (CamelCipherContextClass *class)
 {
        GObjectClass *object_class;
@@ -659,7 +571,6 @@ camel_cipher_context_class_init (CamelCipherContextClass *class)
        class->verify_sync = cipher_context_verify_sync;
        class->encrypt_sync = cipher_context_encrypt_sync;
        class->decrypt_sync = cipher_context_decrypt_sync;
-       class->export_keys_sync = cipher_context_export_keys_sync;
 
        class->sign = cipher_context_sign;
        class->sign_finish = cipher_context_sign_finish;
@@ -669,8 +580,6 @@ camel_cipher_context_class_init (CamelCipherContextClass *class)
        class->encrypt_finish = cipher_context_encrypt_finish;
        class->decrypt = cipher_context_decrypt;
        class->decrypt_finish = cipher_context_decrypt_finish;
-       class->export_keys = cipher_context_export_keys;
-       class->export_keys_finish = cipher_context_export_keys_finish;
 
        g_object_class_install_property (
                object_class,
@@ -1184,115 +1093,6 @@ camel_cipher_context_decrypt_finish (CamelCipherContext *context,
        return class->decrypt_finish (context, result, error);
 }
 
-/**
- * camel_cipher_context_export_keys_sync:
- * @context: a #CamelCipherContext
- * @keys: an array of key IDs
- * @ostream: an output stream
- * @cancellable: optional #GCancellable object, or %NULL
- * @error: return location for a #GError, or %NULL
- *
- * Exports the keys/certificates in @keys to the stream @ostream from
- * the key/certificate database controlled by @context.
- *
- * Returns: %TRUE on success, %FALSE on error
- *
- * Since: 3.0
- **/
-gboolean
-camel_cipher_context_export_keys_sync (CamelCipherContext *context,
-                                       GPtrArray *keys,
-                                       CamelStream *ostream,
-                                       GCancellable *cancellable,
-                                       GError **error)
-{
-       CamelCipherContextClass *class;
-       gboolean success;
-
-       g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), FALSE);
-       g_return_val_if_fail (keys != NULL, FALSE);
-       g_return_val_if_fail (CAMEL_IS_STREAM (ostream), FALSE);
-
-       class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
-       g_return_val_if_fail (class->export_keys_sync != NULL, FALSE);
-
-       success = class->export_keys_sync (
-               context, keys, ostream, cancellable, error);
-       CAMEL_CHECK_GERROR (context, export_keys_sync, success, error);
-
-       return success;
-}
-
-/**
- * camel_cipher_context_export_keys:
- * @context: a #CamelCipherContext
- * @keys: an array of key IDs
- * @ostream: an output stream
- * @io_priority: the I/O priority of the request
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
- *
- * Asynchronously exports the keys/certificates in @keys to the stream
- * @ostream from the key/certificate database controlled by @context.
- *
- * When the operation is finished, @callback will be called.  You can then
- * call camel_cipher_context_export_keys_finish() to get the result of the
- * operation.
- *
- * Since: 3.0
- **/
-void
-camel_cipher_context_export_keys (CamelCipherContext *context,
-                                  GPtrArray *keys,
-                                  CamelStream *ostream,
-                                  gint io_priority,
-                                  GCancellable *cancellable,
-                                  GAsyncReadyCallback callback,
-                                  gpointer user_data)
-{
-       CamelCipherContextClass *class;
-
-       g_return_if_fail (CAMEL_IS_CIPHER_CONTEXT (context));
-       g_return_if_fail (keys != NULL);
-       g_return_if_fail (CAMEL_IS_STREAM (ostream));
-
-       class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
-       g_return_if_fail (class->export_keys != NULL);
-
-       class->export_keys (
-               context, keys, ostream, io_priority,
-               cancellable, callback, user_data);
-}
-
-/**
- * camel_cipher_context_export_keys_finish:
- * @context: a #CamelCipherContext
- * @result: a #GAsyncResult
- * @error: return location for a #GError, or %NULL
- *
- * Finishes the operation started with camel_cipher_context_export_keys().
- *
- * Returns: %TRUE on success, %FALSE on error
- *
- * Since: 3.0
- **/
-gboolean
-camel_cipher_context_export_keys_finish (CamelCipherContext *context,
-                                         GAsyncResult *result,
-                                         GError **error)
-{
-       CamelCipherContextClass *class;
-
-       g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), FALSE);
-       g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
-
-       class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
-       g_return_val_if_fail (class->export_keys_finish != NULL, FALSE);
-
-       return class->export_keys_finish (context, result, error);
-}
-
 /* a couple of util functions */
 CamelCipherHash
 camel_cipher_context_id_to_hash (CamelCipherContext *context,
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h
index 8b23ff9..9206904 100644
--- a/camel/camel-cipher-context.h
+++ b/camel/camel-cipher-context.h
@@ -161,11 +161,6 @@ struct _CamelCipherContextClass {
                                                 CamelMimePart *opart,
                                                 GCancellable *cancellable,
                                                 GError **error);
-       gboolean        (*export_keys_sync)     (CamelCipherContext *context,
-                                                GPtrArray *keys,
-                                                CamelStream *ostream,
-                                                GCancellable *cancellable,
-                                                GError **error);
 
        /* Asynchronous I/O Methods (all have defaults) */
        void            (*sign)                 (CamelCipherContext *context,
@@ -213,16 +208,6 @@ struct _CamelCipherContextClass {
                        (*decrypt_finish)       (CamelCipherContext *context,
                                                 GAsyncResult *result,
                                                 GError **error);
-       void            (*export_keys)          (CamelCipherContext *context,
-                                                GPtrArray *keys,
-                                                CamelStream *ostream,
-                                                gint io_priority,
-                                                GCancellable *cancellable,
-                                                GAsyncReadyCallback callback,
-                                                gpointer user_data);
-       gboolean        (*export_keys_finish)   (CamelCipherContext *context,
-                                                GAsyncResult *result,
-                                                GError **error);
 };
 
 GType          camel_cipher_context_get_type   (void);
@@ -321,26 +306,6 @@ CamelCipherValidity *
                                                 GAsyncResult *result,
                                                 GError **error);
 
-/* key/certificate routines */
-gboolean       camel_cipher_context_export_keys_sync
-                                               (CamelCipherContext *context,
-                                                GPtrArray *keys,
-                                                CamelStream *ostream,
-                                                GCancellable *cancellable,
-                                                GError **error);
-void           camel_cipher_context_export_keys
-                                               (CamelCipherContext *context,
-                                                GPtrArray *keys,
-                                                CamelStream *ostream,
-                                                gint io_priority,
-                                                GCancellable *cancellable,
-                                                GAsyncReadyCallback callback,
-                                                gpointer user_data);
-gboolean       camel_cipher_context_export_keys_finish
-                                               (CamelCipherContext *context,
-                                                GAsyncResult *result,
-                                                GError **error);
-
 /* CamelCipherValidity utility functions */
 CamelCipherValidity *
                camel_cipher_validity_new       (void);
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 5134efe..052255d 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -92,8 +92,7 @@ enum _GpgCtxMode {
        GPG_CTX_MODE_SIGN,
        GPG_CTX_MODE_VERIFY,
        GPG_CTX_MODE_ENCRYPT,
-       GPG_CTX_MODE_DECRYPT,
-       GPG_CTX_MODE_EXPORT
+       GPG_CTX_MODE_DECRYPT
 };
 
 enum _GpgTrustMetric {
@@ -312,7 +311,7 @@ gpg_ctx_add_recipient (struct _GpgCtx *gpg,
 {
        gchar *safe_keyid;
 
-       if (gpg->mode != GPG_CTX_MODE_ENCRYPT && gpg->mode != GPG_CTX_MODE_EXPORT)
+       if (gpg->mode != GPG_CTX_MODE_ENCRYPT)
                return;
 
        if (!gpg->recipients)
@@ -597,13 +596,6 @@ gpg_ctx_get_argv (struct _GpgCtx *gpg,
                g_ptr_array_add (argv, (guint8 *) "--output");
                g_ptr_array_add (argv, (guint8 *) "-");
                break;
-       case GPG_CTX_MODE_EXPORT:
-               if (gpg->armor)
-                       g_ptr_array_add (argv, (guint8 *) "--armor");
-               g_ptr_array_add (argv, (guint8 *) "--export");
-               for (i = 0; i < gpg->recipients->len; i++)
-                       g_ptr_array_add (argv, gpg->recipients->pdata[i]);
-               break;
        }
 
        g_ptr_array_add (argv, NULL);
@@ -1111,9 +1103,6 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
                                return -1;
                        }
                        break;
-               case GPG_CTX_MODE_EXPORT:
-                       /* noop */
-                       break;
                }
        }
 
@@ -2246,54 +2235,6 @@ gpg_decrypt_sync (CamelCipherContext *context,
        return valid;
 }
 
-static gboolean
-gpg_export_keys_sync (CamelCipherContext *context,
-                      GPtrArray *keys,
-                      CamelStream *ostream,
-                      GCancellable *cancellable,
-                      GError **error)
-{
-       struct _GpgCtx *gpg;
-       gboolean success = FALSE;
-       gint i;
-
-       gpg = gpg_ctx_new (context);
-       gpg_ctx_set_mode (gpg, GPG_CTX_MODE_EXPORT);
-       gpg_ctx_set_armor (gpg, TRUE);
-       gpg_ctx_set_ostream (gpg, ostream);
-
-       for (i = 0; i < keys->len; i++) {
-               gpg_ctx_add_recipient (gpg, keys->pdata[i]);
-       }
-
-       if (!gpg_ctx_op_start (gpg, error))
-               goto fail;
-
-       while (!gpg_ctx_op_complete (gpg)) {
-               if (gpg_ctx_op_step (gpg, cancellable, error) == -1) {
-                       gpg_ctx_op_cancel (gpg);
-                       goto fail;
-               }
-       }
-
-       if (gpg_ctx_op_wait (gpg) != 0) {
-               const gchar *diagnostics;
-
-               diagnostics = gpg_ctx_get_diagnostics (gpg);
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s",
-                       (diagnostics != NULL && *diagnostics != '\0') ?
-                       diagnostics : _("Failed to execute gpg."));
-               goto fail;
-       }
-
-       success = TRUE;
-fail:
-       gpg_ctx_free (gpg);
-
-       return success;
-}
-
 static void
 camel_gpg_context_class_init (CamelGpgContextClass *class)
 {
@@ -2316,7 +2257,6 @@ camel_gpg_context_class_init (CamelGpgContextClass *class)
        cipher_context_class->verify_sync = gpg_verify_sync;
        cipher_context_class->encrypt_sync = gpg_encrypt_sync;
        cipher_context_class->decrypt_sync = gpg_decrypt_sync;
-       cipher_context_class->export_keys_sync = gpg_export_keys_sync;
 
        g_object_class_install_property (
                object_class,
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 486fe88..8348a5e 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -137,9 +137,6 @@ camel_cipher_context_encrypt_finish
 camel_cipher_context_decrypt_sync
 camel_cipher_context_decrypt
 camel_cipher_context_decrypt_finish
-camel_cipher_context_export_keys_sync
-camel_cipher_context_export_keys
-camel_cipher_context_export_keys_finish
 camel_cipher_validity_new
 camel_cipher_validity_init
 camel_cipher_validity_get_valid


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