MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / fetch_rfc822

Function fetch_rfc822

src/core/imap/MCIMAPSession.cpp:2728–2808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2726}
2727
2728static int fetch_rfc822(mailimap * session, bool identifier_is_uid,
2729 uint32_t identifier, char ** result, size_t * result_len)
2730{
2731 struct mailimap_section * section;
2732 struct mailimap_fetch_att * fetch_att;
2733 struct mailimap_fetch_type * fetch_type;
2734
2735 section = mailimap_section_new(NULL);
2736 fetch_att = mailimap_fetch_att_new_body_peek_section(section);
2737 fetch_type = mailimap_fetch_type_new_fetch_att(fetch_att);
2738 int r = fetch_imap(session, identifier_is_uid, identifier,
2739 fetch_type, result, result_len);
2740 mailimap_fetch_type_free(fetch_type);
2741
2742 return r;
2743
2744#if 0
2745 int r;
2746 clist * fetch_list;
2747 struct mailimap_section * section;
2748 struct mailimap_fetch_att * fetch_att;
2749 struct mailimap_fetch_type * fetch_type;
2750 struct mailimap_set * set;
2751 struct mailimap_msg_att * msg_att;
2752 struct mailimap_msg_att_item * item;
2753 int res;
2754 clistiter * cur;
2755
2756 section = mailimap_section_new(NULL);
2757 fetch_att = mailimap_fetch_att_new_body_peek_section(section);
2758 fetch_type = mailimap_fetch_type_new_fetch_att(fetch_att);
2759
2760 set = mailimap_set_new_single(identifier);
2761
2762 if (identifier_is_uid) {
2763 r = mailimap_uid_fetch(session, set, fetch_type, &fetch_list);
2764 }
2765 else {
2766 r = mailimap_fetch(session, set, fetch_type, &fetch_list);
2767 }
2768
2769 mailimap_set_free(set);
2770 mailimap_fetch_type_free(fetch_type);
2771
2772 if (r != MAILIMAP_NO_ERROR) {
2773 res = r;
2774 goto err;
2775 }
2776
2777 if (clist_isempty(fetch_list)) {
2778 res = MAILIMAP_ERROR_FETCH;
2779 goto free;
2780 }
2781
2782 msg_att = (struct mailimap_msg_att *) clist_begin(fetch_list)->data;
2783
2784 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
2785 item = (struct mailimap_msg_att_item *) clist_content(cur);

Callers 1

fetchMessageMethod · 0.85

Calls 1

fetch_imapFunction · 0.85

Tested by

no test coverage detected