Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the UIDVALIDITY field in IMAP accounts #2330

Closed
wants to merge 1 commit into from

Conversation

rhari991
Copy link

@rhari991 rhari991 commented Mar 3, 2017

Related issue : #1074

I tested this by creating a new folder in my email account, deleting it and recreating it with the same name. All the emails in the folder were reloaded.

@@ -167,6 +167,32 @@ public void open(int mode) throws MessagingException {
}
}

public long getCurrentUidValidity() throws MessagingException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this be done in an easier way by simply calling open if the folder is not yet opened? this already open the folder, and fetches a SelectOrExamineResponse, which can be used to parse and store the uidvalidity, so in cases the folder is already opened we don't have to do any server communication at all

if (previousUidValidity != -1L && currentUidValidity != -1L && currentUidValidity != previousUidValidity) {

//Delete and reload all messages in the local folder
Set<String> localMessageUidSet = localFolder.getAllMessagesAndEffectiveDates().keySet();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be more appropriate to set the UIDs of all these messages to null, and leave deleting them to the normal syncing mechanism that relies on uids to do so. @cketti?

@rhari991
Copy link
Author

rhari991 commented Mar 3, 2017

@Valodim made the change and added unit tests.

@cketti cketti self-assigned this Mar 17, 2017
@rhari991 rhari991 closed this Jul 8, 2017
@rhari991
Copy link
Author

rhari991 commented Jul 8, 2017

Adding this as part of #2607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants