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 VERSION "0.1.25-rc3"
#define BUILD 879 #define BUILD 880
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

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

View File

@ -163,8 +163,24 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
len = strlen(puf); len = strlen(puf);
if(nreads == 1){ if(nreads == 1){
msglen = get_message_length_from_imap_answer(puf);
continue; 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(len > 0){
@ -199,7 +215,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
close(fd); 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; 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); snprintf(sdata->filename, SMALLBUFSIZE-1, "%s", filename);
sdata->tot_len = st.st_size; 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.recursive_folder_names = 0;
data.quiet = 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.started = import.updated = import.finished = import.remove_after_import = 0;
import.extra_recipient = NULL; import.extra_recipient = NULL;