added displayfrom and displayto search criteria#721
Open
FlexibleDevs wants to merge 6 commits intomscdex:masterfrom
Open
added displayfrom and displayto search criteria#721FlexibleDevs wants to merge 6 commits intomscdex:masterfrom
FlexibleDevs wants to merge 6 commits intomscdex:masterfrom
Conversation
Owner
|
We need to be more strict and ensure that the server supports the |
Author
|
I see, it's correct. Let me know, Filippo |
Author
|
Modified the sort switch to control server capability. Filippo |
|
+1 |
Owner
|
It looks like there are other non-related changes now? |
|
This should be the final patch index 619862f..c9119f3 100644
--- a/lib/Connection.js
+++ b/lib/Connection.js
@@ -917,6 +917,7 @@ Connection.prototype.sort = function(sorts, criteria, cb) {
};
Connection.prototype._sort = function(which, sorts, criteria, cb) {
+ let displaySupported = false;
if (this._box === undefined)
throw new Error('No mailbox is currently selected');
else if (!Array.isArray(sorts) || !sorts.length)
@@ -925,6 +926,9 @@ Connection.prototype._sort = function(which, sorts, criteria, cb) {
throw new Error('Expected array for search criteria');
else if (!this.serverSupports('SORT'))
throw new Error('Sort is not supported on the server');
+ if(this.serverSupports("SORT=DISPLAY")){
+ displaySupported = true;
+ }
sorts = sorts.map(function(c) {
if (typeof c !== 'string')
@@ -945,6 +949,12 @@ Connection.prototype._sort = function(which, sorts, criteria, cb) {
case 'SUBJECT':
case 'TO':
break;
+ case 'DISPLAYFROM':
+ case 'DISPLAYTO':
+ if(!displaySupported){
+ throw new Error("Unexpected sort criteria: " + c);
+ }
+ break;
default:
throw new Error('Unexpected sort criteria: ' + c);
} |
|
+1 |
1 similar comment
|
+1 |
|
+1 I'm using Dovecot as IMAP server and it support this IMAP extension. Since Dovecot have a 75% market share is a very useful patch for many people. |
|
+1 |
1 similar comment
|
+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, I'm Filippo and i'm using your amazing lib for connecting my project to an imap server.
I've modified the list of sort criteria to implement the DISPLAYFROM and TO (as described here: https://tools.ietf.org/html/rfc5957). I think that the 2 added lines should be enough to implement that.
Could you review my branch and eventually merge it into master ?
Thanks for you work, I'm happy to contribute.
Let me know,
Filippo