From a0aa4a45870f1607e8b41760866071692675c84d Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Fri, 17 Nov 2006 13:07:25 +0100 Subject: [PATCH] remove a whole lot of #include mutt.h Signed-off-by: Pierre Habouzit --- charset.c | 1 - charset.def | 3 +++ lib-crypt/crypt-gpgme.c | 1 - lib-crypt/crypt-mod.h | 2 +- lib-crypt/crypt.c | 2 +- lib-crypt/crypt.h | 3 +-- lib-crypt/cryptglue.c | 8 ------ lib-crypt/gnupgparse.c | 1 - lib-crypt/pgp.c | 60 +++-------------------------------------- lib-crypt/pgpinvoke.c | 10 +++---- lib-crypt/pgpkey.c | 2 +- lib-crypt/pgplib.c | 5 ++-- lib-crypt/pgpmicalg.c | 7 +++-- lib-crypt/smime.c | 12 ++++----- lib-mime/crypt.c | 2 ++ lib-mime/mime-token.sh | 3 +++ send.c | 10 +++---- 17 files changed, 34 insertions(+), 98 deletions(-) diff --git a/charset.c b/charset.c index 32317b1..29aa776 100644 --- a/charset.c +++ b/charset.c @@ -27,7 +27,6 @@ #include -#include #ifdef HAVE_LANGINFO_CODESET # include #endif diff --git a/charset.def b/charset.def index 1143cf0..eb55ee2 100644 --- a/charset.def +++ b/charset.def @@ -31,6 +31,9 @@ cat < #include -#include "mutt.h" #include "lib.h" #include "alias.h" #include diff --git a/lib-crypt/crypt-mod.h b/lib-crypt/crypt-mod.h index 679b81e..c74081e 100644 --- a/lib-crypt/crypt-mod.h +++ b/lib-crypt/crypt-mod.h @@ -10,7 +10,7 @@ #ifndef CRYPTOGRAPHY_H #define CRYPTOGRAPHY_H -#include "mutt.h" +#include #include "crypt.h" /* diff --git a/lib-crypt/crypt.c b/lib-crypt/crypt.c index f5953bc..19d36c0 100644 --- a/lib-crypt/crypt.c +++ b/lib-crypt/crypt.c @@ -25,7 +25,7 @@ #include -#include "mutt.h" +#include "mx.h" #include "alias.h" #include "handler.h" #include "copy.h" diff --git a/lib-crypt/crypt.h b/lib-crypt/crypt.h index 3a2a207..274fbfa 100644 --- a/lib-crypt/crypt.h +++ b/lib-crypt/crypt.h @@ -16,14 +16,13 @@ #ifndef MUTT_CRYPT_H #define MUTT_CRYPT_H -#include "mutt.h" /* Need this to declare BODY, address_t. STATE etc. */ +#include #include "state.h" /* FIXME: They should be pointer to anonymous structures for better information hiding. */ - #define ENCRYPT (1 << 0) #define SIGN (1 << 1) #define GOODSIGN (1 << 2) diff --git a/lib-crypt/cryptglue.c b/lib-crypt/cryptglue.c index 860f8af..5ea7ace 100644 --- a/lib-crypt/cryptglue.c +++ b/lib-crypt/cryptglue.c @@ -280,14 +280,6 @@ int crypt_smime_application_smime_handler (BODY * m, STATE * s) return (-1); } -/* MIME handler for an PGP/MIME encrypted message. */ -int crypt_smime_encrypted_handler (BODY * a, STATE * s) -{ - if (CRYPT_MOD_CALL_CHECK (SMIME, encrypted_handler)) - return (CRYPT_MOD_CALL (SMIME, encrypted_handler)) (a, s); - return (-1); -} - /* fixme: Needs documentation. */ void crypt_smime_getkeys (ENVELOPE * env) { diff --git a/lib-crypt/gnupgparse.c b/lib-crypt/gnupgparse.c index 5943467..d4876d6 100644 --- a/lib-crypt/gnupgparse.c +++ b/lib-crypt/gnupgparse.c @@ -24,7 +24,6 @@ #include #include -#include "mutt.h" #include "pgp.h" #include "charset.h" diff --git a/lib-crypt/pgp.c b/lib-crypt/pgp.c index 8875ed9..d729bcf 100644 --- a/lib-crypt/pgp.c +++ b/lib-crypt/pgp.c @@ -24,12 +24,13 @@ #endif #include +#include #include #include #include -#include "mutt.h" +#include "mx.h" #include "handler.h" #include "pgp.h" #include "copy.h" @@ -586,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; @@ -1078,7 +1024,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]; diff --git a/lib-crypt/pgpinvoke.c b/lib-crypt/pgpinvoke.c index 1428e47..b3d42a2 100644 --- a/lib-crypt/pgpinvoke.c +++ b/lib-crypt/pgpinvoke.c @@ -14,12 +14,9 @@ #include #include - #include - #include -#include "mutt.h" #include "mutt_idna.h" #include "pgp.h" @@ -37,7 +34,7 @@ struct pgp_command_context { }; -const char * +static const char * _mutt_fmt_pgp_command(char *dest, ssize_t destlen, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, @@ -120,8 +117,9 @@ _mutt_fmt_pgp_command(char *dest, ssize_t destlen, return (src); } -void mutt_pgp_command (char *d, ssize_t dlen, struct pgp_command_context *cctx, - const char *fmt) +static void +mutt_pgp_command(char *d, ssize_t dlen, struct pgp_command_context *cctx, + const char *fmt) { mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command, (unsigned long) cctx, 0); diff --git a/lib-crypt/pgpkey.c b/lib-crypt/pgpkey.c index ddb8f1c..e5686a5 100644 --- a/lib-crypt/pgpkey.c +++ b/lib-crypt/pgpkey.c @@ -11,12 +11,12 @@ #include #include +#include #include #include #include -#include "mutt.h" #include "recvattach.h" #include "pgp.h" #include "pager.h" diff --git a/lib-crypt/pgplib.c b/lib-crypt/pgplib.c index 923aa14..9213016 100644 --- a/lib-crypt/pgplib.c +++ b/lib-crypt/pgplib.c @@ -11,7 +11,6 @@ #include -#include "mutt.h" #include "lib.h" #include "pgplib.h" @@ -97,7 +96,7 @@ short pgp_get_abilities (unsigned char type) return (pgp_canencrypt (type) << 1) | pgp_cansign (type); } -void pgp_free_sig (pgp_sig_t ** sigp) +static void pgp_free_sig (pgp_sig_t ** sigp) { pgp_sig_t *sp, *q; @@ -112,7 +111,7 @@ void pgp_free_sig (pgp_sig_t ** sigp) *sigp = NULL; } -void pgp_free_uid (pgp_uid_t ** upp) +static void pgp_free_uid (pgp_uid_t ** upp) { pgp_uid_t *up, *q; diff --git a/lib-crypt/pgpmicalg.c b/lib-crypt/pgpmicalg.c index c070173..d2743f3 100644 --- a/lib-crypt/pgpmicalg.c +++ b/lib-crypt/pgpmicalg.c @@ -13,15 +13,14 @@ #include -#include "mutt.h" +#include +#include + #include "handler.h" #include "pgp.h" #include "pgppacket.h" #include "charset.h" -#include - -#include static struct { short id; diff --git a/lib-crypt/smime.c b/lib-crypt/smime.c index 24ed09a..479fd8c 100644 --- a/lib-crypt/smime.c +++ b/lib-crypt/smime.c @@ -16,17 +16,19 @@ #endif #include +#include #include #include #include -#include "mutt.h" #include "alias.h" #include "handler.h" #include "copy.h" #include "alias.h" + #include "crypt.h" +#include "smime.h" struct smime_command_context { const char *key; /* %k */ @@ -607,15 +609,11 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, return m_strdup(key); } - - - /* This sets the '*ToUse' variables for an upcoming decryption, where the reuquired key is different from SmimeDefaultKey. */ - -void _smime_getkeys (char *mailbox) +static void _smime_getkeys (char *mailbox) { char *k = NULL; char buf[STRING]; @@ -735,7 +733,7 @@ char *smime_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]; diff --git a/lib-mime/crypt.c b/lib-mime/crypt.c index 919c3bb..16cbebd 100644 --- a/lib-mime/crypt.c +++ b/lib-mime/crypt.c @@ -138,6 +138,8 @@ int mutt_is_application_pgp (BODY * m) return t ? t | PGPINLINE : 0; } +#include "mutt.h" + int mutt_is_application_smime (BODY * m) { char *t = NULL; diff --git a/lib-mime/mime-token.sh b/lib-mime/mime-token.sh index cfba154..229394c 100644 --- a/lib-mime/mime-token.sh +++ b/lib-mime/mime-token.sh @@ -56,6 +56,9 @@ do_c() { #include #include "mime-token.h" +static const struct tok * +mime_which_token_aux(const char *str, unsigned int len); + %} struct tok { const char *name; int val; }; %% diff --git a/send.c b/send.c index 27db967..ace09c0 100644 --- a/send.c +++ b/send.c @@ -12,10 +12,10 @@ #include #include +#include #include #include -#include "mutt.h" #include "alias.h" #include "keymap.h" #include "copy.h" @@ -281,7 +281,7 @@ static int edit_envelope (ENVELOPE * en, int flags) } #ifdef USE_NNTP -char *nntp_get_header(const char *s) +static char *nntp_get_header(const char *s) { return m_strdup(skipspaces(s)); } @@ -577,8 +577,8 @@ void mutt_fix_reply_recipients (ENVELOPE * env) } /* the CC field can get cluttered, especially with lists */ - address_list_uniq(&env->to); - address_list_uniq(&env->cc); + address_list_uniq(env->to); + address_list_uniq(env->cc); env->cc = mutt_remove_xrefs (env->to, env->cc); if (env->cc && !env->to) { @@ -904,7 +904,7 @@ void mutt_set_followup_to (ENVELOPE * e) } } - address_list_uniq(&e->mail_followup_to); + address_list_uniq(e->mail_followup_to); } } -- 2.20.1