Commit Graph

279 Commits

Author SHA1 Message Date
Drew DeVault f42724caf3 Install default configs to XDG config if not found 2019-05-22 12:35:44 -04:00
Drew DeVault 80704f2422 Add GOFLAGS variable to Makefile 2019-05-22 12:23:24 -04:00
Drew DeVault 9b19e3ad05 Show account wizard if no accounts configured 2019-05-22 11:35:55 -04:00
Drew DeVault 1a45b793c7 Implement :help 2019-05-22 11:17:52 -04:00
Drew DeVault 58bc15b472 Implement opening tutorial after account wizard 2019-05-22 11:13:55 -04:00
Drew DeVault 937b33c850 Write new accounts to config and open tab 2019-05-22 10:40:08 -04:00
Drew DeVault a7341aff21 Fix always showing last account tab 2019-05-22 10:39:52 -04:00
Drew DeVault 4d6e665204 Remove excess padding from incoming config page 2019-05-21 17:00:35 -04:00
Drew DeVault 6811143925 New account wizard, part one 2019-05-21 16:53:50 -04:00
Drew DeVault 176245208d Use kebab-case for cred-cmds 2019-05-21 14:31:14 -04:00
Drew DeVault 2dc436555d Load IMAP worker for imap+insecure 2019-05-20 19:28:04 -04:00
Drew DeVault cc90cd2161 Pass ServerName to tls.Config for SMTP 2019-05-20 17:25:12 -04:00
Drew DeVault 33f2d4f9ee Show unsupported mimetype message in red 2019-05-20 17:05:37 -04:00
Drew DeVault d224487b68 Show attachment names in multipart view 2019-05-20 17:03:37 -04:00
Drew DeVault 0897413a3e Implement :next-part, :prev-part 2019-05-20 16:49:39 -04:00
Drew DeVault 511fea3944 Flesh out multipart switcher 2019-05-20 16:43:08 -04:00
Drew DeVault 3376f926ed Refactor message part into dedicated widget 2019-05-20 15:03:47 -04:00
Drew DeVault 5de1bb8cc3 Verify TLS certificates
I was partway done implementing a UI for users to approve untrusted
certs with, but let's just make them configure their servers right
instead.
2019-05-20 14:03:00 -04:00
Drew DeVault a9aebe11d7 asdf 2019-05-20 14:01:59 -04:00
Drew DeVault 22cc40f4d4 pipe.go: let tab widget handle ellipsis 2019-05-20 14:01:13 -04:00
Drew DeVault ef57300faf Missed a spot 2019-05-19 18:25:38 -04:00
Drew DeVault 455c6f0b77 Rename :delete-message et al to :delete et al 2019-05-19 18:23:34 -04:00
Drew DeVault fa5d8d7a00 Advance cursor after :delete and :move
So that you can repeat the action on the next message if appropriate
2019-05-19 18:21:02 -04:00
Drew DeVault f9251c2344 Reset message list cursor when switching stores 2019-05-19 18:18:48 -04:00
Drew DeVault 13032734cd Advance message list cursor when messages arrive 2019-05-19 18:18:48 -04:00
Amin Bandali 588a6c785b Implement :pwd command 2019-05-19 14:36:11 -04:00
Simon Ser 248345d875 worker/types/worker: remove mutex
Worker.callbacks contains two types of callbacks: some are action callbacks,
some are message callbacks. Each of those is access from one side of the
communication channel (UI goroutine vs. worker goroutine).

Instead of using a channel, we can use two different maps for each kind. This
simplifies the code and also ensures we don't call an action callback instead
of a message callback (or the other way around).
2019-05-19 11:51:25 -04:00
Simon Ser f27db33305 worker/types/worker: make ID allocation atomic
Message IDs are allocated for both messages from UI to workers and the other
way around. Hence, the global nextId variable is accessed from multiple
goroutines.

Instead, use atomic to access the global counter.
2019-05-19 11:51:22 -04:00
Simon Ser 34dd6bc635 worker/types/worker: set ID before sending message
The previous code set the message ID after sending it, which could result in
the receiver reading the ID before it's set.
2019-05-19 11:51:20 -04:00
Simon Ser 7c6325977b lib/ui/ui: use atomic instead of channel
This makes it so an atomic `invalid` value is used instead of an unbuffered
channel. When many invalidations kick in, a lot of values were sent to the
channel.

