Move many things to the crypt module \o/
[apps/madmutt.git] / crypt.cpkg
similarity index 97%
rename from crypt.c
rename to crypt.cpkg
index 2273165..1350166 100644 (file)
--- a/crypt.c
 #include "recvattach.h"
 #include "sort.h"
 
+@import "lib-lua/base.cpkg"
+
+@package mod_crypt {
+    bool autosmime = 1;
+    /*
+     ** .pp
+     ** This variable controls whether or not Madmutt may automatically enable
+     ** S/MIME encryption/signing for messages. See also ``$$crypt_autoencrypt'',
+     ** ``$$crypt_replyencrypt'',
+     ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
+     */
+    bool autopgp = 1;
+    /*
+     ** .pp
+     ** This variable controls whether or not Madmutt may automatically enable
+     ** PGP encryption/signing for messages.  See also ``$$crypt_autoencrypt'',
+     ** ``$$crypt_replyencrypt'',
+     ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
+     */
+    bool autosign = 0;
+    /*
+     ** .pp
+     ** Setting this variable will cause Madmutt to always attempt to
+     ** cryptographically sign outgoing messages.  This can be overridden
+     ** by use of the \fIpgp-menu\fP, when signing is not required or
+     ** encryption is requested as well. If ``$$smime_is_default'' is \fIset\fP,
+     ** then OpenSSL is used instead to create S/MIME messages and settings can
+     ** be overridden by use of the \fIsmime-menu\fP.
+     ** (Crypto only)
+     */
+    bool autoencrypt = 0;
+    /*
+     ** .pp
+     ** Setting this variable will cause Madmutt to always attempt to PGP
+     ** encrypt outgoing messages.  This is probably only useful in
+     ** connection to the \fIsend-hook\fP command.  It can be overridden
+     ** by use of the \fIpgp-menu\fP, when encryption is not required or
+     ** signing is requested as well.  If ``$$smime_is_default'' is \fIset\fP,
+     ** then OpenSSL is used instead to create S/MIME messages and
+     ** settings can be overridden by use of the \fIsmime-menu\fP.
+     ** (Crypto only)
+     */
+    bool replyencrypt = 1;
+    /*
+     ** .pp
+     ** If \fIset\fP, automatically PGP or OpenSSL encrypt replies to messages which are
+     ** encrypted.
+     ** (Crypto only)
+     */
+    bool replysign = 0;
+    /*
+     ** .pp
+     ** If \fIset\fP, automatically PGP or OpenSSL sign replies to messages which are
+     ** signed.
+     ** .pp
+     ** \fBNote:\fP this does not work on messages that are encrypted \fBand\fP signed!
+     ** (Crypto only)
+     */
+    bool replysignencrypted = 1;
+    /*
+     ** .pp
+     ** If \fIset\fP, automatically PGP or OpenSSL sign replies to messages
+     ** which are encrypted. This makes sense in combination with
+     ** ``$$crypt_replyencrypt'', because it allows you to sign all
+     ** messages which are automatically encrypted.  This works around
+     ** the problem noted in ``$$crypt_replysign'', that Madmutt is not able
+     ** to find out whether an encrypted message is also signed.
+     ** (Crypto only)
+     */
+    quadopt_t verify_sig = M_YES;
+    /*
+     ** .pp
+     ** If ``\fIyes\fP'', always attempt to verify PGP or S/MIME signatures.
+     ** If ``\fIask\fP'', ask whether or not to verify the signature.
+     ** If ``\fIno\fP'', never attempt to verify cryptographic signatures.
+     ** (Crypto only)
+     */
+};
+
 /* Values used for comparing addresses. */
 #define CRYPT_KV_VALID    1
 #define CRYPT_KV_ADDR     2
@@ -2360,7 +2439,7 @@ static const unsigned char *parse_dn_part (struct dn_array_s *array,
         s++;
         if (*s == ',' || *s == '=' || *s == '+'
             || *s == '<' || *s == '>' || *s == '#' || *s == ';'
-            || *s == '\\' || *s == '\"' || *s == ' ')
+            || *s == '\\' || *s == '"' || *s == ' ')
           n++;
         else if (hexval(*s) >= 0 && hexval(*s + 1) >= 0) {
           s++;
@@ -2369,7 +2448,7 @@ static const unsigned char *parse_dn_part (struct dn_array_s *array,
         else
           return NULL;          /* invalid escape sequence */
       }
-      else if (*s == '\"')
+      else if (*s == '"')
         return NULL;            /* invalid encoding */
       else if (*s == ',' || *s == '=' || *s == '+'
                || *s == '<' || *s == '>' || *s == '#' || *s == ';')
@@ -3927,3 +4006,5 @@ int mutt_signed_handler(BODY *a, STATE *s)
 
   return (rc);
 }
+
+/* vim:set ft=c: */