mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 09:10:12 +01:00
imap fix
This commit is contained in:
parent
a303b66717
commit
4c352efb76
@ -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"
|
||||||
|
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
22
src/imap.c
22
src/imap.c
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user