diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dirstore.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/dirstore.go b/lib/dirstore.go index bb58a9dc..cc06d579 100644 --- a/lib/dirstore.go +++ b/lib/dirstore.go @@ -1,7 +1,6 @@ package lib type DirStore struct { - dirs []string msgStores map[string]*MessageStore } @@ -10,13 +9,12 @@ func NewDirStore() *DirStore { return &DirStore{msgStores: msgStores} } -func (store *DirStore) Update(dirs []string) { - store.dirs = make([]string, len(dirs)) - copy(store.dirs, dirs) -} - func (store *DirStore) List() []string { - return store.dirs + dirs := []string{} + for dir := range store.msgStores { + dirs = append(dirs, dir) + } + return dirs } func (store *DirStore) MessageStore(dirname string) (*MessageStore, bool) { @@ -27,3 +25,7 @@ func (store *DirStore) MessageStore(dirname string) (*MessageStore, bool) { func (store *DirStore) SetMessageStore(name string, msgStore *MessageStore) { store.msgStores[name] = msgStore } + +func (store *DirStore) Remove(name string) { + delete(store.msgStores, name) +} |