Fix compilation warnings in pgp.c
[apps/madmutt.git] / lib-crypt / pgp.c
index 289ffc8..b29d35b 100644 (file)
  * a message.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 #include <lib-lib/lib-lib.h>
 
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
 #include <lib-mime/mime.h>
+#include <lib-sys/unix.h>
 
 #include <lib-ui/curses.h>
 #include <lib-ui/enter.h>
 #include <lib-ui/menu.h>
 
-#include "mutt.h"
+#include "mx.h"
 #include "handler.h"
 #include "pgp.h"
 #include "copy.h"
 #include "attach.h"
 
-
-#include <sys/wait.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <ctype.h>
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
 #include "crypt.h"
 
 
@@ -607,61 +587,6 @@ int pgp_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
 
 /* Extract pgp public keys from messages or attachments */
 
-void pgp_extract_keys_from_messages (HEADER * h)
-{
-  int i;
-  char tempfname[_POSIX_PATH_MAX];
-  FILE *fpout;
-
-  if (h) {
-    mutt_parse_mime_message (Context, h);
-    if (h->security & PGPENCRYPT && !pgp_valid_passphrase ())
-      return;
-  }
-
-  mutt_mktemp (tempfname);
-  if (!(fpout = safe_fopen (tempfname, "w"))) {
-    mutt_perror (tempfname);
-    return;
-  }
-
-  set_option (OPTDONTHANDLEPGPKEYS);
-
-  if (!h) {
-    for (i = 0; i < Context->vcount; i++) {
-      if (Context->hdrs[Context->v2r[i]]->tagged) {
-        mutt_parse_mime_message (Context, Context->hdrs[Context->v2r[i]]);
-        if (Context->hdrs[Context->v2r[i]]->security & PGPENCRYPT
-            && !pgp_valid_passphrase ()) {
-          fclose (fpout);
-          goto bailout;
-        }
-        mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
-                           M_CM_DECODE | M_CM_CHARCONV, 0);
-      }
-    }
-  }
-  else {
-    mutt_parse_mime_message (Context, h);
-    if (h->security & PGPENCRYPT && !pgp_valid_passphrase ()) {
-      fclose (fpout);
-      goto bailout;
-    }
-    mutt_copy_message (fpout, Context, h, M_CM_DECODE | M_CM_CHARCONV, 0);
-  }
-
-  fclose (fpout);
-  mutt_endwin (NULL);
-  pgp_invoke_import (tempfname);
-  mutt_any_key_to_continue (NULL);
-
-bailout:
-
-  mutt_unlink (tempfname);
-  unset_option (OPTDONTHANDLEPGPKEYS);
-
-}
-
 static void pgp_extract_keys_from_attachment (FILE * fp, BODY * top)
 {
   STATE s;
@@ -1065,7 +990,8 @@ static short is_numerical_keyid (const char *s)
  */
 char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
 {
-  char *keyID, *keylist = NULL, *t;
+  char *keylist = NULL, *t;
+  const char *keyID;
   size_t keylist_size = 0;
   size_t keylist_used = 0;
   address_t *tmp = NULL, *addr = NULL;
@@ -1099,7 +1025,7 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
   if (fqdn)
     rfc822_qualify (tmp, fqdn);
 
-  address_list_uniq(&tmp);
+  address_list_uniq(tmp);
 
   for (p = tmp; p; p = p->next) {
     char buf[LONG_STRING];