blob: 9da7b3e12f7a8c9413248569a7a91dda575a66e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package main
import (
"time"
"git.sr.ht/~sircmpwn/aerc2/config"
"git.sr.ht/~sircmpwn/aerc2/ui"
"git.sr.ht/~sircmpwn/aerc2/worker"
"git.sr.ht/~sircmpwn/aerc2/worker/types"
)
func main() {
conf, err := config.LoadConfig(nil)
if err != nil {
panic(err)
}
_ui, err := ui.Initialize(conf)
if err != nil {
panic(err)
}
defer _ui.Close()
var workers []worker.Worker
for _, account := range conf.Accounts {
work, err := worker.NewWorker(account.Source)
if err != nil {
panic(err)
}
go work.Run()
work.PostAction(types.Configure{Config: account})
workers = append(workers, work)
_ui.AddTab(ui.NewAccountTab(&account, &work))
}
for !_ui.Exit {
activity := false
for _, worker := range workers {
if msg := worker.GetMessage(); msg != nil {
activity = true
}
}
activity = _ui.Tick() || activity
if !activity {
time.Sleep(100 * time.Millisecond)
}
}
}
|