mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-08-09 20:25:07 +00:00
EMAIL.SYSTEM: fixed bug moving/copying messages to another folder
This commit is contained in:
20
apps/email.c
20
apps/email.c
@@ -1555,7 +1555,7 @@ void get_email_body(struct emailhdrs *h, FILE *f, char mode) {
|
|||||||
*/
|
*/
|
||||||
void copy_to_mailbox(struct emailhdrs *h, uint16_t idx,
|
void copy_to_mailbox(struct emailhdrs *h, uint16_t idx,
|
||||||
char *mbox, uint8_t delete, char mode) {
|
char *mbox, uint8_t delete, char mode) {
|
||||||
uint16_t num, buflen, l;
|
uint16_t num, buflen, l, written;
|
||||||
FILE *fp2;
|
FILE *fp2;
|
||||||
|
|
||||||
if (mode == 'F') {
|
if (mode == 'F') {
|
||||||
@@ -1603,7 +1603,23 @@ void copy_to_mailbox(struct emailhdrs *h, uint16_t idx,
|
|||||||
putchar(' '); // For spinner
|
putchar(' '); // For spinner
|
||||||
if (mode == 'R')
|
if (mode == 'R')
|
||||||
fputc('>', fp2);
|
fputc('>', fp2);
|
||||||
get_email_body(h, fp2, mode);
|
if ((mode == 'R') || (mode == 'F')) {
|
||||||
|
get_email_body(h, fp2, mode);
|
||||||
|
} else {
|
||||||
|
while (1) {
|
||||||
|
buflen = fread(buf, 1, READSZ, fp);
|
||||||
|
spinner();
|
||||||
|
if (buflen == 0)
|
||||||
|
break;
|
||||||
|
written = fwrite(buf, 1, buflen, fp2);
|
||||||
|
if (written != buflen) {
|
||||||
|
error(ERR_NONFATAL, "Write error during copy");
|
||||||
|
fclose(fp);
|
||||||
|
fclose(fp2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
putchar(BACKSPACE);
|
putchar(BACKSPACE);
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
Reference in New Issue
Block a user