This commit is contained in:
SJ 2014-07-16 12:39:54 +02:00
parent a303b66717
commit 4c352efb76
5 changed files with 24 additions and 5 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.25-rc3"
#define BUILD 879
#define BUILD 880
#define HOSTID "mailarchiver"

View File

@ -271,6 +271,7 @@ struct import {
int import_job_id;
int remove_after_import;
int keep_eml;
long total_size;
time_t started, updated, finished;
};

View File

@ -163,10 +163,26 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
len = strlen(puf);
if(nreads == 1){
if(strcasestr(puf, " FETCH ")){
msglen = get_message_length_from_imap_answer(puf);
if(msglen == 0){
finished = 1;
break;
}
continue;
}
if(strcasestr(puf, " BYE")){
printf("imap server sent BYE response: '%s'\n", puf);
close(fd);
unlink(filename);
return ERR;
}
}
if(len > 0){
if(msg_written_len < msglen){
write(fd, puf, len);
@ -199,7 +215,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
close(fd);
if(dryrun == 0) rc = import_message(filename, sdata, data, cfg);
if(dryrun == 0 && msglen > 10) rc = import_message(filename, sdata, data, cfg);
else rc = OK;

View File

@ -67,6 +67,8 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
snprintf(sdata->filename, SMALLBUFSIZE-1, "%s", filename);
sdata->tot_len = st.st_size;
data->import->total_size += st.st_size;
}

View File

@ -484,7 +484,7 @@ int main(int argc, char **argv){
data.recursive_folder_names = 0;
data.quiet = 0;
import.import_job_id = import.total_messages = import.processed_messages = 0;
import.import_job_id = import.total_messages = import.total_size = import.processed_messages = 0;
import.started = import.updated = import.finished = import.remove_after_import = 0;
import.extra_recipient = NULL;