diff options
-rw-r--r-- | lib/msgstore.go | 2 | ||||
-rw-r--r-- | widgets/account.go | 54 | ||||
-rw-r--r-- | worker/notmuch/worker.go | 7 |
3 files changed, 34 insertions, 29 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index 7b86b83c..f81851e2 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -75,7 +75,6 @@ type MessageStore struct { const MagicUid = 0xFFFFFFFF func NewMessageStore(worker *types.Worker, - dirInfo *models.DirectoryInfo, defaultSortCriteria []*types.SortCriterion, thread bool, clientThreads bool, clientThreadsDelay time.Duration, reverseOrder bool, reverseThreadOrder bool, sortThreadSiblings bool, @@ -88,7 +87,6 @@ func NewMessageStore(worker *types.Worker, return &MessageStore{ Deleted: make(map[uint32]interface{}), - DirInfo: *dirInfo, Messages: make(map[uint32]*models.MessageInfo), selectedUid: MagicUid, diff --git a/widgets/account.go b/widgets/account.go index 40ae73f3..3ba511de 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -276,36 +276,36 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { acct.checkMailOnStartup() } } + case *types.Directory: + name := msg.Dir.Name + store := lib.NewMessageStore(acct.worker, + acct.GetSortCriteria(), + acct.dirlist.UiConfig(name).ThreadingEnabled, + acct.dirlist.UiConfig(name).ForceClientThreads, + acct.dirlist.UiConfig(name).ClientThreadsDelay, + acct.dirlist.UiConfig(name).ReverseOrder, + acct.dirlist.UiConfig(name).ReverseThreadOrder, + acct.dirlist.UiConfig(name).SortThreadSiblings, + func(msg *models.MessageInfo) { + err := hooks.RunHook(&hooks.MailReceived{ + MsgInfo: msg, + }) + if err != nil { + msg := fmt.Sprintf("mail-received hook: %s", err) + acct.aerc.PushError(msg) + } + }, func() { + if acct.dirlist.UiConfig(name).NewMessageBell { + acct.host.Beep() + } + }, + acct.updateSplitView, + ) + store.SetMarker(marker.New(store)) + acct.dirlist.SetMsgStore(msg.Dir.Name, store) case *types.DirectoryInfo: if store, ok := acct.dirlist.MsgStore(msg.Info.Name); ok { store.Update(msg) - } else { - name := msg.Info.Name - store = lib.NewMessageStore(acct.worker, msg.Info, - acct.GetSortCriteria(), - acct.dirlist.UiConfig(name).ThreadingEnabled, - acct.dirlist.UiConfig(name).ForceClientThreads, - acct.dirlist.UiConfig(name).ClientThreadsDelay, - acct.dirlist.UiConfig(name).ReverseOrder, - acct.dirlist.UiConfig(name).ReverseThreadOrder, - acct.dirlist.UiConfig(name).SortThreadSiblings, - func(msg *models.MessageInfo) { - err := hooks.RunHook(&hooks.MailReceived{ - MsgInfo: msg, - }) - if err != nil { - msg := fmt.Sprintf("mail-received hook: %s", err) - acct.aerc.PushError(msg) - } - }, func() { - if acct.dirlist.UiConfig(name).NewMessageBell { - acct.host.Beep() - } - }, - acct.updateSplitView, - ) - store.SetMarker(marker.New(store)) - acct.dirlist.SetMsgStore(msg.Info.Name, store) } case *types.DirectoryContents: if store, ok := acct.dirlist.SelectedMsgStore(); ok { diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index 81f38d1c..687d3f67 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -318,6 +318,13 @@ func (w *worker) handleOpenDirectory(msg *types.OpenDirectory) error { if !ok { q = msg.Directory isDynamicFolder = true + w.w.PostMessage(&types.Directory{ + Message: types.RespondTo(msg), + Dir: &models.Directory{ + Name: q, + Attributes: []string{}, + }, + }, nil) } } w.query = q |