mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 17:30:12 +01:00
restrict imap import to the given folder
This commit is contained in:
parent
a5b7f1f947
commit
2a78ad2f57
@ -32,7 +32,7 @@ extern int optind;
|
|||||||
|
|
||||||
int dryrun=0;
|
int dryrun=0;
|
||||||
int import_from_gui=0;
|
int import_from_gui=0;
|
||||||
|
char *folder_imap=NULL;
|
||||||
|
|
||||||
int connect_to_imap_server(int sd, int *seq, char *username, char *password, int port, struct __data *data, int use_ssl);
|
int connect_to_imap_server(int sd, int *seq, char *username, char *password, int port, struct __data *data, int use_ssl);
|
||||||
int list_folders(int sd, int *seq, int use_ssl, struct __data *data);
|
int list_folders(int sd, int *seq, int use_ssl, struct __data *data);
|
||||||
@ -313,6 +313,10 @@ int import_from_imap_server(char *server, char *username, char *password, int po
|
|||||||
if(strstr(skiplist, q->str)) skipmatch = 1;
|
if(strstr(skiplist, q->str)) skipmatch = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(folder_imap && strstr(q->str, folder_imap) == NULL){
|
||||||
|
skipmatch = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(skipmatch == 1){
|
if(skipmatch == 1){
|
||||||
if(data->quiet == 0) printf("SKIPPING FOLDER: %s\n", (char *)q->str);
|
if(data->quiet == 0) printf("SKIPPING FOLDER: %s\n", (char *)q->str);
|
||||||
}
|
}
|
||||||
@ -505,6 +509,7 @@ int main(int argc, char **argv){
|
|||||||
{"port", required_argument, 0, 'P' },
|
{"port", required_argument, 0, 'P' },
|
||||||
{"skiplist", required_argument, 0, 'x' },
|
{"skiplist", required_argument, 0, 'x' },
|
||||||
{"folder", required_argument, 0, 'F' },
|
{"folder", required_argument, 0, 'F' },
|
||||||
|
{"folder_imap", required_argument, 0, 'f' },
|
||||||
{"quiet", required_argument, 0, 'q' },
|
{"quiet", required_argument, 0, 'q' },
|
||||||
{"recursive", required_argument, 0, 'R' },
|
{"recursive", required_argument, 0, 'R' },
|
||||||
{"remove-after-import", required_argument, 0, 'r' },
|
{"remove-after-import", required_argument, 0, 'r' },
|
||||||
@ -516,9 +521,9 @@ int main(int argc, char **argv){
|
|||||||
|
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
|
||||||
c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:GDRrqh?", long_options, &option_index);
|
c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:GDRrqh?", long_options, &option_index);
|
||||||
#else
|
#else
|
||||||
c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:GDRrqh?");
|
c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:GDRrqh?");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(c == -1) break;
|
if(c == -1) break;
|
||||||
@ -579,6 +584,10 @@ int main(int argc, char **argv){
|
|||||||
folder = optarg;
|
folder = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f' :
|
||||||
|
folder_imap = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'R' :
|
case 'R' :
|
||||||
data.recursive_folder_names = 1;
|
data.recursive_folder_names = 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user