diff options
author | 2014-08-10 13:59:19 -0700 | |
---|---|---|
committer | 2014-08-10 13:59:19 -0700 | |
commit | d748e6db8281757a599cae9a03909b0138da2de0 (patch) | |
tree | e9712bfdec77be953bc0e018ee91758cd4f0d706 /src | |
parent | 0013f3894b2f4d326a3b64dbaf60efaba9a1227e (diff) | |
parent | df26f8c684786f8da4319711aeb982094c8ca5ef (diff) |
Merge branch '826-headers'
Diffstat (limited to 'src')
-rwxr-xr-x | src/core/imap/MCIMAPSession.cc | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index 63cf148c..a2fe5c9e 100755 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -2187,6 +2187,7 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest needsGmailLabels = false; needsGmailMessageID = false; needsGmailThreadID = false; + clist * hdrlist = clist_new(); fetch_type = mailimap_fetch_type_new_fetch_att_list_empty(); fetch_att = mailimap_fetch_att_new_uid(); @@ -2214,15 +2215,11 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest needsGmailMessageID = true; } if ((requestKind & IMAPMessagesRequestKindFullHeaders) != 0) { - clist * hdrlist; char * header; - struct mailimap_header_list * imap_hdrlist; - struct mailimap_section * section; MCLog("request envelope"); // most important header - hdrlist = clist_new(); header = strdup("Date"); clist_append(hdrlist, header); header = strdup("Subject"); @@ -2243,17 +2240,9 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest clist_append(hdrlist, header); header = strdup("In-Reply-To"); clist_append(hdrlist, header); - imap_hdrlist = mailimap_header_list_new(hdrlist); - section = mailimap_section_new_header_fields(imap_hdrlist); - fetch_att = mailimap_fetch_att_new_body_peek_section(section); - mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); - needsHeader = true; } if ((requestKind & IMAPMessagesRequestKindHeaders) != 0) { - clist * hdrlist; char * header; - struct mailimap_header_list * imap_hdrlist; - struct mailimap_section * section; MCLog("request envelope"); // envelope @@ -2261,18 +2250,12 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); // references header - hdrlist = clist_new(); header = strdup("References"); clist_append(hdrlist, header); if ((requestKind & IMAPMessagesRequestKindHeaderSubject) != 0) { header = strdup("Subject"); clist_append(hdrlist, header); } - imap_hdrlist = mailimap_header_list_new(hdrlist); - section = mailimap_section_new_header_fields(imap_hdrlist); - fetch_att = mailimap_fetch_att_new_body_peek_section(section); - mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); - needsHeader = true; } if ((requestKind & IMAPMessagesRequestKindSize) != 0) { // message structure @@ -2295,27 +2278,31 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest } if ((requestKind & IMAPMessagesRequestKindExtraHeaders) != 0) { // custom header request - clist * hdrlist; char * header; - struct mailimap_header_list * imap_hdrlist; - struct mailimap_section * section; if (extraHeaders && extraHeaders->count() > 0) { - hdrlist = clist_new(); for (unsigned int i = 0; i < extraHeaders->count(); i++) { - String *headerString = (String *)extraHeaders->objectAtIndex(i); + String * headerString = (String *)extraHeaders->objectAtIndex(i); header = strdup(headerString->UTF8Characters()); clist_append(hdrlist, header); } - - imap_hdrlist = mailimap_header_list_new(hdrlist); - section = mailimap_section_new_header_fields(imap_hdrlist); - fetch_att = mailimap_fetch_att_new_body_peek_section(section); - mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); - needsHeader = true; } } + if (clist_begin(hdrlist) != NULL) { + struct mailimap_header_list * imap_hdrlist; + struct mailimap_section * section; + + imap_hdrlist = mailimap_header_list_new(hdrlist); + section = mailimap_section_new_header_fields(imap_hdrlist); + fetch_att = mailimap_fetch_att_new_body_peek_section(section); + mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); + needsHeader = true; + } + else { + clist_free(hdrlist); + } + struct msg_att_handler_data msg_att_data; memset(&msg_att_data, 0, sizeof(msg_att_data)); |