summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/account/sort.go6
-rw-r--r--lib/msgstore.go5
-rw-r--r--worker/imap/open.go2
3 files changed, 13 insertions, 0 deletions
diff --git a/commands/account/sort.go b/commands/account/sort.go
index e9ee4a3..f8cb94c 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -72,6 +72,12 @@ func (Sort) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Messages still loading.")
}
+ if c := store.Capabilities(); c != nil {
+ if !c.Sort {
+ return errors.New("Sorting is not available for this backend.")
+ }
+ }
+
var err error
var sortCriteria []*types.SortCriterion
if len(args[1:]) == 0 {
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 783ce5d..c9f8fd9 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -847,3 +847,8 @@ func (store *MessageStore) FindIndexByUid(uid uint32) int {
}
return -1
}
+
+// Capabilities returns a models.Capabilities struct or nil if not available
+func (store *MessageStore) Capabilities() *models.Capabilities {
+ return store.DirInfo.Caps
+}
diff --git a/worker/imap/open.go b/worker/imap/open.go
index 636b936..2d76f43 100644
--- a/worker/imap/open.go
+++ b/worker/imap/open.go
@@ -53,6 +53,8 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents(
if err != nil {
// Non fatal, but we do want to print to get some debug info
logging.Errorf("can't check for SORT support: %v", err)
+ } else if len(sortCriteria) > 0 {
+ logging.Warnf("SORT is not supported but requested: list messages by UID")
}
uids, err = imapw.client.UidSearch(searchCriteria)
}