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

Method fetchNonDecodedMessageAttachment

src/core/imap/MCIMAPSession.cpp:2882–2964  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2880};
2881
2882Data * IMAPSession::fetchNonDecodedMessageAttachment(String * folder, bool identifier_is_uid,
2883 uint32_t identifier, String * partID,
2884 bool wholePart, uint32_t offset, uint32_t length,
2885 Encoding encoding, IMAPProgressCallback * progressCallback, ErrorCode * pError)
2886{
2887 struct mailimap_fetch_type * fetch_type;
2888 struct mailimap_fetch_att * fetch_att;
2889 struct mailimap_section * section;
2890 struct mailimap_section_part * section_part;
2891 clist * sec_list;
2892 Array * partIDArray;
2893 int r;
2894 char * text = NULL;
2895 size_t text_length = 0;
2896 Data * data;
2897
2898 selectIfNeeded(folder, pError);
2899 if (* pError != ErrorNone)
2900 return NULL;
2901
2902 mProgressItemsCount = 0;
2903 mProgressCallback = progressCallback;
2904 bodyProgress(0, 0);
2905
2906 partIDArray = partID->componentsSeparatedByString(MCSTR("."));
2907 sec_list = clist_new();
2908 for(unsigned int i = 0 ; i < partIDArray->count() ; i ++) {
2909 uint32_t * value;
2910 String * element;
2911
2912 element = (String *) partIDArray->objectAtIndex(i);
2913 value = (uint32_t *) malloc(sizeof(* value));
2914 * value = element->intValue();
2915 clist_append(sec_list, value);
2916 }
2917 section_part = mailimap_section_part_new(sec_list);
2918 section = mailimap_section_new_part(section_part);
2919 if (wholePart) {
2920 fetch_att = mailimap_fetch_att_new_body_peek_section(section);
2921 }
2922 else {
2923 fetch_att = mailimap_fetch_att_new_body_peek_section_partial(section, offset, length);
2924 }
2925 fetch_type = mailimap_fetch_type_new_fetch_att(fetch_att);
2926
2927#ifdef LIBETPAN_HAS_MAILIMAP_RAMBLER_WORKAROUND
2928 if (mRamblerRuServer && (encoding == EncodingBase64 || encoding == EncodingUUEncode)) {
2929 mailimap_set_rambler_workaround_enabled(mImap, 1);
2930 }
2931#endif
2932
2933 r = fetch_imap(mImap, identifier_is_uid, identifier, fetch_type, &text, &text_length);
2934 mailimap_fetch_type_free(fetch_type);
2935
2936#ifdef LIBETPAN_HAS_MAILIMAP_RAMBLER_WORKAROUND
2937 mailimap_set_rambler_workaround_enabled(mImap, 0);
2938#endif
2939

Callers

nothing calls this directly

Calls 8

fetch_imapFunction · 0.85
hasErrorFunction · 0.85
objectAtIndexMethod · 0.80
takeBytesOwnershipMethod · 0.80
dataFunction · 0.50
countMethod · 0.45
intValueMethod · 0.45

Tested by

no test coverage detected