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

UniqueIds returned by the Mailfolder.Sort are always sorted in ascending order #789

Closed
mad0715 opened this issue Dec 18, 2018 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@mad0715
Copy link

mad0715 commented Dec 18, 2018

Describe the bug
The uniqueIds returned by the Mailfolder.Sort are always sorted in ascending order and not in the order they were sent by the server.

To Reproduce
Use mailfolder.Sort to get the sorted Uid list:

var uniqueIds = mailfolder.Sort(SearchQuery.All, new List<OrderBy> { OrderBy.ReverseDate });

Expected behavior
Uids should be in the same order as they were sent by the imap server.

Imap log:

C: A00000006 UID SORT (REVERSE DATE) US-ASCII ALL
S: * SORT 13 12 11 10 9 8 7 6 5 4 3 1
S: A00000006 OK UID SORT completed

The sort order is set in the method ImapFolder.Search.SearchMatchesAsync. Maybe it should be set to none if the UntaggedHandlers has a key like "SORT"?

@mad0715 mad0715 changed the title Imap sort returns UniqueIds are always sorted in ascending order Imap sort returned UniqueIds are always sorted in ascending order Dec 18, 2018
@mad0715 mad0715 changed the title Imap sort returned UniqueIds are always sorted in ascending order UniqueIds returned by the Mailfolder.Sort are always sorted in ascending order Dec 18, 2018
jstedfast added a commit that referenced this issue Dec 18, 2018
If the IMAP server did not support ESEARCH, the order of the returned
UniqueIds was always sorted in ascending order even if that is not
the order of the UIDs returned by the IMAP server in the untagged
`SORT` response.

Fixes issue #789
@jstedfast
Copy link
Owner

You are correct. Thanks for the bug report!

@jstedfast jstedfast added the bug Something isn't working label Dec 18, 2018
@jstedfast
Copy link
Owner

I'll try to make a new release either late December (week or so after Christmas) or sometime in early January. I probably won't have time until then to make a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants