1726{
1727 struct Body *b = NULL;
1728 char body_charset[256] = { 0 };
1729 const char *from_charset = NULL;
1730 const char *send_charset = NULL;
1731 bool empty = false;
1732 bool err;
1733 char buf[256] = { 0 };
1734 pid_t pid;
1737
1739 goto cleanup;
1741 goto cleanup;
1742
1743 FILE *fp_body = fopen(a->
filename,
"r");
1744 if (!fp_body)
1745 {
1747 goto cleanup;
1748 }
1749
1752 if (!fp_pgp_in)
1753 {
1756 goto cleanup;
1757 }
1758
1759
1760
1761
1762
1763
1766 from_charset = body_charset;
1767 else
1769
1771 {
1772 send_charset = "us-ascii";
1774 }
1775 else
1776 {
1777 int c;
1779
1781 send_charset = "us-ascii";
1782 else
1783 send_charset = "utf-8";
1784
1785
1788 fputc(c, fp_pgp_in);
1789
1791 }
1794
1798 if (!fp_pgp_out || !fp_pgp_err)
1799 {
1802 if (fp_pgp_out)
1803 {
1806 }
1808 goto cleanup;
1809 }
1810
1812 fileno(fp_pgp_err),
buf_string(pgpinfile), keylist, flags);
1813 if (pid == -1)
1814 {
1820 goto cleanup;
1821 }
1822
1826 fprintf(fp_pgp_in,
"%s\n",
PgpPass);
1828
1831 empty = true;
1832
1834
1835 fflush(fp_pgp_out);
1836 fflush(fp_pgp_err);
1837
1838 rewind(fp_pgp_out);
1839 rewind(fp_pgp_err);
1840
1841 if (!empty)
1842 empty = (fgetc(fp_pgp_out) == EOF);
1844
1845 err = false;
1846
1847 while (fgets(buf, sizeof(buf), fp_pgp_err))
1848 {
1849 err = true;
1850 fputs(buf, stdout);
1851 }
1852
1854
1855 if (err)
1857
1858 if (empty)
1859 {
1863 goto cleanup;
1864 }
1865
1867
1869
1872
1874 (flags &
SEC_ENCRYPT) ?
"pgp-encrypted" :
"pgp-signed");
1876
1878
1881
1884
1887
1888cleanup:
1891 return b;
1892}
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cc_charset(void)
Get the cached value of $charset.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
struct Body * mutt_body_new(void)
Create a new Body.
char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen)
Get a body's character set.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
void mutt_file_unlink(const char *s)
Delete a file, carefully.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
void pgp_class_void_passphrase(void)
Implements CryptModuleSpecs::void_passphrase() -.
@ TYPE_TEXT
Type: 'text/*'.
@ DISP_NONE
No preferred disposition.
void mutt_ch_fgetconv_close(struct FgetConv **fc)
Close an fgetconv handle.
int mutt_ch_fgetconv(struct FgetConv *fc)
Convert a file's character set.
struct FgetConv * mutt_ch_fgetconv_open(FILE *fp, const char *from, const char *to, uint8_t flags)
Prepare a file for charset conversion.
#define mutt_ch_is_us_ascii(str)
#define MUTT_ICONV_NO_FLAGS
No flags are set.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_SIGN
Email is signed.
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
static char PgpPass[1024]
Cached PGP Passphrase.
bool pgp_use_gpg_agent(void)
Does the user want to use the gpg agent?
pid_t pgp_invoke_traditional(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err, int fd_pgp_in, int fd_pgp_out, int fd_pgp_err, const char *fname, const char *uids, SecurityFlags flags)
Use PGP to create in inline-signed message.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
bool noconv
Don't do character set conversion.
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
struct ParameterList parameter
Parameters of the content-type.
bool use_disp
Content-Disposition uses filename= ?
unsigned int disposition
content-disposition, ContentDisposition
char * subtype
content-type subtype
unsigned int encoding
content-transfer-encoding, ContentEncoding
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
Cursor for converting a file's encoding.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
#define mutt_file_mkstemp()