finish the "read" of charset.c
[apps/madmutt.git] / lib-crypt / pgp.c
index 1c9e4bc..bb55885 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <lib-ui/curses.h>
 #include <lib-ui/enter.h>
+#include <lib-ui/menu.h>
 
 #include "mutt.h"
 #include "handler.h"
@@ -38,7 +39,6 @@
 #include "copy.h"
 #include "attach.h"
 
-#include "lib/debug.h"
 
 #include <sys/wait.h>
 #include <string.h>
@@ -61,7 +61,6 @@
 #endif
 
 #include "crypt.h"
-#include "mutt_menu.h"
 
 
 char PgpPass[LONG_STRING];
@@ -69,7 +68,7 @@ time_t PgpExptime = 0;          /* when does the cached passphrase expire? */
 
 void pgp_void_passphrase (void)
 {
-  p_clear(PgpPass, sizeof(PgpPass));
+  p_clear(PgpPass, countof(PgpPass));
   PgpExptime = 0;
 }
 
@@ -148,15 +147,12 @@ static int pgp_copy_checksig (FILE * fpin, FILE * fpout)
   if (PgpGoodSign.pattern) {
     char *line = NULL;
     int lineno = 0;
-    size_t linelen;
+    ssize_t linelen;
 
     while ((line = mutt_read_line (line, &linelen, fpin, &lineno)) != NULL) {
       if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) {
-        debug_print (2, ("\"%s\" matches regexp.\n", line));
         rv = 0;
       }
-      else
-        debug_print (2, ("\"%s\" doesn't match regexp.\n", line));
 
       if (strncmp (line, "[GNUPG:] ", 9) == 0)
         continue;
@@ -166,7 +162,6 @@ static int pgp_copy_checksig (FILE * fpin, FILE * fpout)
     p_delete(&line);
   }
   else {
-    debug_print (2, ("No pattern.\n"));
     mutt_copy_stream (fpin, fpout);
     rv = 1;
   }
@@ -192,7 +187,7 @@ static void pgp_copy_clearsigned (FILE * fpin, STATE * s, char *charset)
   char buf[HUGE_STRING];
   short complete, armor_header;
 
-  FGETCONV *fc;
+  fgetconv_t *fc;
 
   rewind (fpin);
 
@@ -419,8 +414,7 @@ int pgp_application_pgp_handler (BODY * m, STATE * s)
           pgp_copy_clearsigned (tmpfp, s, body_charset);
       }
       else if (pgpout) {
-        FGETCONV *fc;
-        int c;
+        fgetconv_t *fc;
 
         rewind (pgpout);
         state_set_prefix (s);
@@ -602,8 +596,6 @@ int pgp_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
 
     if ((rv = mutt_wait_filter (thepid)))
       badsig = -1;
-
-    debug_print (1, ("mutt_wait_filter returned %d.\n", rv));
   }
 
   safe_fclose (&pgperr);
@@ -613,8 +605,6 @@ int pgp_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
   mutt_unlink (sigfile);
   mutt_unlink (pgperrfile);
 
-  debug_print (1, ("returning %d.\n", badsig));
-
   return badsig;
 }
 
@@ -1145,8 +1135,8 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
       }
       else if (r == -1) {
         p_delete(&keylist);
-        address_delete (&tmp);
-        address_delete (&addr);
+        address_list_wipe(&tmp);
+        address_list_wipe(&addr);
         return NULL;
       }
     }
@@ -1162,8 +1152,8 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
       if ((key = pgp_ask_for_key (buf, q->mailbox,
                                   KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL) {
         p_delete(&keylist);
-        address_delete (&tmp);
-        address_delete (&addr);
+        address_list_wipe(&tmp);
+        address_list_wipe(&addr);
         return NULL;
       }
     }
@@ -1180,10 +1170,10 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
     keylist_used = m_strlen(keylist);
 
     pgp_free_key (&key);
-    address_delete (&addr);
+    address_list_wipe(&addr);
 
   }
-  address_delete (&tmp);
+  address_list_wipe(&tmp);
   return (keylist);
 }
 
@@ -1358,9 +1348,9 @@ BODY *pgp_traditional_encryptsign (BODY * a, int flags, char *keylist)
   else
     from_charset = Charset;
 
-  if (!mutt_is_us_ascii (body_charset)) {
+  if (!charset_is_us_ascii (body_charset)) {
     int c;
-    FGETCONV *fc;
+    fgetconv_t *fc;
 
     if (flags & ENCRYPT)
       send_charset = "us-ascii";