aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-05-30 07:34:18 -0500
committerRobin Jarry <robin@jarry.cc>2022-05-31 14:32:51 +0200
commit2551dd1bfa2c68a6ba8644a0c45b24fce8874674 (patch)
treeed752720e1a08708505fd9574b49629d5df84997 /lib
parent30d57889741cfa8284eec9b32b29144fe01002a2 (diff)
downloadaerc-2551dd1bfa2c68a6ba8644a0c45b24fce8874674.tar.gz
feat: add background mail polling option for all workers
Check for new mail (recent, unseen, exists counts) with an external command, or for imap with the STATUS command, at start or on reconnection and every X time duration IMAP: The selected folder is skipped, per specification. Additional config options are included for including/excluding folders explicitly. Maildir/Notmuch: An external command will be run in the background to check for new mail. An optional timeout can be used with maildir/notmuch. Default is 10s New account options: check-mail check-mail-cmd (maildir/notmuch only) check-mail-timeout (maildir/notmuch only), default 10s check-mail-include (IMAP only) check-mail-exclude (IMAP only) If unset, or set less than or equal to 0, check-mail will be ignored Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go4
-rw-r--r--lib/statusline/state.go6
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index dc18137f..6774f59f 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -193,7 +193,9 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.DirectoryInfo:
store.DirInfo = *msg.Info
- store.Sort(store.sortCriteria, nil)
+ if !msg.SkipSort {
+ store.Sort(store.sortCriteria, nil)
+ }
update = true
case *types.DirectoryContents:
newMap := make(map[uint32]*models.MessageInfo)
diff --git a/lib/statusline/state.go b/lib/statusline/state.go
index 3fecd0fe..54746fbd 100644
--- a/lib/statusline/state.go
+++ b/lib/statusline/state.go
@@ -64,9 +64,13 @@ func (s *State) SetWidth(w int) bool {
return changeState
}
+func (s *State) Connected() bool {
+ return s.acct.Connected
+}
+
type SetStateFunc func(s *State, folder string)
-func Connected(state bool) SetStateFunc {
+func SetConnected(state bool) SetStateFunc {
return func(s *State, folder string) {
s.acct.ConnActivity = ""
s.acct.Connected = state