(Since OnInvalidate's callback can be run in any goroutine, we need to be
careful about races here.)
2019-05-19 11:51:18 -04:00
Simon Ser a15ea01cfb Update internal state and draw from the same goroutine
This commit introduces a new Aerc.Tick function that should be called to
refresh the internal state. This in turn makes each AccountView process worker
events.

The UI goroutine repeatedly refreshes the internal state before drawing a new
frame. The reason for this is that many worker messages may need to be
processed for a single frame, and drawing the UI is far slower than refreshing
the internal state. This has been confirmed in my testing (calling Aerc.Tick
only once per frame results in a slower display).

Many synchronization code has been removed. We can now write widgets without
having to care so much about races. The remaining sync users are:

- widgets/spinner: the spinner value is updated from inside an internal
  goroutine
- lib/ui/invalidatable: Invalidate may be called from any goroutine
- lib/ui/grid: same
- lib/ui/ui: an internal goroutine needs read access to UI.exit
- worker/types/worker: Worker.callbacks is used for both worker and UI
  callbacks

The exact goroutine requirements for Drawable have been documented.
2019-05-19 11:51:16 -04:00
Simon Ser 43dba93263 Update go-imap and go-imap-idle
This fixes a race condition in go-imap-idle. See [1].

[1]: 2704abd705
2019-05-19 11:37:40 -04:00
Simon Ser 1da3239345 widgets/terminal: fix damage race condition
Terminal.damage is accessed when drawing and when invalidating the widget. For
this reason we need to protect it with a mutex.

This seems to fix various damage issues I've been experiencing (where some
regions of the terminal weren't correctly repainted).

Race detector trace:

    Read at 0x00c0000c6670 by main goroutine:
      git.sr.ht/~sircmpwn/aerc/widgets.(*Terminal).Draw()
          /home/simon/src/aerc/widgets/terminal.go:292 +0x191
      git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw()
          /home/simon/src/aerc/lib/ui/grid.go:117 +0x575
      git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw()
          /home/simon/src/aerc/lib/ui/grid.go:117 +0x575
      git.sr.ht/~sircmpwn/aerc/widgets.(*MessageViewer).Draw()
          /home/simon/src/aerc/widgets/msgviewer.go:231 +0x253
      git.sr.ht/~sircmpwn/aerc/lib/ui.(*TabContent).Draw()
          /home/simon/src/aerc/lib/ui/tab.go:124 +0x12e
      git.sr.ht/~sircmpwn/aerc/lib/ui.(*Grid).Draw()
          /home/simon/src/aerc/lib/ui/grid.go:117 +0x575
      git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Draw()
          /home/simon/src/aerc/widgets/aerc.go:95 +0x5a
      git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick()
          /home/simon/src/aerc/lib/ui/ui.go:93 +0x1dd
      main.main()
          /home/simon/src/aerc/aerc.go:105 +0x539

    Previous write at 0x00c0000c6670 by goroutine 37:
      git.sr.ht/~sircmpwn/aerc/widgets.(*Terminal).onDamage-fm()
          /home/simon/src/aerc/widgets/terminal.go:429 +0x131
      git.sr.ht/~sircmpwn/go-libvterm._go_handle_damage()
          /home/simon/go/pkg/mod/git.sr.ht/~sircmpwn/go-libvterm@v0.0.0-20190421201021-3184f6f13687/vterm.go:481 +0xf9
      git.sr.ht/~sircmpwn/go-libvterm._cgoexpwrap_5e22200b58b7__go_handle_damage()
          _cgo_gotypes.go:731 +0x58
      runtime.call32()
          /usr/lib/go/src/runtime/asm_amd64.s:519 +0x3a
      git.sr.ht/~sircmpwn/go-libvterm.(*VTerm).Write.func1()
          /home/simon/go/pkg/mod/git.sr.ht/~sircmpwn/go-libvterm@v0.0.0-20190421201021-3184f6f13687/vterm.go:329 +0x9d
      git.sr.ht/~sircmpwn/go-libvterm.(*VTerm).Write()
          /home/simon/go/pkg/mod/git.sr.ht/~sircmpwn/go-libvterm@v0.0.0-20190421201021-3184f6f13687/vterm.go:329 +0x7f
      git.sr.ht/~sircmpwn/aerc/widgets.NewTerminal.func1()
          /home/simon/src/aerc/widgets/terminal.go:131 +0x18c

    Goroutine 37 (running) created at:
      git.sr.ht/~sircmpwn/aerc/widgets.NewTerminal()
          /home/simon/src/aerc/widgets/terminal.go:121 +0x23f
      git.sr.ht/~sircmpwn/aerc/widgets.NewMessageViewer()
          /home/simon/src/aerc/widgets/msgviewer.go:147 +0xfbe
      git.sr.ht/~sircmpwn/aerc/commands/account.ViewMessage()
          /home/simon/src/aerc/commands/account/view-message.go:26 +0x4a4
      git.sr.ht/~sircmpwn/aerc/commands.(*Commands).ExecuteCommand()
          /home/simon/src/aerc/commands/commands.go:47 +0x1f0
      main.main.func1()
          /home/simon/src/aerc/aerc.go:76 +0x205
      git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).BeginExCommand.func1()
          /home/simon/src/aerc/widgets/aerc.go:262 +0x89
      git.sr.ht/~sircmpwn/aerc/widgets.(*ExLine).Event()
          /home/simon/src/aerc/widgets/exline.go:47 +0x222
      git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Event()
          /home/simon/src/aerc/widgets/aerc.go:133 +0x83c
      git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).simulate()
          /home/simon/src/aerc/widgets/aerc.go:126 +0x12a
      git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Event()
          /home/simon/src/aerc/widgets/aerc.go:148 +0x766
      git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick()
          /home/simon/src/aerc/lib/ui/ui.go:86 +0x11b
      main.main()
          /home/simon/src/aerc/aerc.go:105 +0x539
