Andreas Krennmair:
[apps/madmutt.git] / cryptglue.c
index f6a1bab..28e8492 100644 (file)
@@ -61,37 +61,36 @@ void crypt_init (void)
 #ifdef CRYPT_BACKEND_CLASSIC_PGP
   if (
 #ifdef CRYPT_BACKEND_GPGME
-      (! option (OPTCRYPTUSEGPGME))
+       (!option (OPTCRYPTUSEGPGME))
 #else
        1
 #endif
-      )
+    )
     crypto_module_register (&crypt_mod_pgp_classic);
 #endif
 
 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
   if (
 #ifdef CRYPT_BACKEND_GPGME
-      (! option (OPTCRYPTUSEGPGME))
+       (!option (OPTCRYPTUSEGPGME))
 #else
        1
 #endif
-      )
+    )
     crypto_module_register (&crypt_mod_smime_classic);
 #endif
 
-  if (option (OPTCRYPTUSEGPGME))
-    {
+  if (option (OPTCRYPTUSEGPGME)) {
 #ifdef CRYPT_BACKEND_GPGME
-      crypto_module_register (&crypt_mod_pgp_gpgme);
-      crypto_module_register (&crypt_mod_smime_gpgme);
+    crypto_module_register (&crypt_mod_pgp_gpgme);
+    crypto_module_register (&crypt_mod_smime_gpgme);
 #else
-      mutt_message (_("\"crypt_use_gpgme\" set"
-                      " but not build with GPGME support."));
-      if (mutt_any_key_to_continue (NULL) == -1)
-       mutt_exit(1);
+    mutt_message (_("\"crypt_use_gpgme\" set"
+                    " but not build with GPGME support."));
+    if (mutt_any_key_to_continue (NULL) == -1)
+      mutt_exit (1);
 #endif
-    }
+  }
 
 #if defined CRYPT_BACKEND_CLASSIG_PGP || defined CRYPT_BACKEND_CLASSIG_SMIME || defined CRYPT_BACKEND_GPGME
   if (CRYPT_MOD_CALL_CHECK (PGP, init))
@@ -106,14 +105,16 @@ void crypt_init (void)
 /* Show a message that a backend will be invoked. */
 void crypt_invoke_message (int type)
 {
-  if ((WithCrypto & APPLICATION_PGP) && (type & APPLICATION_PGP))
+  if ((WithCrypto & APPLICATION_PGP) && (type & APPLICATION_PGP)) {
     mutt_message _("Invoking PGP...");
-  else if ((WithCrypto & APPLICATION_SMIME) && (type & APPLICATION_SMIME))
+  }
+  else if ((WithCrypto & APPLICATION_SMIME) && (type & APPLICATION_SMIME)) {
     mutt_message _("Invoking SMIME...");
+  }
 }
+\f
 
 
-\f
 /* 
 
     PGP
@@ -138,7 +139,7 @@ int crypt_pgp_valid_passphrase (void)
 
 
 /* Decrypt a PGP/MIME message. */
-int crypt_pgp_decrypt_mime (FILE *a, FILE **b, BODY *c, BODY **d)
+int crypt_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, decrypt_mime))
     return (CRYPT_MOD_CALL (PGP, decrypt_mime)) (a, b, c, d);
@@ -147,28 +148,28 @@ int crypt_pgp_decrypt_mime (FILE *a, FILE **b, BODY *c, BODY **d)
 }
 
 /* MIME handler for the application/pgp content-type. */
-void crypt_pgp_application_pgp_handler (BODY *m, STATE *s)
+void crypt_pgp_application_pgp_handler (BODY * m, STATE * s)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, application_handler))
     (CRYPT_MOD_CALL (PGP, application_handler)) (m, s);
 }
 
 /* MIME handler for an PGP/MIME encrypted message. */
-void crypt_pgp_encrypted_handler (BODY *a, STATE *s)
+void crypt_pgp_encrypted_handler (BODY * a, STATE * s)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, encrypted_handler))
     (CRYPT_MOD_CALL (PGP, encrypted_handler)) (a, s);
 }
 
 /* fixme: needs documentation. */
