From 7caa935cb50e712a1ee99b61d3b0029616773f6d Mon Sep 17 00:00:00 2001 From: silenteh Date: Tue, 4 Jun 2013 23:50:41 +0200 Subject: added the first unread uid from the SELECT imap command - the name of the variable has the wrong name, I will change it on the following commits --- src/core/imap/MCIMAPSession.cc | 13 +++++++++++++ src/core/imap/MCIMAPSession.h | 4 ++++ 2 files changed, 17 insertions(+) (limited to 'src/core/imap') diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index e926be75..542f7e14 100644 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -329,6 +329,7 @@ void IMAPSession::init() mUIDNext = 0; mModSequenceValue = 0; mFolderMsgCount = 0; + mFolderUnseenCount = 0; mLastFetchedSequenceNumber = 0; mCurrentFolder = NULL; pthread_mutex_init(&mIdleLock, NULL); @@ -840,6 +841,13 @@ void IMAPSession::select(String * folder, ErrorCode * pError) mFolderMsgCount = -1; } + if (mImap->imap_selection_info->sel_first_unseen) { + mFolderUnseenCount = (unsigned int) (mImap->imap_selection_info->sel_first_unseen); + } else { + mFolderUnseenCount = -1; + } + + mModSequenceValue = get_mod_sequence_value(mImap); } @@ -2694,6 +2702,11 @@ unsigned int IMAPSession::lastFolderMessageCount() return mFolderMsgCount; } +unsigned int IMAPSession::lastFolderUnseenCount() +{ + return mFolderUnseenCount; +} + IMAPSyncResult * IMAPSession::syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind, IndexSet * uids, uint64_t modseq, IMAPProgressCallback * progressCallback, ErrorCode * pError) diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h index 9cf72843..5a052744 100644 --- a/src/core/imap/MCIMAPSession.h +++ b/src/core/imap/MCIMAPSession.h @@ -122,6 +122,8 @@ namespace mailcore { virtual uint32_t uidNext(); virtual uint64_t modSequenceValue(); virtual unsigned int lastFolderMessageCount(); + virtual unsigned int lastFolderUnseenCount(); + virtual bool isIdleEnabled(); virtual bool isXListEnabled(); @@ -157,6 +159,8 @@ namespace mailcore { uint32_t mUIDNext; uint64_t mModSequenceValue; unsigned int mFolderMsgCount; + unsigned int mFolderUnseenCount; + unsigned int mLastFetchedSequenceNumber; String * mCurrentFolder; pthread_mutex_t mIdleLock; -- cgit v1.2.3