diff options
author | Hoà V. DINH <dinh.viet.hoa@gmail.com> | 2016-03-26 23:32:46 -0700 |
---|---|---|
committer | Hoà V. DINH <dinh.viet.hoa@gmail.com> | 2016-03-26 23:32:46 -0700 |
commit | f5883730742607cf723ba9cab5eb7c469e67c316 (patch) | |
tree | 7e0995a68f5a6fd8cb6939596932b9998b43fdc4 /src | |
parent | 3ca0f16318c446c4a39939f1fbb1da2cef0d1e31 (diff) | |
parent | 75b628cb7678e6bd8cec41edbd0820ce833f9dae (diff) |
Merge pull request #1384 from CodaFi/simple-sauce
Remove duplicate `mCanIdle`
Diffstat (limited to 'src')
-rwxr-xr-x | src/core/imap/MCIMAPSession.cpp | 25 | ||||
-rwxr-xr-x | src/core/imap/MCIMAPSession.h | 1 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/core/imap/MCIMAPSession.cpp b/src/core/imap/MCIMAPSession.cpp index 8f404cc9..0a0d6389 100755 --- a/src/core/imap/MCIMAPSession.cpp +++ b/src/core/imap/MCIMAPSession.cpp @@ -344,7 +344,6 @@ void IMAPSession::init() mLastFetchedSequenceNumber = 0; mCurrentFolder = NULL; pthread_mutex_init(&mIdleLock, NULL); - mCanIdle = true; mState = STATE_DISCONNECTED; mImap = NULL; mProgressCallback = NULL; @@ -561,7 +560,7 @@ void IMAPSession::unsetup() LOCK(); imap = mImap; mImap = NULL; - mCanIdle = false; + mIdleEnabled = false; UNLOCK(); if (imap != NULL) { @@ -3232,8 +3231,8 @@ bool IMAPSession::setupIdle() { // main thread LOCK(); - bool canIdle = mCanIdle; - if (mCanIdle) { + bool canIdle = mIdleEnabled; + if (mIdleEnabled) { mailstream_setup_idle(mImap->imap_stream); } UNLOCK(); @@ -3332,7 +3331,7 @@ void IMAPSession::interruptIdle() { // main thread LOCK(); - if (mCanIdle) { + if (mIdleEnabled) { mailstream_interrupt_idle(mImap->imap_stream); } UNLOCK(); @@ -3342,7 +3341,7 @@ void IMAPSession::unsetupIdle() { // main thread LOCK(); - if (mCanIdle) { + if (mIdleEnabled) { mailstream_unsetup_idle(mImap->imap_stream); } UNLOCK(); @@ -3852,9 +3851,7 @@ void IMAPSession::capabilitySetWithSessionState(IndexSet * capabilities) capabilities->addIndex(IMAPCapabilityAuthLogin); } if (mailimap_has_idle(mImap)) { - LOCK(); - mCanIdle = true; - UNLOCK(); + capabilities->addIndex(IMAPCapabilityIdle); } if (mailimap_has_id(mImap)) { capabilities->addIndex(IMAPCapabilityId); @@ -3867,9 +3864,6 @@ void IMAPSession::capabilitySetWithSessionState(IndexSet * capabilities) // RFC 6154. capabilities->addIndex(IMAPCapabilityGmail); } - if (mailimap_has_idle(mImap)) { - capabilities->addIndex(IMAPCapabilityIdle); - } if (mailimap_has_condstore(mImap)) { capabilities->addIndex(IMAPCapabilityCondstore); } @@ -3922,7 +3916,9 @@ void IMAPSession::applyCapabilities(IndexSet * capabilities) mIsGmail = true; } if (capabilities->containsIndex(IMAPCapabilityIdle)) { + LOCK(); mIdleEnabled = true; + UNLOCK(); } if (capabilities->containsIndex(IMAPCapabilityCondstore)) { mCondstoreEnabled = true; @@ -3946,7 +3942,10 @@ void IMAPSession::applyCapabilities(IndexSet * capabilities) bool IMAPSession::isIdleEnabled() { - return mIdleEnabled; + LOCK(); + bool idleEnabled = mIdleEnabled; + UNLOCK(); + return idleEnabled; } bool IMAPSession::isXListEnabled() diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h index fa230d40..e9b8130c 100755 --- a/src/core/imap/MCIMAPSession.h +++ b/src/core/imap/MCIMAPSession.h @@ -263,7 +263,6 @@ namespace mailcore { unsigned int mLastFetchedSequenceNumber; String * mCurrentFolder; pthread_mutex_t mIdleLock; - bool mCanIdle; int mState; mailimap * mImap; IMAPProgressCallback * mProgressCallback; |