-void crypt_pgp_invoke_getkeys (ADDRESS *addr)
+void crypt_pgp_invoke_getkeys (ADDRESS * addr)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, pgp_invoke_getkeys))
     (CRYPT_MOD_CALL (PGP, pgp_invoke_getkeys)) (addr);
 }
 
 /* Check for a traditional PGP message in body B. */
-int crypt_pgp_check_traditional (FILE *fp, BODY *b, int tagged_only)
+int crypt_pgp_check_traditional (FILE * fp, BODY * b, int tagged_only)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, pgp_check_traditional))
     return (CRYPT_MOD_CALL (PGP, pgp_check_traditional)) (fp, b, tagged_only);
@@ -177,10 +178,11 @@ int crypt_pgp_check_traditional (FILE *fp, BODY *b, int tagged_only)
 }
 
 /* fixme: needs documentation. */
-BODY *crypt_pgp_traditional_encryptsign (BODY *a, int flags, char *keylist)
+BODY *crypt_pgp_traditional_encryptsign (BODY * a, int flags, char *keylist)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, pgp_traditional_encryptsign))
-    return (CRYPT_MOD_CALL (PGP, pgp_traditional_encryptsign)) (a, flags, keylist);
+    return (CRYPT_MOD_CALL (PGP, pgp_traditional_encryptsign)) (a, flags,
+                                                                keylist);
 
   return NULL;
 }
@@ -196,7 +198,7 @@ BODY *crypt_pgp_make_key_attachment (char *tempf)
 
 /* This routine attempts to find the keyids of the recipients of a
    message.  It returns NULL if any of the keys can not be found.  */
-char *crypt_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *crypt_pgp_findkeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, findkeys))
     return (CRYPT_MOD_CALL (PGP, findkeys)) (to, cc, bcc);
@@ -205,7 +207,7 @@ char *crypt_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
 }
 
 /* Create a new body with a PGP signed message from A. */
-BODY *crypt_pgp_sign_message (BODY *a)
+BODY *crypt_pgp_sign_message (BODY * a)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, sign_message))
     return (CRYPT_MOD_CALL (PGP, sign_message)) (a);
@@ -215,7 +217,7 @@ BODY *crypt_pgp_sign_message (BODY *a)
 
 /* Warning: A is no longer freed in this routine, you need to free it
    later.  This is necessary for $fcc_attach. */
-BODY *crypt_pgp_encrypt_message (BODY *a, char *keylist, int sign)
+BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, pgp_encrypt_message))
     return (CRYPT_MOD_CALL (PGP, pgp_encrypt_message)) (a, keylist, sign);
@@ -231,7 +233,7 @@ void crypt_pgp_invoke_import (const char *fname)
 }
 
 /* fixme: needs documentation */
-int crypt_pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempf)
+int crypt_pgp_verify_one (BODY * sigbdy, STATE * s, const char *tempf)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, verify_one))
     return (CRYPT_MOD_CALL (PGP, verify_one)) (sigbdy, s, tempf);
@@ -240,7 +242,7 @@ int crypt_pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempf)
 }
 
 
-int crypt_pgp_send_menu (HEADER *msg, int *redraw)
+int crypt_pgp_send_menu (HEADER * msg, int *redraw)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, send_menu))
     return (CRYPT_MOD_CALL (PGP, send_menu)) (msg, redraw);
@@ -250,14 +252,16 @@ int crypt_pgp_send_menu (HEADER *msg, int *redraw)
 
 
 /* fixme: needs documentation */
-void crypt_pgp_extract_keys_from_attachment_list (FILE *fp, int tag, BODY *top)
+void crypt_pgp_extract_keys_from_attachment_list (FILE * fp, int tag,
+                                                  BODY * top)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, pgp_extract_keys_from_attachment_list))
-    (CRYPT_MOD_CALL (PGP, pgp_extract_keys_from_attachment_list)) (fp, tag, top);
+    (CRYPT_MOD_CALL (PGP, pgp_extract_keys_from_attachment_list)) (fp, tag,
+                                                                   top);
 }
