mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:10:12 +01:00
Update the imap noselect fix
Change-Id: I91c260dec9e50e0b12d51f2bcc2b843c579acca6 Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
3be31d52ac
commit
96625883bb
23
src/imap.c
23
src/imap.c
@ -395,9 +395,9 @@ void send_imap_close(int sd, int *seq, 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, char *folder_name, struct __data *data){
|
||||
char *p, *q, *r, *buf, *ruf, tag[SMALLBUFSIZE], tagok[SMALLBUFSIZE], puf[MAXBUFSIZE];
|
||||
char attrs[SMALLBUFSIZE];
|
||||
char attrs[SMALLBUFSIZE], folder[SMALLBUFSIZE];
|
||||
int len=MAXBUFSIZE+3, pos=0, n, rc=ERR, fldrlen=0, result;
|
||||
|
||||
printf("List of IMAP folders:\n");
|
||||
@ -408,8 +408,10 @@ int list_folders(int sd, int *seq, int use_ssl, struct __data *data){
|
||||
memset(buf, 0, len);
|
||||
|
||||
snprintf(tag, sizeof(tag)-1, "A%d", *seq); snprintf(tagok, sizeof(tagok)-1, "A%d OK", (*seq)++);
|
||||
//snprintf(puf, sizeof(puf)-1, "%s LIST \"\" %%\r\n", tag);
|
||||
if(folder_name == NULL)
|
||||
snprintf(puf, sizeof(puf)-1, "%s LIST \"\" \"*\"\r\n", tag);
|
||||
else
|
||||
snprintf(puf, sizeof(puf)-1, "%s LIST \"%s\" \"*\"\r\n", tag, folder_name);
|
||||
|
||||
write1(sd, puf, strlen(puf), use_ssl, data->ssl);
|
||||
|
||||
@ -484,23 +486,20 @@ int list_folders(int sd, int *seq, int use_ssl, struct __data *data){
|
||||
r++;
|
||||
}
|
||||
|
||||
if(!strstr(attrs, "\\Noselect")){
|
||||
addnode(data->imapfolders, ruf);
|
||||
}
|
||||
else printf("skipping ");
|
||||
|
||||
printf("=> '%s' {%d} [%s]\n", ruf, fldrlen, attrs);
|
||||
snprintf(folder, sizeof(folder)-1, "%s", ruf);
|
||||
|
||||
free(ruf);
|
||||
fldrlen = 0;
|
||||
} else {
|
||||
snprintf(folder, sizeof(folder)-1, "%s", q);
|
||||
}
|
||||
|
||||
if(!strstr(attrs, "\\Noselect")){
|
||||
addnode(data->imapfolders, q);
|
||||
addnode(data->imapfolders, folder);
|
||||
}
|
||||
else printf("skipping ");
|
||||
|
||||
printf("=> '%s [%s]'\n", q, attrs);
|
||||
}
|
||||
printf("=> '%s [%s]'\n", folder, attrs);
|
||||
|
||||
memset(attrs, 0, sizeof(attrs));
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ int connect_to_pop3_server(int sd, char *username, char *password, struct __data
|
||||
int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg);
|
||||
|
||||
int connect_to_imap_server(int sd, int *seq, char *username, char *password, 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, char *folder_name, struct __data *data);
|
||||
int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg);
|
||||
void send_imap_close(int sd, int *seq, struct __data *data, int use_ssl);
|
||||
|
||||
|
@ -64,18 +64,7 @@ int import_from_imap_server(char *server, char *username, char *password, int po
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* if the user gives -f <foldername>, then don't iterate through the folder list
|
||||
* rather build the folderlist based on the <foldername> option, 2014.10.14, SJ
|
||||
*/
|
||||
|
||||
if(folder_imap){
|
||||
addnode(data->imapfolders, folder_imap);
|
||||
} else {
|
||||
rc = list_folders(sd, &seq, use_ssl, data);
|
||||
if(rc == ERR) goto ENDE_IMAP;
|
||||
}
|
||||
|
||||
if(list_folders(sd, &seq, use_ssl, folder_imap, data) == ERR) goto ENDE_IMAP;
|
||||
|
||||
for(i=0;i<MAXHASH;i++){
|
||||
q = data->imapfolders[i];
|
||||
@ -90,10 +79,6 @@ int import_from_imap_server(char *server, char *username, char *password, int po
|
||||
if(strstr(skiplist, puf)) skipmatch = 1;
|
||||
}
|
||||
|
||||
if(folder_imap && strstr(q->str, folder_imap) == NULL){
|
||||
skipmatch = 1;
|
||||
}
|
||||
|
||||
if(skipmatch == 1){
|
||||
if(data->quiet == 0) printf("SKIPPING FOLDER: %s\n", (char *)q->str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user