Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions Vendor/mailcore2/src/core/imap/MCIMAPSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ void IMAPSession::init()
mRamblerRuServer = false;
mHermesServer = false;
mQipServer = false;
mOutlookServer = false;
mLastFetchedSequenceNumber = 0;
mCurrentFolder = NULL;
pthread_mutex_init(&mIdleLock, NULL);
Expand Down Expand Up @@ -733,6 +734,7 @@ void IMAPSession::connect(ErrorCode * pError)
mRamblerRuServer = (mHostname->locationOfString(MCSTR(".rambler.ru")) != -1);
mHermesServer = (mWelcomeString->locationOfString(MCSTR("Hermes")) != -1);
mQipServer = (mWelcomeString->locationOfString(MCSTR("QIP IMAP server")) != -1);
mOutlookServer = (mHostname->locationOfString(MCSTR(".outlook.com")) != -1);
}

mState = STATE_CONNECTED;
Expand Down Expand Up @@ -2066,10 +2068,9 @@ void IMAPSession::expunge(String * folder, ErrorCode * pError)
* pError = ErrorNone;
}

static int
fetch_imap(mailimap * imap, bool identifier_is_uid, uint32_t identifier,
struct mailimap_fetch_type * fetch_type,
char ** result, size_t * result_len)
int IMAPSession::fetch_imap(mailimap * imap, bool identifier_is_uid, uint32_t identifier,
struct mailimap_fetch_type * fetch_type,
char ** result, size_t * result_len)
{
int r;
struct mailimap_msg_att * msg_att;
Expand Down Expand Up @@ -2126,13 +2127,21 @@ fetch_imap(mailimap * imap, bool identifier_is_uid, uint32_t identifier,
}

mailimap_fetch_list_free(fetch_result);

if (text == NULL)
return MAILIMAP_ERROR_FETCH;


if (text == NULL) {
if (mOutlookServer) {
// Outlook.com IMAP server omits some parts and returns them as
// zero-length when there is a vCalendar part in the message
text_length = 0;
}
else {
return MAILIMAP_ERROR_FETCH;
}
}

* result = text;
* result_len = text_length;

return MAILIMAP_NO_ERROR;
}

Expand Down Expand Up @@ -2803,8 +2812,8 @@ Array * IMAPSession::fetchMessagesByNumberWithExtraHeaders(String * folder, IMAP
return result;
}

static int fetch_rfc822(mailimap * session, bool identifier_is_uid,
uint32_t identifier, char ** result, size_t * result_len)
int IMAPSession::fetch_rfc822(mailimap * session, bool identifier_is_uid,
uint32_t identifier, char ** result, size_t * result_len)
{
struct mailimap_section * section;
struct mailimap_fetch_att * fetch_att;
Expand Down
7 changes: 6 additions & 1 deletion Vendor/mailcore2/src/core/imap/MCIMAPSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ namespace mailcore {
bool mRamblerRuServer;
bool mHermesServer;
bool mQipServer;

bool mOutlookServer;

unsigned int mLastFetchedSequenceNumber;
String * mCurrentFolder;
pthread_mutex_t mIdleLock;
Expand Down Expand Up @@ -326,6 +327,10 @@ namespace mailcore {
bool wholePart, uint32_t offset, uint32_t length,
Encoding encoding, IMAPProgressCallback * progressCallback, ErrorCode * pError);
void storeLabels(String * folder, bool identifier_is_uid, IndexSet * identifiers, IMAPStoreFlagsRequestKind kind, Array * labels, ErrorCode * pError);
int fetch_imap(struct mailimap * imap, bool identifier_is_uid, uint32_t identifier,
struct mailimap_fetch_type * fetch_type, char ** result, size_t * result_len);
int fetch_rfc822(struct mailimap * session, bool identifier_is_uid,
uint32_t identifier, char ** result, size_t * result_len);
};

}
Expand Down
Loading