* Don't use mutt_save_attachment() because we want to perform charset
* conversion since this will be displayed by the internal pager.
*/
- STATE decode_state;
+ struct State decode_state;
memset(&decode_state, 0, sizeof(decode_state));
decode_state.fpout = safe_fopen(pagerfile, "w");
{
/* recv case */
- STATE s;
+ struct State s;
- memset(&s, 0, sizeof(STATE));
+ memset(&s, 0, sizeof(struct State));
/* perform charset conversion on text attachments when piping */
s.flags = MUTT_CHARCONV;
{
/* In recv mode, extract from folder and decode */
- STATE s;
+ struct State s;
memset(&s, 0, sizeof(s));
if ((s.fpout = save_attachment_open(path, flags)) == NULL)
/* returns 0 on success, -1 on error */
int mutt_decode_save_attachment(FILE *fp, struct Body *m, char *path, int displaying, int flags)
{
- STATE s;
+ struct State s;
unsigned int saved_encoding = 0;
struct Body *saved_parts = NULL;
struct Header *saved_hdr = NULL;
int _mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, struct Body *body, int flags, int chflags)
{
char prefix[SHORT_STRING];
- STATE s;
+ struct State s;
LOFF_T new_offset = -1;
int rc = 0;
if (flags & MUTT_CM_DECODE)
{
/* now make a text/plain version of the message */
- memset(&s, 0, sizeof(STATE));
+ memset(&s, 0, sizeof(struct State));
s.fpin = fpin;
s.fpout = fpout;
if (flags & MUTT_CM_PREFIX)
/* print the current time to avoid spoofing of the signature output */
-void crypt_current_time(STATE *s, char *app_name)
+void crypt_current_time(struct State *s, char *app_name)
{
time_t t;
char p[STRING], tmp[STRING];
}
-int crypt_write_signed(struct Body *a, STATE *s, const char *tempfile)
+int crypt_write_signed(struct Body *a, struct State *s, const char *tempfile)
{
FILE *fp = NULL;
int c;
/*
* This routine verifies a "multipart/signed" body.
*/
-int mutt_signed_handler(struct Body *a, STATE *s)
+int mutt_signed_handler(struct Body *a, struct State *s)
{
char tempfile[_POSIX_PATH_MAX];
int signed_type;
return *buf ? 0 : -1;
}
-static void print_time(time_t t, STATE *s)
+static void print_time(time_t t, struct State *s)
{
char p[STRING];
Return 1 if there is is a severe warning.
*/
static int show_sig_summary(unsigned long sum, gpgme_ctx_t ctx, gpgme_key_t key,
- int idx, STATE *s, gpgme_signature_t sig)
+ int idx, struct State *s, gpgme_signature_t sig)
{
if (!key)
return 1;
}
-static void show_fingerprint(gpgme_key_t key, STATE *state)
+static void show_fingerprint(gpgme_key_t key, struct State *state)
{
const char *s = NULL;
int i, is_pgp;
}
/* Show the validity of a key used for one signature. */
-static void show_one_sig_validity(gpgme_ctx_t ctx, int idx, STATE *s)
+static void show_one_sig_validity(gpgme_ctx_t ctx, int idx, struct State *s)
{
gpgme_verify_result_t result = NULL;
gpgme_signature_t sig = NULL;
}
static void print_smime_keyinfo(const char *msg, gpgme_signature_t sig,
- gpgme_key_t key, STATE *s)
+ gpgme_key_t key, struct State *s)
{
int msgwid;
gpgme_user_id_t uids = NULL;
Return values are: 0 for normal procession, 1 for a bad signature,
2 for a signature with a warning or -1 for no more signature. */
-static int show_one_sig_status(gpgme_ctx_t ctx, int idx, STATE *s)
+static int show_one_sig_status(gpgme_ctx_t ctx, int idx, struct State *s)
{
const char *fpr = NULL;
gpgme_key_t key = NULL;
/* Do the actual verification step. With IS_SMIME set to true we
assume S/MIME (surprise!) */
-static int verify_one(struct Body *sigbdy, STATE *s, const char *tempfile, int is_smime)
+static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile, int is_smime)
{
int badsig = -1;
int anywarn = 0;
return badsig ? 1 : anywarn ? 2 : 0;
}
-int pgp_gpgme_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile)
+int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
{
return verify_one(sigbdy, s, tempfile, 0);
}
-int smime_gpgme_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile)
+int smime_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
{
return verify_one(sigbdy, s, tempfile, 1);
}
a flag in R_IS_SIGNED to indicate whether this is a combined
encrypted and signed message, for S/MIME it returns true when it is
not a encrypted but a signed message. */
-static struct Body *decrypt_part(struct Body *a, STATE *s, FILE *fpout, int is_smime, int *r_is_signed)
+static struct Body *decrypt_part(struct Body *a, struct State *s, FILE *fpout, int is_smime, int *r_is_signed)
{
if (!a || !s || !fpout)
return NULL;
int pgp_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur)
{
char tempfile[_POSIX_PATH_MAX];
- STATE s;
+ struct State s;
struct Body *first_part = b;
int is_signed = 0;
int need_decode = 0;
int smime_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur)
{
char tempfile[_POSIX_PATH_MAX];
- STATE s;
+ struct State s;
FILE *tmpfp = NULL;
int is_signed;
LOFF_T saved_b_offset;
(Note that we aren't worse than Outlook & Cie in this, and also
note that we can successfully handle anything produced by any
existing versions of mutt.) */
-static void copy_clearsigned(gpgme_data_t data, STATE *s, char *charset)
+static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset)
{
char buf[HUGE_STRING];
short complete, armor_header;
}
/* Support for classic_application/pgp */
-int pgp_gpgme_application_handler(struct Body *m, STATE *s)
+int pgp_gpgme_application_handler(struct Body *m, struct State *s)
{
int needpass = -1, pgp_keyblock = 0;
int clearsign = 0;
* This handler is passed the application/octet-stream directly.
* The caller must propagate a->goodsig to its parent.
*/
-int pgp_gpgme_encrypted_handler(struct Body *a, STATE *s)
+int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s)
{
char tempfile[_POSIX_PATH_MAX];
FILE *fpout = NULL;
}
/* Support for application/smime */
-int smime_gpgme_application_handler(struct Body *a, STATE *s)
+int smime_gpgme_application_handler(struct Body *a, struct State *s)
{
char tempfile[_POSIX_PATH_MAX];
FILE *fpout = NULL;
int pgp_gpgme_check_traditional(FILE *fp, struct Body *b, int tagged_only);
void pgp_gpgme_invoke_import(const char *fname);
-int pgp_gpgme_application_handler(struct Body *m, STATE *s);
-int smime_gpgme_application_handler(struct Body *a, STATE *s);
-int pgp_gpgme_encrypted_handler(struct Body *a, STATE *s);
+int pgp_gpgme_application_handler(struct Body *m, struct State *s);
+int smime_gpgme_application_handler(struct Body *a, struct State *s);
+int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s);
struct Body *pgp_gpgme_make_key_attachment(char *tempf);
struct Body *pgp_gpgme_sign_message(struct Body *a);
struct Body *smime_gpgme_sign_message(struct Body *a);
-int pgp_gpgme_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile);
-int smime_gpgme_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile);
+int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
+int smime_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
int pgp_gpgme_send_menu(struct Header *msg);
int smime_gpgme_send_menu(struct Header *msg);
typedef int (*crypt_func_decrypt_mime_t)(FILE *a, FILE **b, struct Body *c, struct Body **d);
-typedef int (*crypt_func_application_handler_t)(struct Body *m, STATE *s);
-typedef int (*crypt_func_encrypted_handler_t)(struct Body *m, STATE *s);
+typedef int (*crypt_func_application_handler_t)(struct Body *m, struct State *s);
+typedef int (*crypt_func_encrypted_handler_t)(struct Body *m, struct State *s);
typedef void (*crypt_func_pgp_invoke_getkeys_t)(struct Address *addr);
typedef int (*crypt_func_pgp_check_traditional_t)(FILE *fp, struct Body *b, int tagged_only);
typedef struct Body *(*crypt_func_sign_message_t)(struct Body *a);
typedef struct Body *(*crypt_func_pgp_encrypt_message_t)(struct Body *a, char *keylist, int sign);
typedef void (*crypt_func_pgp_invoke_import_t)(const char *fname);
-typedef int (*crypt_func_verify_one_t)(struct Body *sigbdy, STATE *s, const char *tempf);
+typedef int (*crypt_func_verify_one_t)(struct Body *sigbdy, struct State *s, const char *tempf);
typedef void (*crypt_func_pgp_extract_keys_from_attachment_list_t)(FILE *fp, int tag,
struct Body *top);
{
return pgp_decrypt_mime(a, b, c, d);
}
-static int crypt_mod_pgp_application_handler(struct Body *m, STATE *s)
+static int crypt_mod_pgp_application_handler(struct Body *m, struct State *s)
{
return pgp_application_pgp_handler(m, s);
}
return pgp_sign_message(a);
}
-static int crypt_mod_pgp_verify_one(struct Body *sigbdy, STATE *s, const char *tempf)
+static int crypt_mod_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
{
return pgp_verify_one(sigbdy, s, tempf);
}
return pgp_traditional_encryptsign(a, flags, keylist);
}
-static int crypt_mod_pgp_encrypted_handler(struct Body *m, STATE *s)
+static int crypt_mod_pgp_encrypted_handler(struct Body *m, struct State *s)
{
return pgp_encrypted_handler(m, s);
}
return pgp_gpgme_decrypt_mime(a, b, c, d);
}
-static int crypt_mod_pgp_application_handler(struct Body *m, STATE *s)
+static int crypt_mod_pgp_application_handler(struct Body *m, struct State *s)
{
return pgp_gpgme_application_handler(m, s);
}
-static int crypt_mod_pgp_encrypted_handler(struct Body *m, STATE *s)
+static int crypt_mod_pgp_encrypted_handler(struct Body *m, struct State *s)
{
return pgp_gpgme_encrypted_handler(m, s);
}
return pgp_gpgme_sign_message(a);
}
-static int crypt_mod_pgp_verify_one(struct Body *sigbdy, STATE *s, const char *tempf)
+static int crypt_mod_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
{
return pgp_gpgme_verify_one(sigbdy, s, tempf);
}
{
return smime_decrypt_mime(a, b, c, d);
}
-static int crypt_mod_smime_application_handler(struct Body *m, STATE *s)
+static int crypt_mod_smime_application_handler(struct Body *m, struct State *s)
{
return smime_application_smime_handler(m, s);
}
return smime_sign_message(a);
}
-static int crypt_mod_smime_verify_one(struct Body *sigbdy, STATE *s, const char *tempf)
+static int crypt_mod_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
{
return smime_verify_one(sigbdy, s, tempf);
}
return smime_gpgme_decrypt_mime(a, b, c, d);
}
-static int crypt_mod_smime_application_handler(struct Body *m, STATE *s)
+static int crypt_mod_smime_application_handler(struct Body *m, struct State *s)
{
return smime_gpgme_application_handler(m, s);
}
return smime_gpgme_sign_message(a);
}
-static int crypt_mod_smime_verify_one(struct Body *sigbdy, STATE *s, const char *tempf)
+static int crypt_mod_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
{
return smime_gpgme_verify_one(sigbdy, s, tempf);
}
}
/* MIME handler for the application/pgp content-type. */
-int crypt_pgp_application_pgp_handler(struct Body *m, STATE *s)
+int crypt_pgp_application_pgp_handler(struct Body *m, struct State *s)
{
if (CRYPT_MOD_CALL_CHECK(PGP, application_handler))
return (CRYPT_MOD_CALL(PGP, application_handler))(m, s);
}
/* MIME handler for an PGP/MIME encrypted message. */
-int crypt_pgp_encrypted_handler(struct Body *a, STATE *s)
+int crypt_pgp_encrypted_handler(struct Body *a, struct State *s)
{
if (CRYPT_MOD_CALL_CHECK(PGP, encrypted_handler))
return (CRYPT_MOD_CALL(PGP, encrypted_handler))(a, s);
}
/* fixme: needs documentation */
-int crypt_pgp_verify_one(struct Body *sigbdy, STATE *s, const char *tempf)
+int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
{
if (CRYPT_MOD_CALL_CHECK(PGP, verify_one))
return (CRYPT_MOD_CALL(PGP, verify_one))(sigbdy, s, tempf);
}
/* MIME handler for the application/smime content-type. */
-int crypt_smime_application_smime_handler(struct Body *m, STATE *s)
+int crypt_smime_application_smime_handler(struct Body *m, struct State *s)
{
if (CRYPT_MOD_CALL_CHECK(SMIME, application_handler))
return (CRYPT_MOD_CALL(SMIME, application_handler))(m, s);
}
/* MIME handler for an PGP/MIME encrypted message. */
-void crypt_smime_encrypted_handler(struct Body *a, STATE *s)
+void crypt_smime_encrypted_handler(struct Body *a, struct State *s)
{
if (CRYPT_MOD_CALL_CHECK(SMIME, encrypted_handler))
(CRYPT_MOD_CALL(SMIME, encrypted_handler))(a, s);
}
/* fixme: needs documentation */
-int crypt_smime_verify_one(struct Body *sigbdy, STATE *s, const char *tempf)
+int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf)
{
if (CRYPT_MOD_CALL_CHECK(SMIME, verify_one))
return (CRYPT_MOD_CALL(SMIME, verify_one))(sigbdy, s, tempf);
#define BUFO_SIZE 2000
-typedef int (*handler_t)(struct Body *, STATE *);
+typedef int (*handler_t)(struct Body *, struct State *);
// clang-format off
const int Index_hex[128] = {
};
// clang-format on
-static void print_part_line(STATE *s, struct Body *b, int n)
+static void print_part_line(struct State *s, struct Body *b, int n)
{
char length[5];
mutt_pretty_size(length, sizeof(length), b->length);
ENCODING(b->encoding), length);
}
-static void state_prefix_put(const char *d, size_t dlen, STATE *s)
+static void state_prefix_put(const char *d, size_t dlen, struct State *s)
{
if (s->prefix)
while (dlen--)
fwrite(d, dlen, 1, s->fpout);
}
-static void convert_to_state(iconv_t cd, char *bufi, size_t *l, STATE *s)
+static void convert_to_state(iconv_t cd, char *bufi, size_t *l, struct State *s)
{
char bufo[BUFO_SIZE];
ICONV_CONST char *ib = NULL;
*l = ibl;
}
-static void decode_xbit(STATE *s, long len, int istext, iconv_t cd)
+static void decode_xbit(struct State *s, long len, int istext, iconv_t cd)
{
int c, ch;
char bufi[BUFI_SIZE];
* above, we just use STRING*2 for the target buffer's size.
*
*/
-static void decode_quoted(STATE *s, long len, int istext, iconv_t cd)
+static void decode_quoted(struct State *s, long len, int istext, iconv_t cd)
{
char line[STRING];
char decline[2 * STRING];
state_reset_prefix(s);
}
-void mutt_decode_base64(STATE *s, long len, int istext, iconv_t cd)
+void mutt_decode_base64(struct State *s, long len, int istext, iconv_t cd)
{
char buf[5];
int c1, c2, c3, c4, ch, cr = 0, i;
return ch - 32;
}
-static void decode_uuencoded(STATE *s, long len, int istext, iconv_t cd)
+static void decode_uuencoded(struct State *s, long len, int istext, iconv_t cd)
{
char tmps[SHORT_STRING];
char linelen, c, l, out;
size_t param_len;
int tag_level[RICH_LAST_TAG];
int WrapMargin;
- STATE *s;
+ struct State *s;
};
static void enriched_wrap(struct enriched_state *stte)
}
}
-static int text_enriched_handler(struct Body *a, STATE *s)
+static int text_enriched_handler(struct Body *a, struct State *s)
{
enum
{
#define TXTPLAIN 2
#define TXTENRICHED 3
-static int alternative_handler(struct Body *a, STATE *s)
+static int alternative_handler(struct Body *a, struct State *s)
{
struct Body *choice = NULL;
struct Body *b = NULL;
}
/* handles message/rfc822 body parts */
-static int message_handler(struct Body *a, STATE *s)
+static int message_handler(struct Body *a, struct State *s)
{
struct stat st;
struct Body *b = NULL;
return 0;
}
-static int multipart_handler(struct Body *a, STATE *s)
+static int multipart_handler(struct Body *a, struct State *s)
{
struct Body *b = NULL, *p = NULL;
struct stat st;
return rc;
}
-static int autoview_handler(struct Body *a, STATE *s)
+static int autoview_handler(struct Body *a, struct State *s)
{
rfc1524_entry *entry = rfc1524_new_entry();
char buffer[LONG_STRING];
return rc;
}
-static int external_body_handler(struct Body *b, STATE *s)
+static int external_body_handler(struct Body *b, struct State *s)
{
const char *access_type = NULL;
const char *expiration = NULL;
return 0;
}
-void mutt_decode_attachment(struct Body *b, STATE *s)
+void mutt_decode_attachment(struct Body *b, struct State *s)
{
int istext = mutt_is_text_part(b);
iconv_t cd = (iconv_t)(-1);
* strip all trailing spaces to improve interoperability;
* if $text_flowed is unset, simply verbatim copy input
*/
-static int text_plain_handler(struct Body *b, STATE *s)
+static int text_plain_handler(struct Body *b, struct State *s)
{
char *buf = NULL;
size_t l = 0, sz = 0;
return 0;
}
-static int run_decode_and_handler(struct Body *b, STATE *s, handler_t handler, int plaintext)
+static int run_decode_and_handler(struct Body *b, struct State *s, handler_t handler, int plaintext)
{
int origType;
char *savePrefix = NULL;
return rc;
}
-static int valid_pgp_encrypted_handler(struct Body *b, STATE *s)
+static int valid_pgp_encrypted_handler(struct Body *b, struct State *s)
{
int rc;
struct Body *octetstream = NULL;
return rc;
}
-static int malformed_pgp_encrypted_handler(struct Body *b, STATE *s)
+static int malformed_pgp_encrypted_handler(struct Body *b, struct State *s)
{
int rc;
struct Body *octetstream = NULL;
return rc;
}
-int mutt_body_handler(struct Body *b, STATE *s)
+int mutt_body_handler(struct Body *b, struct State *s)
{
if (!b || !s)
return -1;
return 0;
}
-/* Compute MD5 message digest for LEN bytes beginning at struct Buffer. The
+/* Compute MD5 message digest for LEN bytes beginning at Buffer. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
#define FH(b, c, d) (b ^ c ^ d)
#define FI(b, c, d) (c ^ (b | ~d))
-/* Process LEN bytes of struct Buffer, accumulating context into CTX.
+/* Process LEN bytes of Buffer, accumulating context into CTX.
It is assumed that LEN % 64 == 0. */
void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
{
struct mx_ops *mx_ops;
};
-typedef struct
+struct State
{
FILE *fpin;
FILE *fpout;
char *prefix;
int flags;
-} STATE;
+};
/* used by enter.c */
return safe_calloc(1, sizeof(struct EnterState));
}
-/* flags for the STATE struct */
+/* flags for the State struct */
#define MUTT_DISPLAY (1 << 0) /* output is displayed to the user */
#define MUTT_VERIFY (1 << 1) /* perform signature verification */
#define MUTT_PENDINGPREFIX (1 << 2) /* prefix to write, but character must follow */
#define state_puts(x, y) fputs(x, (y)->fpout)
#define state_putc(x, y) fputc(x, (y)->fpout)
-void state_mark_attach(STATE *s);
-void state_attach_puts(const char *t, STATE *s);
-void state_prefix_putc(char c, STATE *s);
-int state_printf(STATE *s, const char *fmt, ...);
-int state_putws(const wchar_t *ws, STATE *s);
+void state_mark_attach(struct State *s);
+void state_attach_puts(const char *t, struct State *s);
+void state_prefix_putc(char c, struct State *s);
+int state_printf(struct State *s, const char *fmt, ...);
+int state_putws(const wchar_t *ws, struct State *s);
/* for attachment counter */
typedef struct
int mutt_is_application_smime(struct Body *m);
-int mutt_signed_handler(struct Body *a, STATE *s);
+int mutt_signed_handler(struct Body *a, struct State *s);
int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app);
/* -- crypt.c -- */
/* Print the current time. */
-void crypt_current_time(STATE *s, char *app_name);
+void crypt_current_time(struct State *s, char *app_name);
/* Check out the type of encryption used and set the cached status
values if there are any. */
/* Write the message body/part A described by state S to the given
TEMPFILE. */
-int crypt_write_signed(struct Body *a, STATE *s, const char *tempfile);
+int crypt_write_signed(struct Body *a, struct State *s, const char *tempfile);
/* Obtain pointers to fingerprint or short or long key ID, if any.
int crypt_pgp_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d);
/* MIME handler for the application/pgp content-type. */
-int crypt_pgp_application_pgp_handler(struct Body *m, STATE *s);
+int crypt_pgp_application_pgp_handler(struct Body *m, struct State *s);
/* MIME handler for an PGP/MIME encrypted message. */
-int crypt_pgp_encrypted_handler(struct Body *a, STATE *s);
+int crypt_pgp_encrypted_handler(struct Body *a, struct State *s);
/* fixme: needs documentation. */
void crypt_pgp_invoke_getkeys(struct Address *addr);
int crypt_pgp_send_menu(struct Header *msg);
/* fixme: needs documentation */
-int crypt_pgp_verify_one(struct Body *sigbdy, STATE *s, const char *tempf);
+int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf);
/* fixme: needs documentation */
void crypt_pgp_extract_keys_from_attachment_list(FILE *fp, int tag, struct Body *top);
int crypt_smime_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d);
/* MIME handler for the application/smime content-type. */
-int crypt_smime_application_smime_handler(struct Body *m, STATE *s);
+int crypt_smime_application_smime_handler(struct Body *m, struct State *s);
/* fixme: Needs documentation. */
void crypt_smime_getkeys(struct Envelope *env);
void crypt_smime_set_sender(const char *sender);
/* fixme: needs documentation */
-int crypt_smime_verify_one(struct Body *sigbdy, STATE *s, const char *tempf);
+int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf);
void crypt_init(void);
return ret;
}
-void state_prefix_putc(char c, STATE *s)
+void state_prefix_putc(char c, struct State *s)
{
if (s->flags & MUTT_PENDINGPREFIX)
{
state_set_prefix(s);
}
-int state_printf(STATE *s, const char *fmt, ...)
+int state_printf(struct State *s, const char *fmt, ...)
{
int rv;
va_list ap;
return rv;
}
-void state_mark_attach(STATE *s)
+void state_mark_attach(struct State *s)
{
if (!s || !s->fpout)
return;
state_puts(AttachmentMarker, s);
}
-void state_attach_puts(const char *t, STATE *s)
+void state_attach_puts(const char *t, struct State *s)
{
if (!t || !s || !s->fpout)
return;
}
}
-static int state_putwc(wchar_t wc, STATE *s)
+static int state_putwc(wchar_t wc, struct State *s)
{
char mb[MB_LEN_MAX] = "";
int rc;
return 0;
}
-int state_putws(const wchar_t *ws, STATE *s)
+int state_putws(const wchar_t *ws, struct State *s)
{
const wchar_t *p = ws;
static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
{
struct Message *msg = NULL;
- STATE s;
+ struct State s;
FILE *fp = NULL;
long lng = 0;
int match = 0;
* note that we can successfully handle anything produced by any
* existing versions of mutt.)
*/
-static void pgp_copy_clearsigned(FILE *fpin, STATE *s, char *charset)
+static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset)
{
char buf[HUGE_STRING];
short complete, armor_header;
/* Support for the Application/PGP Content Type. */
-int pgp_application_pgp_handler(struct Body *m, STATE *s)
+int pgp_application_pgp_handler(struct Body *m, struct State *s)
{
int could_not_decrypt = 0;
int needpass = -1, pgp_keyblock = 0;
}
-int pgp_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile)
+int pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
{
char sigfile[_POSIX_PATH_MAX], pgperrfile[_POSIX_PATH_MAX];
FILE *fp = NULL, *pgpout = NULL, *pgperr = NULL;
/* Extract pgp public keys from messages or attachments */
static void pgp_extract_keys_from_attachment(FILE *fp, struct Body *top)
{
- STATE s;
+ struct State s;
FILE *tempfp = NULL;
char tempfname[_POSIX_PATH_MAX];
return;
}
- memset(&s, 0, sizeof(STATE));
+ memset(&s, 0, sizeof(struct State));
s.fpin = fp;
s.fpout = tempfp;
unset_option(OPTDONTHANDLEPGPKEYS);
}
-static struct Body *pgp_decrypt_part(struct Body *a, STATE *s, FILE *fpout, struct Body *p)
+static struct Body *pgp_decrypt_part(struct Body *a, struct State *s, FILE *fpout, struct Body *p)
{
if (!a || !s || !fpout || !p)
return NULL;
int pgp_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur)
{
char tempfile[_POSIX_PATH_MAX];
- STATE s;
+ struct State s;
struct Body *p = b;
int need_decode = 0;
int saved_type;
* This handler is passed the application/octet-stream directly.
* The caller must propagate a->goodsig to its parent.
*/
-int pgp_encrypted_handler(struct Body *a, STATE *s)
+int pgp_encrypted_handler(struct Body *a, struct State *s)
{
char tempfile[_POSIX_PATH_MAX];
FILE *fpout = NULL, *fpin = NULL;
char *pgp_find_keys(struct Address *adrlist, int oppenc_mode);
-int pgp_application_pgp_handler(struct Body *m, STATE *s);
-int pgp_encrypted_handler(struct Body *a, STATE *s);
+int pgp_application_pgp_handler(struct Body *m, struct State *s);
+int pgp_encrypted_handler(struct Body *a, struct State *s);
void pgp_extract_keys_from_attachment_list(FILE *fp, int tag, struct Body *top);
void pgp_void_passphrase(void);
int pgp_valid_passphrase(void);
/* private ? */
-int pgp_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile);
+int pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
struct Body *pgp_traditional_encryptsign(struct Body *a, int flags, char *keylist);
struct Body *pgp_encrypt_message(struct Body *a, char *keylist, int sign);
struct Body *pgp_sign_message(struct Body *a);
LOFF_T end;
char *r = NULL;
- STATE state;
+ struct State state;
- memset(&state, 0, sizeof(STATE));
+ memset(&state, 0, sizeof(struct State));
state.fpin = in;
state.fpout = out;
struct Body *b = NULL;
FILE *bfp = NULL;
int rv = -1;
- STATE s;
+ struct State s;
int sec_type;
memset(&s, 0, sizeof(s));
void mutt_attach_init(struct Body *b);
void mutt_block_signals(void);
void mutt_block_signals_system(void);
-int mutt_body_handler(struct Body *b, STATE *s);
+int mutt_body_handler(struct Body *b, struct State *s);
int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to);
void mutt_break_thread(struct Header *hdr);
void mutt_buffy(char *s, size_t slen);
void mutt_clear_error(void);
void mutt_clear_pager_position(void);
void mutt_create_alias(struct Envelope *cur, struct Address *iadr);
-void mutt_decode_attachment(struct Body *b, STATE *s);
-void mutt_decode_base64(STATE *s, long len, int istext, iconv_t cd);
+void mutt_decode_attachment(struct Body *b, struct State *s);
+void mutt_decode_base64(struct State *s, long len, int istext, iconv_t cd);
void mutt_default_save(char *path, size_t pathlen, struct Header *hdr);
void mutt_display_address(struct Envelope *env);
void mutt_draw_statusline(int cols, const char *buf, int buflen);
}
}
-static void pipe_attachment(FILE *fp, struct Body *b, STATE *state)
+static void pipe_attachment(FILE *fp, struct Body *b, struct State *state)
{
FILE *ifp = NULL;
}
static void pipe_attachment_list(char *command, FILE *fp, int tag, struct Body *top,
- int filter, STATE *state)
+ int filter, struct State *state)
{
for (; top; top = top->next)
{
void mutt_pipe_attachment_list(FILE *fp, int tag, struct Body *top, int filter)
{
- STATE state;
+ struct State state;
char buf[SHORT_STRING];
pid_t thepid;
filter = 0; /* sanity check: we can't filter in the recv case yet */
buf[0] = 0;
- memset(&state, 0, sizeof(STATE));
+ memset(&state, 0, sizeof(struct State));
/* perform charset conversion on text attachments when piping */
state.flags = MUTT_CHARCONV;
return 1;
}
-static void print_attachment_list(FILE *fp, int tag, struct Body *top, STATE *state)
+static void print_attachment_list(FILE *fp, int tag, struct Body *top, struct State *state)
{
char type[STRING];
void mutt_print_attachment_list(FILE *fp, int tag, struct Body *top)
{
- STATE state;
+ struct State state;
pid_t thepid;
if (query_quadoption(OPT_PRINT, tag ? _("Print tagged attachment(s)?") :
if (!can_print(top, tag))
return;
mutt_endwin(NULL);
- memset(&state, 0, sizeof(STATE));
+ memset(&state, 0, sizeof(struct State));
thepid = mutt_create_filter(NONULL(PrintCmd), &state.fpout, NULL, NULL);
print_attachment_list(fp, tag, top, &state);
safe_fclose(&state.fpout);
int rc = 0;
- STATE st;
+ struct State st;
/*
* First, find the parent message.
struct Header *tmphdr = NULL;
short i;
- STATE st;
+ struct State st;
char tmpbody[_POSIX_PATH_MAX];
FILE *tmpfp = NULL;
{
mutt_make_attribution(Context, parent, tmpfp);
- memset(&st, 0, sizeof(STATE));
+ memset(&st, 0, sizeof(struct State));
st.fpin = fp;
st.fpout = tmpfp;
* becomes
* > > > foo
*/
-static int space_quotes(STATE *s)
+static int space_quotes(struct State *s)
{
/* Allow quote spacing in the pager even for OPTTEXTFLOWED,
* but obviously not when replying.
* as opposed to
* >>>foo
*/
-static bool add_quote_suffix(STATE *s, int ql)
+static bool add_quote_suffix(struct State *s, int ql)
{
if (s->flags & MUTT_REPLYING)
return false;
return true;
}
-static size_t print_indent(int ql, STATE *s, int add_suffix)
+static size_t print_indent(int ql, struct State *s, int add_suffix)
{
int i;
size_t wid = 0;
return ql + add_suffix + wid;
}
-static void flush_par(STATE *s, flowed_state_t *fst)
+static void flush_par(struct State *s, flowed_state_t *fst)
{
if (fst->width > 0)
{
/* Calculate the paragraph width based upon the current quote level. The start
* of a quoted line will be ">>> ", so we need to subtract the space required
* for the prefix from the terminal width. */
-static int quote_width(STATE *s, int ql)
+static int quote_width(struct State *s, int ql)
{
int width = mutt_window_wrap_cols(MuttIndexWindow, ReflowWrap);
if (option(OPTTEXTFLOWED) && (s->flags & MUTT_REPLYING))
return width;
}
-static void print_flowed_line(char *line, STATE *s, int ql, flowed_state_t *fst, int term)
+static void print_flowed_line(char *line, struct State *s, int ql, flowed_state_t *fst, int term)
{
size_t width, w, words = 0;
char *p = NULL;
flush_par(s, fst);
}
-static void print_fixed_line(const char *line, STATE *s, int ql, flowed_state_t *fst)
+static void print_fixed_line(const char *line, struct State *s, int ql, flowed_state_t *fst)
{
print_indent(ql, s, add_quote_suffix(s, ql));
if (line && *line)
fst->spaces = 0;
}
-int rfc3676_handler(struct Body *a, STATE *s)
+int rfc3676_handler(struct Body *a, struct State *s)
{
char *buf = NULL, *t = NULL;
unsigned int quotelevel = 0, newql = 0, sigsep = 0;
#include "mutt.h"
/* body handler implementing RfC 3676 for format=flowed */
-int rfc3676_handler(struct Body *a, STATE *s);
+int rfc3676_handler(struct Body *a, struct State *s);
/* this does the space-stuffing for RfC3676 style messages */
void rfc3676_space_stuff(struct Header *hdr);
static void transform_to_7bit(struct Body *a, FILE *fpin)
{
char buff[_POSIX_PATH_MAX];
- STATE s;
+ struct State s;
struct stat sb;
memset(&s, 0, sizeof(s));
}
-int smime_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile)
+int smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
{
char signedfile[_POSIX_PATH_MAX], smimeerrfile[_POSIX_PATH_MAX];
FILE *fp = NULL, *smimeout = NULL, *smimeerr = NULL;
This handles application/pkcs7-mime which can either be a signed
or an encrypted message.
*/
-static struct Body *smime_handle_entity(struct Body *m, STATE *s, FILE *outFile)
+static struct Body *smime_handle_entity(struct Body *m, struct State *s, FILE *outFile)
{
int len = 0;
int c;
int smime_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur)
{
char tempfile[_POSIX_PATH_MAX];
- STATE s;
+ struct State s;
LOFF_T tmpoffset = b->offset;
size_t tmplength = b->length;
int origType = b->type;
}
-int smime_application_smime_handler(struct Body *m, STATE *s)
+int smime_application_smime_handler(struct Body *m, struct State *s)
{
return smime_handle_entity(m, s, NULL) ? 0 : -1;
}
int smime_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur);
-int smime_application_smime_handler(struct Body *m, STATE *s);
+int smime_application_smime_handler(struct Body *m, struct State *s);
struct Body *smime_sign_message(struct Body *a);
struct Body *smime_build_smime_entity(struct Body *a, char *certlist);
-int smime_verify_one(struct Body *sigbdy, STATE *s, const char *tempfile);
+int smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
int smime_verify_sender(struct Header *h);