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



commit 7b23e572599c3155d5ac52e292683a8f3b5138ff
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Oct 1 23:05:54 2013 -0400

    Remove unused camel_cipher_context_import_keys_sync().
    
    Also removes the unused asynchronous functions:
    
      camel_cipher_context_import_keys()
      camel_cipher_context_import_keys_finish()

 camel/camel-cipher-context.c            |  185 -------------------------------
 camel/camel-cipher-context.h            |   29 -----
 camel/camel-gpg-context.c               |   50 --------
 docs/reference/camel/camel-sections.txt |    3 -
 4 files changed, 0 insertions(+), 267 deletions(-)
---
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index c1eb539..44a7dd8 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -253,19 +253,6 @@ cipher_context_decrypt_sync (CamelCipherContext *context,
        return NULL;
 }
 
-static gboolean
-cipher_context_import_keys_sync (CamelCipherContext *context,
-                                 CamelStream *istream,
-                                 GCancellable *cancellable,
-                                 GError **error)
-{
-       g_set_error (
-               error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-               _("You may not import keys with this cipher"));
-
-       return FALSE;
-}
-
 static gint
 cipher_context_export_keys_sync (CamelCipherContext *context,
                                  GPtrArray *keys,
@@ -579,72 +566,6 @@ cipher_context_decrypt_finish (CamelCipherContext *context,
 }
 
 static void
-cipher_context_import_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_import_keys_sync (
-               CAMEL_CIPHER_CONTEXT (object), async_context->stream,
-               cancellable, &error);
-
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
-}
-
-static void
-cipher_context_import_keys (CamelCipherContext *context,
-                            CamelStream *istream,
-                            gint io_priority,
-                            GCancellable *cancellable,
-                            GAsyncReadyCallback callback,
-                            gpointer user_data)
-{
-       GSimpleAsyncResult *simple;
-       AsyncContext *async_context;
-
-       async_context = g_slice_new0 (AsyncContext);
-       async_context->stream = g_object_ref (istream);
-
-       simple = g_simple_async_result_new (
-               G_OBJECT (context), callback,
-               user_data, cipher_context_import_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_import_keys_thread,
-               io_priority, cancellable);
-
-       g_object_unref (simple);
-}
-
-static gboolean
-cipher_context_import_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_import_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
 cipher_context_export_keys_thread (GSimpleAsyncResult *simple,
                                    GObject *object,
                                    GCancellable *cancellable)
@@ -738,7 +659,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->import_keys_sync = cipher_context_import_keys_sync;
        class->export_keys_sync = cipher_context_export_keys_sync;
 
        class->sign = cipher_context_sign;
@@ -749,8 +669,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->import_keys = cipher_context_import_keys;
-       class->import_keys_finish = cipher_context_import_keys_finish;
        class->export_keys = cipher_context_export_keys;
        class->export_keys_finish = cipher_context_export_keys_finish;
 
@@ -1267,109 +1185,6 @@ camel_cipher_context_decrypt_finish (CamelCipherContext *context,
 }
 
 /**
- * camel_cipher_context_import_keys_sync:
- * @context: a #CamelCipherContext
- * @istream: an input stream containing keys
- * @cancellable: optional #GCancellable object, or %NULL
- * @error: return location for a #GError, or %NULL
- *
- * Imports a stream of keys/certificates contained within @istream
- * into the key/certificate database controlled by @context.
- *
- * Returns: %TRUE on success, %FALSE on error
- *
- * Since: 3.0
- **/
-gboolean
-camel_cipher_context_import_keys_sync (CamelCipherContext *context,
-                                       CamelStream *istream,
-                                       GCancellable *cancellable,
-                                       GError **error)
-{
-       CamelCipherContextClass *class;
-       gboolean success;
-
-       g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (context), FALSE);
-       g_return_val_if_fail (CAMEL_IS_STREAM (istream), FALSE);
-
-       class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
-       g_return_val_if_fail (class->import_keys_sync != NULL, FALSE);
-
-       success = class->import_keys_sync (
-               context, istream, cancellable, error);
-       CAMEL_CHECK_GERROR (context, import_keys_sync, success, error);
-
-       return success;
-}
-
-/**
- * camel_cipher_context_import_keys:
- * @context: a #CamelCipherContext
- * @istream: an input stream containing keys
- * @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 imports a stream of keys/certificates contained within
- * @istream into the key/certificate database controlled by @context.
- *
- * When the operation is finished, @callback will be called.  You can
- * then call camel_cipher_context_import_keys_finish() to get the result
- * of the operation.
- *
- * Since: 3.0
- **/
-void
-camel_cipher_context_import_keys (CamelCipherContext *context,
-                                  CamelStream *istream,
-                                  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 (CAMEL_IS_STREAM (istream));
-
-       class = CAMEL_CIPHER_CONTEXT_GET_CLASS (context);
-       g_return_if_fail (class->import_keys != NULL);
-
-       class->import_keys (
-               context, istream, io_priority,
-               cancellable, callback, user_data);
-}
-
-/**
- * camel_cipher_context_import_keys_finish:
- * @context: a #CamelCipherContext
- * @result: a #GAsyncResult
- * @error: return location for a #GError, or %NULL
- *
- * Finishes the operation started with camel_cipher_context_import_keys().
- *
- * Returns: %TRUE on success, %FALSE on error
- *
- * Since: 3.0
- **/
-gboolean
-camel_cipher_context_import_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->import_keys_finish != NULL, FALSE);
-
-       return class->import_keys_finish (context, result, error);
-}
-
-/**
  * camel_cipher_context_export_keys_sync:
  * @context: a #CamelCipherContext
  * @keys: an array of key IDs
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h
index 4fcb781..8b23ff9 100644
--- a/camel/camel-cipher-context.h
+++ b/camel/camel-cipher-context.h
@@ -161,10 +161,6 @@ struct _CamelCipherContextClass {
                                                 CamelMimePart *opart,
                                                 GCancellable *cancellable,
                                                 GError **error);
-       gboolean        (*import_keys_sync)     (CamelCipherContext *context,
-                                                CamelStream *istream,
-                                                GCancellable *cancellable,
-                                                GError **error);
        gboolean        (*export_keys_sync)     (CamelCipherContext *context,
                                                 GPtrArray *keys,
                                                 CamelStream *ostream,
@@ -217,15 +213,6 @@ struct _CamelCipherContextClass {
                        (*decrypt_finish)       (CamelCipherContext *context,
                                                 GAsyncResult *result,
                                                 GError **error);
-       void            (*import_keys)          (CamelCipherContext *context,
-                                                CamelStream *istream,
-                                                gint io_priority,
-                                                GCancellable *cancellable,
-                                                GAsyncReadyCallback callback,
-                                                gpointer user_data);
-       gboolean        (*import_keys_finish)   (CamelCipherContext *context,
-                                                GAsyncResult *result,
-                                                GError **error);
        void            (*export_keys)          (CamelCipherContext *context,
                                                 GPtrArray *keys,
                                                 CamelStream *ostream,
@@ -335,22 +322,6 @@ CamelCipherValidity *
                                                 GError **error);
 
 /* key/certificate routines */
-gboolean       camel_cipher_context_import_keys_sync
-                                               (CamelCipherContext *context,
-                                                CamelStream *istream,
-                                                GCancellable *cancellable,
-                                                GError **error);
-void           camel_cipher_context_import_keys
-                                               (CamelCipherContext *context,
-                                                CamelStream *istream,
-                                                gint io_priority,
-                                                GCancellable *cancellable,
-                                                GAsyncReadyCallback callback,
-                                                gpointer user_data);
-gboolean       camel_cipher_context_import_keys_finish
-                                               (CamelCipherContext *context,
-                                                GAsyncResult *result,
-                                                GError **error);
 gboolean       camel_cipher_context_export_keys_sync
                                                (CamelCipherContext *context,
                                                 GPtrArray *keys,
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index bb48a32..5134efe 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -93,7 +93,6 @@ enum _GpgCtxMode {
        GPG_CTX_MODE_VERIFY,
        GPG_CTX_MODE_ENCRYPT,
        GPG_CTX_MODE_DECRYPT,
-       GPG_CTX_MODE_IMPORT,
        GPG_CTX_MODE_EXPORT
 };
 
@@ -598,10 +597,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_IMPORT:
-               g_ptr_array_add (argv, (guint8 *) "--import");
-               g_ptr_array_add (argv, (guint8 *) "-");
-               break;
        case GPG_CTX_MODE_EXPORT:
                if (gpg->armor)
                        g_ptr_array_add (argv, (guint8 *) "--armor");
@@ -1116,9 +1111,6 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
                                return -1;
                        }
                        break;
-               case GPG_CTX_MODE_IMPORT:
-                       /* noop */
-                       break;
                case GPG_CTX_MODE_EXPORT:
                        /* noop */
                        break;
@@ -2255,47 +2247,6 @@ gpg_decrypt_sync (CamelCipherContext *context,
 }
 
 static gboolean
-gpg_import_keys_sync (CamelCipherContext *context,
-                      CamelStream *istream,
-                      GCancellable *cancellable,
-                      GError **error)
-{
-       struct _GpgCtx *gpg;
-       gboolean success = FALSE;
-
-       gpg = gpg_ctx_new (context);
-       gpg_ctx_set_mode (gpg, GPG_CTX_MODE_IMPORT);
-       gpg_ctx_set_istream (gpg, istream);
-
-       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 gboolean
 gpg_export_keys_sync (CamelCipherContext *context,
                       GPtrArray *keys,
                       CamelStream *ostream,
@@ -2365,7 +2316,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->import_keys_sync = gpg_import_keys_sync;
        cipher_context_class->export_keys_sync = gpg_export_keys_sync;
 
        g_object_class_install_property (
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 52b3563..486fe88 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_import_keys_sync
-camel_cipher_context_import_keys
-camel_cipher_context_import_keys_finish
 camel_cipher_context_export_keys_sync
 camel_cipher_context_export_keys
 camel_cipher_context_export_keys_finish


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