Implement default in accounts.conf
This commit is contained in:
parent
b181e0449d
commit
77c76ba462
2 changed files with 8 additions and 5 deletions
|
@ -22,6 +22,7 @@ type UIConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type AccountConfig struct {
|
type AccountConfig struct {
|
||||||
|
Default string
|
||||||
Name string
|
Name string
|
||||||
Source string
|
Source string
|
||||||
Folders []string
|
Folders []string
|
||||||
|
@ -63,14 +64,16 @@ func loadAccountConfig(path string) ([]AccountConfig, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sec := file.Section(_sec)
|
sec := file.Section(_sec)
|
||||||
account := AccountConfig{Name: _sec}
|
account := AccountConfig{
|
||||||
|
Default: "INBOX",
|
||||||
|
Name: _sec,
|
||||||
|
Params: make(map[string]string),
|
||||||
|
}
|
||||||
if err = sec.MapTo(&account); err != nil {
|
if err = sec.MapTo(&account); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for key, val := range sec.KeysHash() {
|
for key, val := range sec.KeysHash() {
|
||||||
if key == "source" {
|
if key == "folders" {
|
||||||
account.Source = val
|
|
||||||
} else if key == "folders" {
|
|
||||||
account.Folders = strings.Split(val, ",")
|
account.Folders = strings.Split(val, ",")
|
||||||
} else if key != "name" {
|
} else if key != "name" {
|
||||||
account.Params[key] = val
|
account.Params[key] = val
|
||||||
|
|
|
@ -173,7 +173,7 @@ func (acct *AccountView) connected(msg types.WorkerMessage) {
|
||||||
acct.dirlist.UpdateList(func(dirs []string) {
|
acct.dirlist.UpdateList(func(dirs []string) {
|
||||||
var dir string
|
var dir string
|
||||||
for _, _dir := range dirs {
|
for _, _dir := range dirs {
|
||||||
if _dir == "INBOX" {
|
if _dir == acct.acct.Default {
|
||||||
dir = _dir
|
dir = _dir
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue