drop even more stupid glue.
[apps/madmutt.git] / lib-crypt / crypt-mod.h
index 679b81e..fa1833d 100644 (file)
 #ifndef CRYPTOGRAPHY_H
 #define CRYPTOGRAPHY_H
 
-#include "mutt.h"
+#include <lib-mime/mime.h>
 #include "crypt.h"
 
-/* 
-    Type defintions for crypto module functions.
- */
-typedef void (*crypt_func_void_passphrase_t) (void);
-typedef int (*crypt_func_valid_passphrase_t) (void);
-
+/* Type defintions for crypto module functions. */
 typedef int (*crypt_func_decrypt_mime_t) (FILE * a, FILE ** b,
                                           BODY * c, BODY ** d);
 
@@ -58,14 +53,9 @@ typedef void (*crypt_func_smime_invoke_import_t) (char *infile,
 typedef void (*crypt_func_init_t) (void);
 
 
-/*
-   A structure to keep all crypto module fucntions together.
- */
-typedef struct crypt_module_functions {
+typedef struct crypt_module_specs {
     /* Common/General functions.  */
     crypt_func_init_t init;
-    crypt_func_void_passphrase_t void_passphrase;
-    crypt_func_valid_passphrase_t valid_passphrase;
     crypt_func_decrypt_mime_t decrypt_mime;
     crypt_func_application_handler_t application_handler;
     crypt_func_encrypted_handler_t encrypted_handler;
@@ -91,36 +81,15 @@ typedef struct crypt_module_functions {
     crypt_func_smime_verify_sender_t smime_verify_sender;
     crypt_func_smime_build_smime_entity_t smime_build_smime_entity;
     crypt_func_smime_invoke_import_t smime_invoke_import;
-} crypt_module_functions_t;
-
-
-/*
-   A structure to decribe a crypto module. 
- */
-typedef struct crypt_module_specs {
-  int identifier;               /* Identifying bit.  */
-  crypt_module_functions_t functions;
-}                 *crypt_module_specs_t;
-
-
-
-/* 
-   High Level crypto module interface. 
- */
+} crypt_module_specs_t;
 
-void crypto_module_register (crypt_module_specs_t specs);
-crypt_module_specs_t crypto_module_lookup (int identifier);
+struct crypt_module_specs crypt_mod_SMIME_gpgme;
+struct crypt_module_specs crypt_mod_PGP_gpgme;
 
-/* If the crypto module identifier by IDENTIFIER has been registered,
-   call its function FUNC.  Do nothing else.  This may be used as an
-   expression. */
 #define CRYPT_MOD_CALL_CHECK(identifier, func) \
-  (crypto_module_lookup (APPLICATION_ ## identifier) \
-   && (crypto_module_lookup (APPLICATION_ ## identifier))->functions.func)
+    ((crypt_mod_##identifier##_gpgme).func)
 
-/* Call the function FUNC in the crypto module identified by
-   IDENTIFIER. This may be used as an expression. */
 #define CRYPT_MOD_CALL(identifier, func) \
-  *(crypto_module_lookup (APPLICATION_ ## identifier))->functions.func
+    (*((crypt_mod_##identifier##_gpgme).func))
 
 #endif