+\f
 
 
-\f
 /* 
 
    S/MIME 
@@ -281,7 +285,7 @@ int crypt_smime_valid_passphrase (void)
 }
 
 /* Decrypt am S/MIME message. */
-int crypt_smime_decrypt_mime (FILE *a, FILE **b, BODY *c, BODY **d)
+int crypt_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, decrypt_mime))
     return (CRYPT_MOD_CALL (SMIME, decrypt_mime)) (a, b, c, d);
@@ -290,28 +294,28 @@ int crypt_smime_decrypt_mime (FILE *a, FILE **b, BODY *c, BODY **d)
 }
 
 /* MIME handler for the application/smime content-type. */
-void crypt_smime_application_smime_handler (BODY *m, STATE *s)
+void crypt_smime_application_smime_handler (BODY * m, STATE * s)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, application_handler))
     (CRYPT_MOD_CALL (SMIME, application_handler)) (m, s);
 }
 
 /* MIME handler for an PGP/MIME encrypted message. */
-void crypt_smime_encrypted_handler (BODY *a, STATE *s)
+void crypt_smime_encrypted_handler (BODY * a, STATE * s)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, encrypted_handler))
     (CRYPT_MOD_CALL (SMIME, encrypted_handler)) (a, s);
 }
 
 /* fixme: Needs documentation. */
-void crypt_smime_getkeys (ENVELOPE *env)
+void crypt_smime_getkeys (ENVELOPE * env)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, smime_getkeys))
     (CRYPT_MOD_CALL (SMIME, smime_getkeys)) (env);
 }
 
 /* Check that the sender matches. */
-int crypt_smime_verify_sender(HEADER *h)
+int crypt_smime_verify_sender (HEADER * h)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, smime_verify_sender))
     return (CRYPT_MOD_CALL (SMIME, smime_verify_sender)) (h);
@@ -321,7 +325,7 @@ int crypt_smime_verify_sender(HEADER *h)
 
 /* This routine attempts to find the keyids of the recipients of a
    message.  It returns NULL if any of the keys can not be found.  */
-char *crypt_smime_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *crypt_smime_findkeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, findkeys))
     return (CRYPT_MOD_CALL (SMIME, findkeys)) (to, cc, bcc);
@@ -330,7 +334,7 @@ char *crypt_smime_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
 }
 
 /* fixme: Needs documentation. */
-BODY *crypt_smime_sign_message (BODY *a)
+BODY *crypt_smime_sign_message (BODY * a)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, sign_message))
     return (CRYPT_MOD_CALL (SMIME, sign_message)) (a);
@@ -339,7 +343,7 @@ BODY *crypt_smime_sign_message (BODY *a)
 }
 
 /* fixme: needs documentation. */
-BODY *crypt_smime_build_smime_entity (BODY *a, char *certlist)
+BODY *crypt_smime_build_smime_entity (BODY * a, char *certlist)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, smime_build_smime_entity))
     return (CRYPT_MOD_CALL (SMIME, smime_build_smime_entity)) (a, certlist);
@@ -355,7 +359,7 @@ void crypt_smime_invoke_import (char *infile, char *mailbox)
 }
 
 /* fixme: needs documentation */
-int crypt_smime_verify_one (BODY *sigbdy, STATE *s, const char *tempf)
+int crypt_smime_verify_one (BODY * sigbdy, STATE * s, const char *tempf)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, verify_one))
     return (CRYPT_MOD_CALL (SMIME, verify_one)) (sigbdy, s, tempf);
@@ -363,7 +367,7 @@ int crypt_smime_verify_one (BODY *sigbdy, STATE *s, const char *tempf)
   return -1;
 }
 
-int crypt_smime_send_menu (HEADER *msg, int *redraw)
+int crypt_smime_send_menu (HEADER * msg, int *redraw)
 {
   if (CRYPT_MOD_CALL_CHECK (SMIME, send_menu))
     return (CRYPT_MOD_CALL (SMIME, send_menu)) (msg, redraw);