More simplification and prototype hiding
[apps/madmutt.git] / crypt.c
diff --git a/crypt.c b/crypt.c
index b22d616..d044e9a 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -76,6 +76,34 @@ static gpgme_key_t signature_key = NULL;
  * General helper functions.
  */
 
+static void convert_to_7bit (BODY * a)
+{
+  while (a) {
+    if (a->type == TYPEMULTIPART) {
+      if (a->encoding != ENC7BIT) {
+        a->encoding = ENC7BIT;
+        convert_to_7bit (a->parts);
+      } else {
+        convert_to_7bit (a->parts);
+      }
+    }
+    else if (a->type == TYPEMESSAGE &&
+             m_strcasecmp(a->subtype, "delivery-status")) {
+      if (a->encoding != ENC7BIT)
+        mutt_message_to_7bit (a, NULL);
+    }
+    else if (a->encoding == ENC8BIT)
+      a->encoding = ENCQUOTEDPRINTABLE;
+    else if (a->encoding == ENCBINARY)
+      a->encoding = ENCBASE64;
+    else if (a->content && a->encoding != ENCBASE64 &&
+             (a->content->from || a->content->space))
+      a->encoding = ENCQUOTEDPRINTABLE;
+    a = a->next;
+  }
+}
+
+
 /* return true when S points to a didgit or letter. */
 static int digit_or_letter (const unsigned char *s)
 {
@@ -781,24 +809,13 @@ static BODY *sign_message (BODY * a, int use_smime)
   return a;
 }
 
-
-BODY *crypt_pgp_sign_message (BODY * a)
-{
-  return sign_message (a, 0);
-}
-
-BODY *crypt_smime_sign_message (BODY * a)
-{
-  return sign_message (a, 1);
-}
-
 /*
  * Implementation of `encrypt_message'.
  */
 
 /* Encrypt the mail body A to all keys given as space separated keyids
    or fingerprints in KEYLIST and return the encrypted body.  */
-BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign)
+static BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign)
 {
   char *outfile = NULL;
   BODY *t;
@@ -858,7 +875,7 @@ BODY *crypt_pgp_encrypt_message (BODY * a, char *keylist, int sign)
 
 /* Encrypt the mail body A to all keys given as space separated
    fingerprints in KEYLIST and return the S/MIME encrypted body.  */
-BODY *crypt_smime_build_smime_entity (BODY * a, char *keylist)
+static BODY *crypt_smime_build_smime_entity (BODY * a, char *keylist)
 {
   char *outfile = NULL;
   BODY *t;
@@ -1198,7 +1215,7 @@ static int show_one_sig_status (gpgme_ctx_t ctx, int idx, STATE * s)
 
 /* Do the actual verification step. With IS_SMIME set to true we
    assume S/MIME (surprise!) */
-int crypt_verify_one(BODY *sigbdy, STATE *s, FILE *fp, int is_smime)
+static int crypt_verify_one(BODY *sigbdy, STATE *s, FILE *fp, int is_smime)
 {
   int badsig = -1;
   int anywarn = 0;
@@ -3825,7 +3842,7 @@ int crypt_smime_verify_sender (HEADER * h)
   return ret;
 }
 
-void crypt_invoke_import(FILE *stream, int smime)
+static void crypt_invoke_import(FILE *stream, int smime)
 {
     gpgme_ctx_t ctx = create_gpgme_context(smime);
     gpgme_data_t data;
@@ -3935,14 +3952,14 @@ int mutt_protect (HEADER * msg, char *keylist)
 
   if (msg->security & SIGN) {
     if (msg->security & APPLICATION_SMIME) {
-      if (!(tmp_pbody = crypt_smime_sign_message (msg->content)))
+      if (!(tmp_pbody = sign_message(msg->content, 1)))
         return -1;
       pbody = tmp_smime_pbody = tmp_pbody;
     }
 
     if ((msg->security & APPLICATION_PGP)
         && (!(flags & ENCRYPT) || option (OPTPGPRETAINABLESIG))) {
-      if (!(tmp_pbody = crypt_pgp_sign_message (msg->content)))
+      if (!(tmp_pbody = sign_message(msg->content, 0)))
         return -1;
 
       flags &= ~SIGN;
@@ -4086,36 +4103,6 @@ static void crypt_write_signed(BODY * a, STATE * s, FILE *fp)
     }
 }
 
-
-
-void convert_to_7bit (BODY * a)
-{
-  while (a) {
-    if (a->type == TYPEMULTIPART) {
-      if (a->encoding != ENC7BIT) {
-        a->encoding = ENC7BIT;
-        convert_to_7bit (a->parts);
-      } else {
-        convert_to_7bit (a->parts);
-      }
-    }
-    else if (a->type == TYPEMESSAGE &&
-             m_strcasecmp(a->subtype, "delivery-status")) {
-      if (a->encoding != ENC7BIT)
-        mutt_message_to_7bit (a, NULL);
-    }
-    else if (a->encoding == ENC8BIT)
-      a->encoding = ENCQUOTEDPRINTABLE;
-    else if (a->encoding == ENCBINARY)
-      a->encoding = ENCBASE64;
-    else if (a->content && a->encoding != ENCBASE64 &&
-             (a->content->from || a->content->space))
-      a->encoding = ENCQUOTEDPRINTABLE;
-    a = a->next;
-  }
-}
-
-
 static void extract_keys_aux(FILE *fpout, HEADER *h)
 {
     mutt_parse_mime_message (Context, h);