2019-05-19 11:37:38 -04:00
Drew DeVault ca2cd00fe7 Fix scdoc & gofmt issues 2019-05-18 15:34:16 -04:00
Galen Abell b8208509f4 Implement loading passwords from external commands
* Resolves #80
2019-05-18 15:31:38 -04:00
Drew DeVault 98da4c9509 s/aerc2/aerc/g 2019-05-17 20:57:10 -04:00
Drew DeVault 9c10a90cac Document dependencies 2019-05-17 18:15:50 -04:00
Drew DeVault 7f540df29f Install filters to /usr/share/aerc/filters 2019-05-17 13:51:18 -04:00
Drew DeVault 387426923b Add install target to Makefile 2019-05-17 13:48:40 -04:00
Drew DeVault fc719e47c4 Add man pages 2019-05-17 13:46:26 -04:00
Drew DeVault fcdcd32de7 Remove unimplemented color configuration
Will probably end up doing this differently anyway
2019-05-17 11:52:38 -04:00
Drew DeVault 89ffd8653d Implement ui.empty-message config option
Also removes some options that aren't going to be supported any time
soon.
2019-05-17 11:42:34 -04:00
Drew DeVault 2ffbe7a6cd Remove debug logging 2019-05-17 11:28:32 -04:00
Drew DeVault eec2bacede Refactor STARTTLS to prevent downgrade attacks 2019-05-17 11:22:30 -04:00
Drew DeVault 23650ac0c7 Fix date header on outgoing emails 2019-05-17 11:05:21 -04:00
Drew DeVault e436780b47 s/Sent/Message sent/ 2019-05-16 23:57:38 -04:00
Reto Brunner b275a394e2 Abort if accounts.conf is world readable
Fixes #32
2019-05-16 17:26:35 -04:00
Drew DeVault fb3826cee5 Revert "Abort if accounts.conf is world readable"
This reverts commit a755608ef9.
2019-05-16 16:40:29 -04:00
Drew DeVault ff51625513 Revert "s/aerc.conf/address.conf/ in permission check"
This reverts commit 66ba099ca0.
2019-05-16 16:40:06 -04:00
Cole Helbling 66ba099ca0 s/aerc.conf/address.conf/ in permission check
Small typo in a recent commit: should abort if accounts.conf is world
readable, not aerc.conf.
2019-05-16 16:28:49 -04:00