text stringlengths 0 357 |
|---|
// CAVE: if possible, take care not to add a name here that is "sent" in one language |
// but sth. different in others - a hard job. |
static const char* sent_names = |
",sent,sent objects,gesendet,"; |
char* lower = dc_mprintf(",%s,", folder_name); |
dc_strlower_in_place(lower); |
if (strstr(sent_names, lower)!=NULL) { |
ret_meaning = MEANING_SENT_OBJECTS; |
} |
free(lower); |
return ret_meaning; |
} |
static clist* list_folders(dc_imap_t* imap) |
{ |
clist* imap_list = NULL; |
clistiter* iter1 = NULL; |
clist * ret_list = clist_new(); |
int r = 0; |
int xlist_works = 0; |
if (imap==NULL || imap->etpan==NULL) { |
goto cleanup; |
} |
// the "*" also returns all subdirectories; |
// so the resulting foldernames may contain |
// foldernames with delimiters as "folder/subdir/subsubdir" |
// |
// when switching to XLIST: at least my server claims |
// that it support XLIST but does not return folder flags. |
// so, if we did not get a _single_ flag, sth. seems not to work. |
if (imap->has_xlist) { |
r = mailimap_xlist(imap->etpan, "", "*", &imap_list); |
} |
else { |
r = mailimap_list(imap->etpan, "", "*", &imap_list); |
} |
if (dc_imap_is_error(imap, r) || imap_list==NULL) { |
imap_list = NULL; |
dc_log_warning(imap->context, 0, "Cannot get folder list."); |
goto cleanup; |
} |
if (clist_count(imap_list)<=0) { |
dc_log_warning(imap->context, 0, "Folder list is empty."); |
goto cleanup; |
} |
// default IMAP delimiter if none is returned by the list command |
imap->imap_delimiter = '.'; |
for (iter1 = clist_begin(imap_list); iter1!=NULL ; iter1 = clist_next(iter1)) |
{ |
struct mailimap_mailbox_list* imap_folder = |
(struct mailimap_mailbox_list*)clist_content(iter1); |
if (imap_folder->mb_delimiter) { |
imap->imap_delimiter = imap_folder->mb_delimiter; |
} |
dc_imapfolder_t* ret_folder = calloc(1, sizeof(dc_imapfolder_t)); |
if (strcasecmp(imap_folder->mb_name, "INBOX")==0) { |
// Force upper case INBOX. Servers may return any case, however, |
// all variants MUST lead to the same INBOX, see RFC 3501 5.1 |
ret_folder->name_to_select = dc_strdup("INBOX"); |
} |
else { |
ret_folder->name_to_select = dc_strdup(imap_folder->mb_name); |
} |
ret_folder->name_utf8 = dc_decode_modified_utf7(imap_folder->mb_name, 0); |
ret_folder->meaning = get_folder_meaning(imap_folder->mb_flag); |
if (ret_folder->meaning==MEANING_OTHER_KNOWN |
|| ret_folder->meaning==MEANING_SENT_OBJECTS /*INBOX is no hint for a working XLIST*/) { |
xlist_works = 1; |
} |
clist_append(ret_list, (void*)ret_folder); |
} |
// at least my own server claims that it support XLIST |
// but does not return folder flags. |
if (!xlist_works) { |
for (iter1 = clist_begin(ret_list); iter1!=NULL ; iter1 = clist_next(iter1)) |
{ |
dc_imapfolder_t* ret_folder = (struct dc_imapfolder_t*)clist_content(iter1); |
ret_folder->meaning = get_folder_meaning_by_name(ret_folder->name_utf8); |
} |
} |
cleanup: |
if (imap_list) { |
mailimap_list_result_free(imap_list); |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.