mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 01:51:59 +01:00
improved the folder importing feature
This commit is contained in:
parent
f4152e1f64
commit
526295dae4
@ -13,7 +13,7 @@
|
||||
|
||||
#define VERSION "1.2.0-master"
|
||||
|
||||
#define BUILD 929
|
||||
#define BUILD 930
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
11
src/imap.c
11
src/imap.c
@ -122,6 +122,13 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
||||
|
||||
if(messages <= 0) return OK;
|
||||
|
||||
|
||||
if(data->recursive_folder_names == 1){
|
||||
data->folder = get_folder_id(sdata, data, folder, 0, cfg);
|
||||
if(data->folder == ERR_FOLDER) data->folder = add_new_folder(sdata, data, folder, 0, cfg);
|
||||
}
|
||||
|
||||
|
||||
data->import->total_messages += messages;
|
||||
|
||||
for(i=data->import->start_position; i<=messages; i++){
|
||||
@ -461,10 +468,6 @@ int list_folders(int sd, int *seq, int use_ssl, struct __data *data){
|
||||
q++;
|
||||
fldrlen = strtol(q, NULL, 10);
|
||||
} else {
|
||||
//if(*q == '"') q++;
|
||||
|
||||
//if(q[strlen(q)-1] == ' ') q[strlen(q)-1] = '\0';
|
||||
//if(q[strlen(q)-1] == '"') q[strlen(q)-1] = '\0';
|
||||
|
||||
if(fldrlen) {
|
||||
ruf = malloc(strlen(q) * 2 + 1);
|
||||
|
@ -132,6 +132,8 @@ int store_recipients(struct session_data *sdata, struct __data *data, char *to,
|
||||
int store_folder_id(struct session_data *sdata, struct __data *data, uint64 id, struct __config *cfg){
|
||||
int rc = ERR;
|
||||
|
||||
if(data->folder == ERR_FOLDER) return rc;
|
||||
|
||||
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_folder_message_table), SQL_PREPARED_STMT_INSERT_FOLDER_MESSAGE, cfg) == ERR) return rc;
|
||||
|
||||
p_bind_init(data);
|
||||
|
@ -486,11 +486,11 @@ void usage(){
|
||||
printf(" -f <imap folder> IMAP folder name to import\n");
|
||||
printf(" -g <imap folder> Move email after import to this IMAP folder\n");
|
||||
printf(" -F <folder> Piler folder name to assign to this import\n");
|
||||
printf(" -R Assign IMAP folder names as Piler folder names\n");
|
||||
printf(" -b <batch limit> Import only this many emails\n");
|
||||
printf(" -s <start position> Start importing POP3 emails from this position\n");
|
||||
printf(" -D Dry-run, do not import anything\n");
|
||||
printf(" -o Only download emails for POP3/IMAP import\n");
|
||||
printf(" -R Recursive piler folder names\n");
|
||||
printf(" -r Remove imported emails\n");
|
||||
printf(" -q Quiet mode\n");
|
||||
|
||||
@ -701,6 +701,11 @@ int main(int argc, char **argv){
|
||||
|
||||
cfg = read_config(configfile);
|
||||
|
||||
if((data.recursive_folder_names == 1 || folder) && cfg.enable_folders == 0){
|
||||
printf("please set enable_folders=1 in piler.conf to use the folder options\n");
|
||||
return ERR;
|
||||
}
|
||||
|
||||
/* make sure we don't discard messages without a valid Message-Id when importing manually */
|
||||
cfg.archive_emails_not_having_message_id = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user