diff options
author | 2014-09-03 18:41:01 +0700 | |
---|---|---|
committer | 2014-09-03 18:41:01 +0700 | |
commit | a709168a53a70b20a6466030bfd65a8da98d7dbf (patch) | |
tree | b93ec29fd0958b9d1148923113b069d0081b6fa4 | |
parent | 634bbb6bc3a8f24bb32d5f7a0b5691a0caf606b8 (diff) |
Add allows new permanent flags property in folder info.
-rw-r--r-- | src/async/imap/MCIMAPFolderInfoOperation.cc | 9 | ||||
-rw-r--r-- | src/async/imap/MCIMAPFolderInfoOperation.h | 4 | ||||
-rwxr-xr-x | src/core/imap/MCIMAPSession.cc | 19 | ||||
-rwxr-xr-x | src/core/imap/MCIMAPSession.h | 4 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPFolderInfo.h | 3 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPFolderInfo.m | 2 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPFolderInfoOperation.mm | 1 |
7 files changed, 38 insertions, 4 deletions
diff --git a/src/async/imap/MCIMAPFolderInfoOperation.cc b/src/async/imap/MCIMAPFolderInfoOperation.cc index 8ca500f3..0ea0d005 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.cc +++ b/src/async/imap/MCIMAPFolderInfoOperation.cc @@ -20,6 +20,7 @@ IMAPFolderInfoOperation::IMAPFolderInfoOperation() mMessageCount = 0; mModSequenceValue = 0; mFirstUnseenUid = 0; + mAllowsNewPermanentFlags = false; } IMAPFolderInfoOperation::~IMAPFolderInfoOperation() @@ -51,6 +52,11 @@ uint32_t IMAPFolderInfoOperation::firstUnseenUid() return mFirstUnseenUid; } +bool IMAPFolderInfoOperation::allowsNewPermanentFlags() +{ + return mAllowsNewPermanentFlags; +} + void IMAPFolderInfoOperation::main() { ErrorCode error; @@ -73,7 +79,8 @@ void IMAPFolderInfoOperation::main() mModSequenceValue = session()->session()->modSequenceValue(); mMessageCount = session()->session()->lastFolderMessageCount(); mFirstUnseenUid = session()->session()->firstUnseenUid(); - + mAllowsNewPermanentFlags = session()->session()->allowsNewPermanentFlags(); + setError(error); } diff --git a/src/async/imap/MCIMAPFolderInfoOperation.h b/src/async/imap/MCIMAPFolderInfoOperation.h index 9b0027a4..b53be2cb 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.h +++ b/src/async/imap/MCIMAPFolderInfoOperation.h @@ -26,6 +26,7 @@ namespace mailcore { virtual uint64_t modSequenceValue(); virtual int messageCount(); virtual uint32_t firstUnseenUid(); + virtual bool allowsNewPermanentFlags(); public: // subclass behavior virtual void main(); @@ -37,7 +38,8 @@ namespace mailcore { uint64_t mModSequenceValue; int mMessageCount; uint32_t mFirstUnseenUid; - + bool mAllowsNewPermanentFlags; + }; } diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index a2fe5c9e..b004e575 100755 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -1077,7 +1077,20 @@ void IMAPSession::select(String * folder, ErrorCode * pError) mFirstUnseenUid = 0; } - + if (mImap->imap_selection_info->sel_perm_flags) { + clistiter * cur; + + struct mailimap_flag_perm * perm_flag; + for(cur = clist_end(mImap->imap_selection_info->sel_perm_flags) ; cur != NULL ; + cur = clist_previous(cur)) { + perm_flag = (struct mailimap_flag_perm *)clist_content(cur); + mAllowsNewPermanentFlags = perm_flag->fl_type == MAILIMAP_FLAG_PERM_ALL; + if (mAllowsNewPermanentFlags) { + break; + } + } + } + mModSequenceValue = get_mod_sequence_value(mImap); } @@ -3694,6 +3707,10 @@ bool IMAPSession::isCompressionEnabled() return mCompressionEnabled; } +bool IMAPSession::allowsNewPermanentFlags() { + return mAllowsNewPermanentFlags; +} + bool IMAPSession::isDisconnected() { return mState == STATE_DISCONNECTED; diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h index e52dc74f..6426fce8 100755 --- a/src/core/imap/MCIMAPSession.h +++ b/src/core/imap/MCIMAPSession.h @@ -167,7 +167,8 @@ namespace mailcore { virtual bool isXOAuthEnabled(); virtual bool isNamespaceEnabled(); virtual bool isCompressionEnabled(); - + virtual bool allowsNewPermanentFlags(); + virtual String * gmailUserDisplayName(); virtual void setConnectionLogger(ConnectionLogger * logger); @@ -227,6 +228,7 @@ namespace mailcore { bool mNamespaceEnabled; bool mCompressionEnabled; bool mIsGmail; + bool mAllowsNewPermanentFlags; String * mWelcomeString; bool mNeedsMboxMailWorkaround; uint32_t mUIDValidity; diff --git a/src/objc/imap/MCOIMAPFolderInfo.h b/src/objc/imap/MCOIMAPFolderInfo.h index c15c5a37..53ad35b8 100644 --- a/src/objc/imap/MCOIMAPFolderInfo.h +++ b/src/objc/imap/MCOIMAPFolderInfo.h @@ -34,6 +34,9 @@ // first uid of the unseen messages. @property (nonatomic, assign) uint32_t firstUnseenUid; +/** An boolean indicates that this folder or IMAP server allows to add a new permanent flags */ +@property (nonatomic, assign) BOOL allowsNewPermanentFlags; + @end #endif diff --git a/src/objc/imap/MCOIMAPFolderInfo.m b/src/objc/imap/MCOIMAPFolderInfo.m index e39551a4..be1d2c3e 100644 --- a/src/objc/imap/MCOIMAPFolderInfo.m +++ b/src/objc/imap/MCOIMAPFolderInfo.m @@ -14,6 +14,7 @@ uint64_t _modSequenceValue; int _messageCount; uint32_t _firstUnseenUid; + BOOL _allowsNewPermanentFlags; } @synthesize uidNext = _uidNext; @@ -21,6 +22,7 @@ @synthesize modSequenceValue = _modSequenceValue; @synthesize messageCount = _messageCount; @synthesize firstUnseenUid = _firstUnseenUid; +@synthesize allowsNewPermanentFlags = _allowsNewPermanentFlags; + (MCOIMAPFolderInfo *) info { diff --git a/src/objc/imap/MCOIMAPFolderInfoOperation.mm b/src/objc/imap/MCOIMAPFolderInfoOperation.mm index 7ea8e887..f4d322af 100644 --- a/src/objc/imap/MCOIMAPFolderInfoOperation.mm +++ b/src/objc/imap/MCOIMAPFolderInfoOperation.mm @@ -65,6 +65,7 @@ typedef void (^CompletionType)(NSError *error, MCOIMAPFolderInfo *info); [info setModSequenceValue:MCO_NATIVE_INSTANCE->modSequenceValue()]; [info setMessageCount:MCO_NATIVE_INSTANCE->messageCount()]; [info setFirstUnseenUid:MCO_NATIVE_INSTANCE->firstUnseenUid()]; + [info setAllowsNewPermanentFlags:MCO_NATIVE_INSTANCE->allowsNewPermanentFlags()]; _completionBlock(nil, info); } |