x = extra / 2;
while (x)
{
- state_putc(' ', stte->s);
+ state_putc(stte->s, ' ');
x--;
}
}
x = extra - 1;
while (x)
{
- state_putc(' ', stte->s);
+ state_putc(stte->s, ' ');
x--;
}
}
}
- state_putws((const wchar_t *) stte->line, stte->s);
+ state_putws(stte->s, (const wchar_t *) stte->line);
}
- state_putc('\n', stte->s);
+ state_putc(stte->s, '\n');
stte->line[0] = (wchar_t) '\0';
stte->line_len = 0;
stte->line_used = 0;
stte->indent_len = 0;
if (stte->s->prefix)
{
- state_puts(stte->s->prefix, stte->s);
+ state_puts(stte->s, stte->s->prefix);
stte->indent_len += mutt_str_strlen(stte->s->prefix);
}
{
if (stte->s->prefix)
{
- state_puts(stte->s->prefix, stte->s);
+ state_puts(stte->s, stte->s->prefix);
stte->indent_len += mutt_str_strlen(stte->s->prefix);
}
else
{
- state_puts("> ", stte->s);
+ state_puts(stte->s, "> ");
stte->indent_len += mutt_str_strlen("> ");
}
x--;
stte->indent_len += x;
while (x)
{
- state_putc(' ', stte->s);
+ state_putc(stte->s, ' ');
x--;
}
}
if (s->prefix)
{
- state_puts(s->prefix, s);
+ state_puts(s, s->prefix);
stte.indent_len += mutt_str_strlen(s->prefix);
}
}
}
- state_putc('\n', s); /* add a final newline */
+ state_putc(s, '\n'); /* add a final newline */
FREE(&(stte.buffer));
FREE(&(stte.line));
obl = sizeof(bufo);
iconv(cd, NULL, NULL, &ob, &obl);
if (ob != bufo)
- state_prefix_put(bufo, ob - bufo, s);
+ state_prefix_put(s, bufo, ob - bufo);
}
return;
}
if (cd == (iconv_t)(-1))
{
- state_prefix_put(bufi, *l, s);
+ state_prefix_put(s, bufi, *l);
*l = 0;
return;
}
mutt_ch_iconv(cd, &ib, &ibl, &ob, &obl, 0, "?", NULL);
if (ob == bufo)
break;
- state_prefix_put(bufo, ob - bufo, s);
+ state_prefix_put(s, bufo, ob - bufo);
}
memmove(bufi, ib, ibl);
*l = ibl;
{
while (fgets(buf, sizeof(buf), fp_out))
{
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
}
/* check for data on stderr */
if (fgets(buf, sizeof(buf), fp_err))
state_printf(s, _("[-- Autoview stderr of %s --]\n"), mutt_b2s(cmd));
}
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
while (fgets(buf, sizeof(buf), fp_err))
{
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
}
}
}
state_printf(s, _("[-- Autoview stderr of %s --]\n"), mutt_b2s(cmd));
}
- state_puts(buf, s);
+ state_puts(s, buf);
mutt_file_copy_stream(fp_err, s->fp_out);
}
}
buf[--len] = '\0';
}
if (s->prefix)
- state_puts(s->prefix, s);
- state_puts(buf, s);
- state_putc('\n', s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
+ state_putc(s, '\n');
}
FREE(&buf);
mutt_copy_hdr(s->fp_in, s->fp_out, off_start, b->parts->offset, chflags, s->prefix, 0);
if (s->prefix)
- state_puts(s->prefix, s);
- state_putc('\n', s);
+ state_puts(s, s->prefix);
+ state_putc(s, '\n');
rc = mutt_body_handler(b->parts, s);
}
if (s->flags & MUTT_DISPLAY)
{
state_mark_attach(s);
- state_puts(_("[-- Error: message/external-body has no access-type "
- "parameter --]\n"),
- s);
+ state_puts(s, _("[-- Error: message/external-body has no access-type "
+ "parameter --]\n"));
return 0;
}
else
snprintf(strbuf, sizeof(strbuf), str, TYPE(b->parts), b->parts->subtype,
pretty_size, expiration);
- state_attach_puts(strbuf, s);
+ state_attach_puts(s, strbuf);
if (b->parts->filename)
{
state_mark_attach(s);
The "%s/%s" is a MIME type, e.g. "text/plain". */
snprintf(strbuf, sizeof(strbuf), _("[-- This %s/%s attachment is not included, --]\n[-- and the indicated external source has --]\n[-- expired. --]\n"),
TYPE(b->parts), b->parts->subtype);
- state_attach_puts(strbuf, s);
+ state_attach_puts(s, strbuf);
CopyHeaderFlags chflags = CH_DECODE | CH_DISPLAY;
if (C_Weed)
"LOCAL-FILE", "MAIL-SERVER". */
snprintf(strbuf, sizeof(strbuf), _("[-- This %s/%s attachment is not included, --]\n[-- and the indicated access-type %s is unsupported --]\n"),
TYPE(b->parts), b->parts->subtype, access_type);
- state_attach_puts(strbuf, s);
+ state_attach_puts(s, strbuf);
CopyHeaderFlags chflags = CH_DECODE | CH_DISPLAY;
if (C_Weed)
{
count += 1;
if (count == 1)
- state_putc('\n', s);
+ state_putc(s, '\n');
print_part_line(s, b, count);
}
{
/* didn't find anything that we could display! */
state_mark_attach(s);
- state_puts(_("[-- Error: Could not display any parts of "
- "Multipart/Alternative --]\n"),
- s);
+ state_puts(s, _("[-- Error: Could not display any parts of "
+ "Multipart/Alternative --]\n"));
rc = -1;
}
mutt_file_copy_bytes(s->fp_in, s->fp_out, p->offset - p->hdr_offset);
}
else
- state_putc('\n', s);
+ state_putc(s, '\n');
}
rc = mutt_body_handler(p, s);
- state_putc('\n', s);
+ state_putc(s, '\n');
if (rc != 0)
{
*p = '\0';
snprintf(tmp, sizeof(tmp), _("[-- %s output follows%s --]\n"), NONULL(app_name), p);
- state_attach_puts(tmp, s);
+ state_attach_puts(s, tmp);
}
/**
mutt_write_one_header(s->fp_out, "Subject", a->mime_headers->subject,
s->prefix, wraplen, display ? CH_DISPLAY : CH_NO_FLAGS);
- state_puts("\n", s);
+ state_puts(s, "\n");
}
}
}
if (inconsistent)
{
- state_attach_puts(_("[-- Error: "
- "Missing or bad-format multipart/signed signature"
- " --]\n\n"),
- s);
+ state_attach_puts(s, _("[-- Error: Missing or bad-format multipart/signed "
+ "signature --]\n\n"));
return mutt_body_handler(a, s);
}
b->badsig = !goodsig;
/* Now display the signed body */
- state_attach_puts(_("[-- The following data is signed --]\n\n"), s);
+ state_attach_puts(s, _("[-- The following data is signed --]\n\n"));
mutt_protected_headers_handler(a, s);
FREE(&signatures);
}
else
- state_attach_puts(_("[-- Warning: Can't find any signatures. --]\n\n"), s);
+ state_attach_puts(s,
+ _("[-- Warning: Can't find any signatures. --]\n\n"));
}
rc = mutt_body_handler(a, s);
if ((s->flags & MUTT_DISPLAY) && (sigcnt != 0))
- state_attach_puts(_("\n[-- End of signed data --]\n"), s);
+ state_attach_puts(s, _("\n[-- End of signed data --]\n"));
return rc;
}
{
char p[256];
mutt_date_localtime_format(p, sizeof(p), nl_langinfo(D_T_FMT), t);
- state_puts(p, s);
+ state_puts(s, p);
}
/**
if ((sum & GPGME_SIGSUM_KEY_REVOKED))
{
- state_puts(_("Warning: One of the keys has been revoked\n"), s);
+ state_puts(s, _("Warning: One of the keys has been revoked\n"));
severe = true;
}
time_t at = key->subkeys->expires ? key->subkeys->expires : 0;
if (at)
{
- state_puts(_("Warning: The key used to create the "
- "signature expired at: "),
- s);
+ state_puts(
+ s, _("Warning: The key used to create the signature expired at: "));
print_time(at, s);
- state_puts("\n", s);
+ state_puts(s, "\n");
}
else
{
- state_puts(_("Warning: At least one certification key "
- "has expired\n"),
- s);
+ state_puts(s, _("Warning: At least one certification key has expired\n"));
}
}
for (sig2 = result->signatures, i = 0; sig2 && (i < idx); sig2 = sig2->next, i++)
;
- state_puts(_("Warning: The signature expired at: "), s);
+ state_puts(s, _("Warning: The signature expired at: "));
print_time(sig2 ? sig2->exp_timestamp : 0, s);
- state_puts("\n", s);
+ state_puts(s, "\n");
}
if ((sum & GPGME_SIGSUM_KEY_MISSING))
{
- state_puts(_("Can't verify due to a missing "
- "key or certificate\n"),
- s);
+ state_puts(s, _("Can't verify due to a missing key or certificate\n"));
}
if ((sum & GPGME_SIGSUM_CRL_MISSING))
{
- state_puts(_("The CRL is not available\n"), s);
+ state_puts(s, _("The CRL is not available\n"));
severe = true;
}
if ((sum & GPGME_SIGSUM_CRL_TOO_OLD))
{
- state_puts(_("Available CRL is too old\n"), s);
+ state_puts(s, _("Available CRL is too old\n"));
severe = true;
}
if ((sum & GPGME_SIGSUM_BAD_POLICY))
- state_puts(_("A policy requirement was not met\n"), s);
+ state_puts(s, _("A policy requirement was not met\n"));
if ((sum & GPGME_SIGSUM_SYS_ERROR))
{
gpgme_signature_t sig2 = NULL;
unsigned int i;
- state_puts(_("A system error occurred"), s);
+ state_puts(s, _("A system error occurred"));
/* Try to figure out some more detailed system error information. */
result = gpgme_op_verify_result(ctx);
if (t0 || t1)
{
- state_puts(": ", s);
+ state_puts(s, ": ");
if (t0)
- state_puts(t0, s);
+ state_puts(s, t0);
if (t1 && !(t0 && (strcmp(t0, t1) == 0)))
{
if (t0)
- state_puts(",", s);
- state_puts(t1, s);
+ state_puts(s, ",");
+ state_puts(s, t1);
}
}
- state_puts("\n", s);
+ state_puts(s, "\n");
}
if (C_CryptUsePka)
{
if ((sig->pka_trust == 1) && sig->pka_address)
{
- state_puts(_("WARNING: PKA entry does not match "
- "signer's address: "),
- s);
- state_puts(sig->pka_address, s);
- state_puts("\n", s);
+ state_puts(s, _("WARNING: PKA entry does not match signer's address: "));
+ state_puts(s, sig->pka_address);
+ state_puts(s, "\n");
}
else if ((sig->pka_trust == 2) && sig->pka_address)
{
- state_puts(_("PKA verified signer's address is: "), s);
- state_puts(sig->pka_address, s);
- state_puts("\n", s);
+ state_puts(s, _("PKA verified signer's address is: "));
+ state_puts(s, sig->pka_address);
+ state_puts(s, "\n");
}
}
*p++ = *s;
*p++ = '\n';
*p = '\0';
- state_puts(buf, state);
+ state_puts(state, buf);
FREE(&buf);
}
break;
}
if (txt)
- state_puts(txt, s);
+ state_puts(s, txt);
}
/**
{
int msgwid;
- state_puts(msg, s);
- state_puts(" ", s);
+ state_puts(s, msg);
+ state_puts(s, " ");
/* key is NULL when not present in the user's keyring */
if (key)
{
if (msgwid < 0)
msgwid = 0;
for (int i = 0; i < msgwid; i++)
- state_puts(" ", s);
- state_puts(_("aka: "), s);
+ state_puts(s, " ");
+ state_puts(s, _("aka: "));
}
- state_puts(uids->uid, s);
- state_puts("\n", s);
+ state_puts(s, uids->uid);
+ state_puts(s, "\n");
aka = true;
}
{
if (sig->fpr)
{
- state_puts(_("KeyID "), s);
- state_puts(sig->fpr, s);
+ state_puts(s, _("KeyID "));
+ state_puts(s, sig->fpr);
}
else
{
/* L10N: You will see this message in place of "KeyID "
if the S/MIME key has no ID. This is quite an error. */
- state_puts(_("no signature fingerprint available"), s);
+ state_puts(s, _("no signature fingerprint available"));
}
- state_puts("\n", s);
+ state_puts(s, "\n");
}
/* timestamp is 0 when verification failed.
if (msgwid < 0)
msgwid = 0;
for (int i = 0; i < msgwid; i++)
- state_puts(" ", s);
- state_puts(_("created: "), s);
+ state_puts(s, " ");
+ state_puts(s, _("created: "));
print_time(sig->timestamp, s);
- state_puts("\n", s);
+ state_puts(s, "\n");
}
}
char buf[1024];
snprintf(buf, sizeof(buf), _("Error getting key information for KeyID %s: %s\n"),
fpr, gpgme_strerror(err));
- state_puts(buf, s);
+ state_puts(s, buf);
anybad = true;
}
else if ((sum & GPGME_SIGSUM_GREEN))
{
/* L10N: This is trying to match the width of the
"Problem signature from:" translation just above. */
- state_puts(_(" expires: "), s);
+ state_puts(s, _(" expires: "));
print_time(sig->exp_timestamp, s);
- state_puts("\n", s);
+ state_puts(s, "\n");
}
show_sig_summary(sum, ctx, key, idx, s, sig);
anywarn = true;
/* Note: We don't need a current time output because GPGME avoids
* such an attack by separating the meta information from the data. */
- state_attach_puts(_("[-- Begin signature information --]\n"), s);
+ state_attach_puts(s, _("[-- Begin signature information --]\n"));
err = gpgme_op_verify(ctx, signature, message, NULL);
gpgme_data_release(message);
snprintf(buf, sizeof(buf) - 1, _("Error: verification failed: %s\n"),
gpgme_strerror(err));
- state_puts(buf, s);
+ state_puts(s, buf);
}
else
{ /* Verification succeeded, see what the result is. */
char buf[128];
snprintf(buf, sizeof(buf),
_("*** Begin Notation (signature by: %s) ***\n"), sig->fpr);
- state_puts(buf, s);
+ state_puts(s, buf);
for (notation = sig->notations; notation; notation = notation->next)
{
if (is_pka_notation(notation))
if (notation->name)
{
- state_puts(notation->name, s);
- state_puts("=", s);
+ state_puts(s, notation->name);
+ state_puts(s, "=");
}
if (notation->value)
{
- state_puts(notation->value, s);
+ state_puts(s, notation->value);
if (!(*notation->value && (notation->value[strlen(notation->value) - 1] == '\n')))
- state_puts("\n", s);
+ state_puts(s, "\n");
}
}
- state_puts(_("*** End Notation ***\n"), s);
+ state_puts(s, _("*** End Notation ***\n"));
}
}
}
gpgme_release(ctx);
- state_attach_puts(_("[-- End signature information --]\n\n"), s);
+ state_attach_puts(s, _("[-- End signature information --]\n\n"));
mutt_debug(LL_DEBUG1, "returning %d\n", badsig);
return badsig ? 1 : anywarn ? 2 : 0;
snprintf(buf, sizeof(buf) - 1,
_("[-- Error: decryption failed: %s --]\n\n"), gpgme_strerror(err));
- state_attach_puts(buf, s);
+ state_attach_puts(s, buf);
}
goto cleanup;
}
if ((s->flags & MUTT_DISPLAY))
{
- state_attach_puts(_("[-- Begin signature "
- "information --]\n"),
- s);
+ state_attach_puts(s, _("[-- Begin signature information --]\n"));
}
for (idx = 0; (res = show_one_sig_status(ctx, idx, s)) != -1; idx++)
{
if ((s->flags & MUTT_DISPLAY))
{
- state_attach_puts(_("[-- End signature "
- "information --]\n\n"),
- s);
+ state_attach_puts(s, _("[-- End signature information --]\n\n"));
}
}
gpgme_release(ctx);
if (!complete)
{
if (!armor_header)
- state_puts(buf, s);
+ state_puts(s, buf);
continue;
}
}
if (s->prefix)
- state_puts(s->prefix, s);
+ state_puts(s, s->prefix);
if ((buf[0] == '-') && (buf[1] == ' '))
- state_puts(buf + 2, s);
+ state_puts(s, buf + 2);
else
- state_puts(buf, s);
+ state_puts(s, buf);
}
mutt_ch_fgetconv_close(&fc);
{
/* XXX we may wish to recode here */
if (s->prefix)
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
continue;
}
snprintf(errbuf, sizeof(errbuf) - 1,
_("Error: decryption/verification failed: %s\n"), gpgme_strerror(err));
- state_puts(errbuf, s);
+ state_puts(s, errbuf);
}
else
{ /* Decryption/Verification succeeded */
int res, idx;
bool anybad = false;
- state_attach_puts(_("[-- Begin signature "
- "information --]\n"),
- s);
+ state_attach_puts(s, _("[-- Begin signature information --]\n"));
have_any_sigs = true;
for (idx = 0; (res = show_one_sig_status(ctx, idx, s)) != -1; idx++)
{
if (!anybad && idx)
maybe_goodsig = true;
- state_attach_puts(_("[-- End signature "
- "information --]\n\n"),
- s);
+ state_attach_puts(s, _("[-- End signature information --]\n\n"));
}
tmpfname = data_object_to_tempfile(plaintext, &fp_out);
if (!tmpfname)
{
mutt_file_fclose(&fp_out);
- state_puts(_("Error: copy data failed\n"), s);
+ state_puts(s, _("Error: copy data failed\n"));
}
else
{
if (s->flags & MUTT_DISPLAY)
{
if (needpass)
- state_attach_puts(_("[-- BEGIN PGP MESSAGE --]\n\n"), s);
+ state_attach_puts(s, _("[-- BEGIN PGP MESSAGE --]\n\n"));
else if (pgp_keyblock)
- state_attach_puts(_("[-- BEGIN PGP PUBLIC KEY BLOCK --]\n"), s);
+ state_attach_puts(s, _("[-- BEGIN PGP PUBLIC KEY BLOCK --]\n"));
else
- state_attach_puts(_("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"), s);
+ state_attach_puts(s, _("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"));
}
if (clearsign)
struct FgetConv *fc = mutt_ch_fgetconv_open(fp_out, "utf-8", C_Charset, 0);
while ((c = mutt_ch_fgetconv(fc)) != EOF)
{
- state_putc(c, s);
+ state_putc(s, c);
if ((c == '\n') && s->prefix)
- state_puts(s->prefix, s);
+ state_puts(s, s->prefix);
}
mutt_ch_fgetconv_close(&fc);
}
if (s->flags & MUTT_DISPLAY)
{
- state_putc('\n', s);
+ state_putc(s, '\n');
if (needpass)
- state_attach_puts(_("[-- END PGP MESSAGE --]\n"), s);
+ state_attach_puts(s, _("[-- END PGP MESSAGE --]\n"));
else if (pgp_keyblock)
- state_attach_puts(_("[-- END PGP PUBLIC KEY BLOCK --]\n"), s);
+ state_attach_puts(s, _("[-- END PGP PUBLIC KEY BLOCK --]\n"));
else
- state_attach_puts(_("[-- END PGP SIGNED MESSAGE --]\n"), s);
+ state_attach_puts(s, _("[-- END PGP SIGNED MESSAGE --]\n"));
}
gpgme_data_release(armored_data);
/* A traditional PGP part may mix signed and unsigned content */
/* XXX we may wish to recode here */
if (s->prefix)
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
}
}
if (needpass == -1)
{
- state_attach_puts(_("[-- Error: could not find beginning"
- " of PGP message --]\n\n"),
- s);
+ state_attach_puts(
+ s, _("[-- Error: could not find beginning of PGP message --]\n\n"));
return 1;
}
mutt_debug(LL_DEBUG2, "Leaving handler\n");
mutt_perror(_("Can't create temporary file"));
if (s->flags & MUTT_DISPLAY)
{
- state_attach_puts(_("[-- Error: could not create temporary file "
- "--]\n"),
- s);
+ state_attach_puts(s,
+ _("[-- Error: could not create temporary file --]\n"));
}
return -1;
}
if (s->flags & MUTT_DISPLAY)
{
state_attach_puts(
- is_signed ? _("[-- The following data is PGP/MIME signed and "
- "encrypted --]\n\n") :
- _("[-- The following data is PGP/MIME encrypted --]\n\n"),
- s);
+ s, is_signed ?
+ _("[-- The following data is PGP/MIME signed and encrypted "
+ "--]\n\n") :
+ _("[-- The following data is PGP/MIME encrypted --]\n\n"));
mutt_protected_headers_handler(tattach, s);
}
if (s->flags & MUTT_DISPLAY)
{
- state_puts("\n", s);
+ state_puts(s, "\n");
state_attach_puts(
- is_signed ? _("[-- End of PGP/MIME signed and encrypted data --]\n") :
- _("[-- End of PGP/MIME encrypted data --]\n"),
- s);
+ s, is_signed ?
+ _("[-- End of PGP/MIME signed and encrypted data --]\n") :
+ _("[-- End of PGP/MIME encrypted data --]\n"));
}
mutt_body_free(&tattach);
mutt_perror(_("Can't create temporary file"));
if (s->flags & MUTT_DISPLAY)
{
- state_attach_puts(_("[-- Error: could not create temporary file "
- "--]\n"),
- s);
+ state_attach_puts(s,
+ _("[-- Error: could not create temporary file --]\n"));
}
return -1;
}
if (s->flags & MUTT_DISPLAY)
{
state_attach_puts(
- is_signed ? _("[-- The following data is S/MIME signed --]\n\n") :
- _("[-- The following data is S/MIME encrypted --]\n\n"),
- s);
+ s, is_signed ?
+ _("[-- The following data is S/MIME signed --]\n\n") :
+ _("[-- The following data is S/MIME encrypted --]\n\n"));
mutt_protected_headers_handler(tattach, s);
}
if (s->flags & MUTT_DISPLAY)
{
- state_puts("\n", s);
- state_attach_puts(is_signed ? _("[-- End of S/MIME signed data --]\n") :
- _("[-- End of S/MIME encrypted data --]\n"),
- s);
+ state_puts(s, "\n");
+ state_attach_puts(s, is_signed ?
+ _("[-- End of S/MIME signed data --]\n") :
+ _("[-- End of S/MIME encrypted data --]\n"));
}
mutt_body_free(&tattach);
if (!complete)
{
if (!armor_header)
- state_puts(buf, s);
+ state_puts(s, buf);
continue;
}
}
if (s->prefix)
- state_puts(s->prefix, s);
+ state_puts(s, s->prefix);
if ((buf[0] == '-') && (buf[1] == ' '))
- state_puts(buf + 2, s);
+ state_puts(s, buf + 2);
else
- state_puts(buf, s);
+ state_puts(s, buf);
}
mutt_ch_fgetconv_close(&fc);
{
/* XXX we may wish to recode here */
if (s->prefix)
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
continue;
}
maybe_goodsig = false;
fp_pgp_in = NULL;
state_attach_puts(
- _("[-- Error: unable to create PGP subprocess --]\n"), s);
+ s, _("[-- Error: unable to create PGP subprocess --]\n"));
}
else /* PGP started successfully */
{
if (checksig_rc == -1 || (wait_filter_rc != 0))
maybe_goodsig = false;
- state_attach_puts(_("[-- End of PGP output --]\n\n"), s);
+ state_attach_puts(s, _("[-- End of PGP output --]\n\n"));
}
if (pgp_use_gpg_agent())
mutt_need_hard_redraw();
if (s->flags & MUTT_DISPLAY)
{
if (needpass)
- state_attach_puts(_("[-- BEGIN PGP MESSAGE --]\n\n"), s);
+ state_attach_puts(s, _("[-- BEGIN PGP MESSAGE --]\n\n"));
else if (pgp_keyblock)
- state_attach_puts(_("[-- BEGIN PGP PUBLIC KEY BLOCK --]\n"), s);
+ state_attach_puts(s, _("[-- BEGIN PGP PUBLIC KEY BLOCK --]\n"));
else
- state_attach_puts(_("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"), s);
+ state_attach_puts(s, _("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"));
}
if (clearsign)
state_set_prefix(s);
fc = mutt_ch_fgetconv_open(fp_pgp_out, expected_charset, C_Charset, MUTT_ICONV_HOOK_FROM);
while ((ch = mutt_ch_fgetconv(fc)) != EOF)
- state_prefix_putc(ch, s);
+ state_prefix_putc(s, ch);
mutt_ch_fgetconv_close(&fc);
}
if (s->flags & MUTT_DISPLAY)
{
- state_putc('\n', s);
+ state_putc(s, '\n');
if (needpass)
{
- state_attach_puts(_("[-- END PGP MESSAGE --]\n"), s);
+ state_attach_puts(s, _("[-- END PGP MESSAGE --]\n"));
if (could_not_decrypt || (decrypt_okay_rc <= -3))
mutt_error(_("Could not decrypt PGP message"));
else if (decrypt_okay_rc < 0)
mutt_message(_("PGP message successfully decrypted"));
}
else if (pgp_keyblock)
- state_attach_puts(_("[-- END PGP PUBLIC KEY BLOCK --]\n"), s);
+ state_attach_puts(s, _("[-- END PGP PUBLIC KEY BLOCK --]\n"));
else
- state_attach_puts(_("[-- END PGP SIGNED MESSAGE --]\n"), s);
+ state_attach_puts(s, _("[-- END PGP SIGNED MESSAGE --]\n"));
}
}
else
/* A traditional PGP part may mix signed and unsigned content */
/* XXX we may wish to recode here */
if (s->prefix)
- state_puts(s->prefix, s);
- state_puts(buf, s);
+ state_puts(s, s->prefix);
+ state_puts(s, buf);
}
}
if (needpass == -1)
{
state_attach_puts(
- _("[-- Error: could not find beginning of PGP message --]\n\n"), s);
+ s, _("[-- Error: could not find beginning of PGP message --]\n\n"));
return -1;
}
mutt_file_fclose(&fp_pgp_err);
- state_attach_puts(_("[-- End of PGP output --]\n\n"), s);
+ state_attach_puts(s, _("[-- End of PGP output --]\n\n"));
mutt_file_unlink(mutt_b2s(sigfile));
if (s->flags & MUTT_DISPLAY)
{
state_attach_puts(
- _("[-- Error: could not create a PGP subprocess --]\n\n"), s);
+ s, _("[-- Error: could not create a PGP subprocess --]\n\n"));
}
goto cleanup;
}
p->goodsig = true;
else
p->goodsig = false;
- state_attach_puts(_("[-- End of PGP output --]\n\n"), s);
+ state_attach_puts(s, _("[-- End of PGP output --]\n\n"));
}
mutt_file_fclose(&fp_pgp_err);
{
mutt_perror(_("Can't create temporary file"));
if (s->flags & MUTT_DISPLAY)
- state_attach_puts(_("[-- Error: could not create temporary file --]\n"), s);
+ state_attach_puts(s,
+ _("[-- Error: could not create temporary file --]\n"));
return -1;
}
if (s->flags & MUTT_DISPLAY)
{
state_attach_puts(
- _("[-- The following data is PGP/MIME encrypted --]\n\n"), s);
+ s, _("[-- The following data is PGP/MIME encrypted --]\n\n"));
mutt_protected_headers_handler(tattach, s);
}
if (s->flags & MUTT_DISPLAY)
{
- state_puts("\n", s);
- state_attach_puts(_("[-- End of PGP/MIME encrypted data --]\n"), s);
+ state_puts(s, "\n");
+ state_attach_puts(s, _("[-- End of PGP/MIME encrypted data --]\n"));
}
mutt_body_free(&tattach);
mutt_file_copy_stream(fp_smime_err, s->fp_out);
mutt_file_fclose(&fp_smime_err);
- state_attach_puts(_("[-- End of OpenSSL output --]\n\n"), s);
+ state_attach_puts(s, _("[-- End of OpenSSL output --]\n\n"));
mutt_file_unlink(signedfile);
if (s->flags & MUTT_DISPLAY)
{
state_attach_puts(
- _("[-- Error: unable to create OpenSSL subprocess --]\n"), s);
+ s, _("[-- Error: unable to create OpenSSL subprocess --]\n"));
}
mutt_file_fclose(&fp_smime_err);
return NULL;
if (s->flags & MUTT_DISPLAY)
{
state_attach_puts(
- _("[-- Error: unable to create OpenSSL subprocess --]\n"), s);
+ s, _("[-- Error: unable to create OpenSSL subprocess --]\n"));
}
mutt_file_fclose(&fp_smime_err);
return NULL;
crypt_current_time(s, "OpenSSL");
mutt_file_copy_stream(fp_smime_err, s->fp_out);
- state_attach_puts(_("[-- End of OpenSSL output --]\n\n"), s);
+ state_attach_puts(s, _("[-- End of OpenSSL output --]\n\n"));
}
if (type & SEC_ENCRYPT)
{
- state_attach_puts(_("[-- The following data is S/MIME"
- " encrypted --]\n"),
- s);
+ state_attach_puts(s,
+ _("[-- The following data is S/MIME encrypted --]\n"));
}
else
- state_attach_puts(_("[-- The following data is S/MIME signed --]\n"), s);
+ state_attach_puts(s, _("[-- The following data is S/MIME signed --]\n"));
}
fflush(fp_smime_out);
if (s->flags & MUTT_DISPLAY)
{
if (type & SEC_ENCRYPT)
- state_attach_puts(_("\n[-- End of S/MIME encrypted data. --]\n"), s);
+ state_attach_puts(s, _("\n[-- End of S/MIME encrypted data. --]\n"));
else
- state_attach_puts(_("\n[-- End of S/MIME signed data. --]\n"), s);
+ state_attach_puts(s, _("\n[-- End of S/MIME signed data. --]\n"));
}
if (type & SEC_SIGNOPAQUE)
state->fp_in = fp;
mutt_decode_attachment(b, state);
if (C_AttachSep)
- state_puts(C_AttachSep, state);
+ state_puts(state, C_AttachSep);
}
else
{
mutt_file_copy_stream(fp_in, state->fp_out);
mutt_file_fclose(&fp_in);
if (C_AttachSep)
- state_puts(C_AttachSep, state);
+ state_puts(state, C_AttachSep);
}
}
mutt_file_copy_stream(fp_in, state->fp_out);
mutt_file_fclose(&fp_in);
if (C_AttachSep)
- state_puts(C_AttachSep, state);
+ state_puts(state, C_AttachSep);
}
}
mutt_file_unlink(mutt_b2s(newfile));
{
st.fp_in = fp;
mutt_body_handler(cur, &st);
- state_putc('\n', &st);
+ state_putc(&st, '\n');
}
else
{
{
st.fp_in = actx->idx[i]->fp;
mutt_body_handler(actx->idx[i]->content, &st);
- state_putc('\n', &st);
+ state_putc(&st, '\n');
}
}
}
{
st.fp_in = fp;
mutt_body_handler(e_cur, &st);
- state_putc('\n', &st);
+ state_putc(&st, '\n');
}
else
mutt_body_copy(fp, &e_tmp->content, e_cur);
{
st.fp_in = actx->idx[i]->fp;
mutt_body_handler(actx->idx[i]->content, &st);
- state_putc('\n', &st);
+ state_putc(&st, '\n');
}
}
}
ql++;
else
{
- state_puts(s->prefix, s);
+ state_puts(s, s->prefix);
wid = mutt_strwidth(s->prefix);
}
}
for (int i = 0; i < ql; i++)
{
- state_putc('>', s);
+ state_putc(s, '>');
if (space_quotes(s))
- state_putc(' ', s);
+ state_putc(s, ' ');
}
if (add_suffix)
- state_putc(' ', s);
+ state_putc(s, ' ');
if (space_quotes(s))
ql *= 2;
{
if (fst->width > 0)
{
- state_putc('\n', s);
+ state_putc(s, '\n');
fst->width = 0;
}
fst->spaces = 0;
/* flush current paragraph (if any) first */
flush_par(s, fst);
print_indent(ql, s, 0);
- state_putc('\n', s);
+ state_putc(s, '\n');
return;
}
/* only honor trailing spaces for format=flowed replies */
if (C_TextFlowed)
for (; fst->spaces; fst->spaces--)
- state_putc(' ', s);
- state_putc('\n', s);
+ state_putc(s, ' ');
+ state_putc(s, '\n');
fst->width = 0;
fst->spaces = 0;
words = 0;
fst->width = print_indent(ql, s, add_quote_suffix(s, ql));
fst->width += w + fst->spaces;
for (; fst->spaces; fst->spaces--)
- state_putc(' ', s);
- state_puts(p, s);
+ state_putc(s, ' ');
+ state_puts(s, p);
words++;
}
{
print_indent(ql, s, add_quote_suffix(s, ql));
if (line && *line)
- state_puts(line, s);
- state_putc('\n', s);
+ state_puts(s, line);
+ state_putc(s, '\n');
fst->width = 0;
fst->spaces = 0;
if ((s->flags & MUTT_DISPLAY) &&
(!C_Pager || (mutt_str_strcmp(C_Pager, "builtin") == 0)))
{
- state_puts(AttachmentMarker, s);
+ state_puts(s, AttachmentMarker);
}
}
if ((s->flags & MUTT_DISPLAY) &&
(!C_Pager || (mutt_str_strcmp(C_Pager, "builtin") == 0)))
{
- state_puts(ProtectedHeaderMarker, s);
+ state_puts(s, ProtectedHeaderMarker);
}
}
/**
* state_attach_puts - Write a string to the state
- * @param t Text to write
* @param s State to write to
+ * @param t Text to write
*/
-void state_attach_puts(const char *t, struct State *s)
+void state_attach_puts(struct State *s, const char *t)
{
- if (!t || !s || !s->fp_out)
+ if (!s || !s->fp_out || !t)
return;
if (*t != '\n')
state_mark_attach(s);
while (*t)
{
- state_putc(*t, s);
+ state_putc(s, *t);
if ((*t++ == '\n') && *t)
if (*t != '\n')
state_mark_attach(s);
/**
* state_putwc - Write a wide character to the state
- * @param wc Wide character to write
* @param s State to write to
+ * @param wc Wide character to write
* @retval 0 Success
* @retval -1 Error
*/
-static int state_putwc(wchar_t wc, struct State *s)
+static int state_putwc(struct State *s, wchar_t wc)
{
char mb[MB_LEN_MAX] = { 0 };
int rc;
/**
* state_putws - Write a wide string to the state
- * @param ws Wide string to write
* @param s State to write to
+ * @param ws Wide string to write
* @retval 0 Success
* @retval -1 Error
*/
-int state_putws(const wchar_t *ws, struct State *s)
+int state_putws(struct State *s, const wchar_t *ws)
{
const wchar_t *p = ws;
while (p && (*p != L'\0'))
{
- if (state_putwc(*p, s) < 0)
+ if (state_putwc(s, *p) < 0)
return -1;
p++;
}
/**
* state_prefix_putc - Write a prefixed character to the state
- * @param c Character to write
* @param s State to write to
+ * @param c Character to write
*/
-void state_prefix_putc(char c, struct State *s)
+void state_prefix_putc(struct State *s, char c)
{
if (s->flags & MUTT_PENDINGPREFIX)
{
state_reset_prefix(s);
if (s->prefix)
- state_puts(s->prefix, s);
+ state_puts(s, s->prefix);
}
- state_putc(c, s);
+ state_putc(s, c);
if (c == '\n')
state_set_prefix(s);
/**
* state_prefix_put - Write a prefixed fixed-string to the State
+ * @param s State to write to
* @param buf String to write
* @param buflen Length of string
- * @param s State to write to
*/
-void state_prefix_put(const char *buf, size_t buflen, struct State *s)
+void state_prefix_put(struct State *s, const char *buf, size_t buflen)
{
if (s->prefix)
{
while (buflen--)
- state_prefix_putc(*buf++, s);
+ state_prefix_putc(s, *buf++);
}
else
fwrite(buf, buflen, 1, s->fp_out);
#define state_set_prefix(state) ((state)->flags |= MUTT_PENDINGPREFIX)
#define state_reset_prefix(state) ((state)->flags &= ~MUTT_PENDINGPREFIX)
-#define state_puts(str, state) fputs(str, (state)->fp_out)
-#define state_putc(str, state) fputc(str, (state)->fp_out)
+#define state_puts(STATE, STR) fputs(STR, (STATE)->fp_out)
+#define state_putc(STATE, STR) fputc(STR, (STATE)->fp_out)
-void state_mark_attach(struct State *s);
-void state_mark_protected_header (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);
-void state_prefix_put(const char *buf, size_t buflen, struct State *s);
+void state_attach_puts (struct State *s, const char *t);
+void state_mark_attach (struct State *s);
+void state_mark_protected_header(struct State *s);
+void state_prefix_put (struct State *s, const char *buf, size_t buflen);
+void state_prefix_putc (struct State *s, char c);
+int state_printf (struct State *s, const char *fmt, ...);
+int state_putws (struct State *s, const wchar_t *ws);
#endif /* MUTT_STATE_H */