Commit Graph

99 Commits

Author SHA1 Message Date
Reto Brunner 99c363b724 Set empty message in dirlist if no folder exist. 2019-06-14 10:42:26 -04:00
Reto Brunner 626f91c483 imap: respect the folder config option 2019-06-14 10:42:24 -04:00
Robert Günzler acfe7d7625 Add archive command
Adds an archive command that moves the current message into the folder
specified in the account config entry.

Supports three layouts at this point:

- flat: puts all messages next to each other
- year: creates a folder per year
- month: same as above, plus folders per month

This also adds a "-p" argument to "cp" and "mv" that works like
"--parents" on mkdir(1). We use this to auto-create the directories
for the archive layout.
2019-06-09 11:33:50 -04:00
Drew DeVault 150a271b36 Add binding to toggle headers 2019-06-07 10:08:09 -04:00
Lucas F. Souza 2279ac3ab3 Skip rendering dirlist if sidebar width is 0 2019-06-07 09:20:06 -04:00
Kevin Kuehler 753adb9069 widget: Add ProvidesMessage interface
Consists of 3 functions
* Store: Access to MessageStore type
* SelectedAccount: Access to Account widget that the target widget
belongs to
* SelectedMessage: Current message (selected in msglist or the one we
are viewing)

Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
2019-06-02 10:16:29 -04:00
Kevin Kuehler 5090a4c802 Only add message to store if store exists
Prevents the program from panicing when changing folders too quickly.
onMessage can race store creation for an AccountView.

Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
2019-06-02 09:43:55 -04:00
Drew DeVault 2dc436555d Load IMAP worker for imap+insecure 2019-05-20 19:28:04 -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
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
Drew DeVault 98da4c9509 s/aerc2/aerc/g 2019-05-17 20:57:10 -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 475b697bdf Implement (basic form) of :reply 2019-05-16 12:15:34 -04:00
Drew DeVault db213fd0ae Implement :copy (aka :cp) 2019-05-14 16:44:59 -04:00
Drew DeVault 026e8a17ca Handle incoming emails gracefully 2019-05-13 20:16:55 -04:00
Drew DeVault 17bd2dc4db Populate "From" header from config for new emails 2019-05-13 16:04:01 -04:00
Simon Ser 5685a17674 lib/ui: introduce Invalidatable
Many Drawable implementations have their own Invalidate and OnInvalidate
functions, with an unexported onInvalidate field. However OnInvalidate and
Invalidate are usually not called in the same goroutine. This results in a race
on this field, e.g.:

    Read at 0x00c000094748 by goroutine 7:
      git.sr.ht/~sircmpwn/aerc2/widgets.NewDirectoryList.func1()
          /home/simon/src/aerc2/widgets/dirlist.go:85 +0x56
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Spinner).Start.func1()
          /home/simon/src/aerc2/widgets/spinner.go:93 +0x1bb

    Previous write at 0x00c000094748 by main goroutine:
      [failed to restore the stack]

    Goroutine 7 (running) created at:
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Spinner).Start()
          /home/simon/src/aerc2/widgets/spinner.go:46 +0x8f
      git.sr.ht/~sircmpwn/aerc2/widgets.NewDirectoryList()
          /home/simon/src/aerc2/widgets/dirlist.go:37 +0x286
      git.sr.ht/~sircmpwn/aerc2/widgets.NewAccountView()
          /home/simon/src/aerc2/widgets/account.go:50 +0x5ca
      git.sr.ht/~sircmpwn/aerc2/widgets.NewAerc()
          /home/simon/src/aerc2/widgets/aerc.go:60 +0x800
      main.main()
          /home/simon/src/aerc2/aerc.go:65 +0x33e

To fix this, introduce a new type, Invalidatable, which protects the field.
Unfortunately the Drawable must be passed to the callback function in
Invalidate, so we still need to re-implement this in each Invalidatable user.
2019-04-27 14:30:28 -04:00
Drew DeVault 0abafa60e1 Make message viewer real, part two 2019-03-31 12:35:51 -04:00
Drew DeVault 2958579ee7 Correct color of error messages 2019-03-30 13:05:00 -04:00
Drew DeVault 77ede6eb5a Add body fetching support code 2019-03-29 22:36:15 -04:00
Drew DeVault 312a53e5ff Implement :delete-message 2019-03-20 23:23:38 -04:00
Drew DeVault 589db742cb Move exline handling up to aerc, add :term 2019-03-17 16:19:15 -04:00
Drew DeVault 1170893e39 Add basic terminal widget 2019-03-17 14:02:33 -04:00
Drew DeVault ef6178a12a Move MessageStore into its own file 2019-03-15 21:36:06 -04:00
Drew DeVault 77c76ba462 Implement default in accounts.conf 2019-03-15 21:33:08 -04:00
Drew DeVault a729179f9f Implement sidebar-width config option 2019-03-15 20:40:28 -04:00
Drew DeVault 24dfc47126 Rig up key bindings 2019-03-15 01:46:14 -04:00
Drew DeVault 24daef89e0 Implement :{next,prev}-message 2019-03-14 23:41:25 -04:00
Drew DeVault 4ec7f5dea5 Use cached message store when re-opening dirs 2019-03-14 22:41:43 -04:00
Drew DeVault 62946ff6c5 Implement :cd command 2019-03-14 22:34:34 -04:00
Drew DeVault 11f0a7267f Implement message store side of message fetching 2019-03-14 21:51:29 -04:00
Drew DeVault 0f8b7a1203 Lay out message list widget basic design 2019-03-14 21:37:00 -04:00
Drew DeVault b3896476a0 Fetch valid UIDs from server after opening dir 2019-03-10 23:45:00 -04:00
Drew DeVault 289e3b09ea Improve error reporting 2019-03-10 21:26:53 -04:00
Drew DeVault d394fd1f3b Flesh out command parsing & handling 2019-03-10 21:23:22 -04:00
Drew DeVault b60999c39e Start building out command subsystem 2019-03-10 21:15:24 -04:00
Elias Naur 607ece8302 Fix build 2019-02-10 17:11:19 -05:00
Drew DeVault 12284487b4 Implement Container interface in widgets/ 2019-01-20 15:08:30 -05:00
Drew DeVault 8492a21a51 Send commands up to the top-level aerc widget 2019-01-14 08:14:03 -05:00
Drew DeVault a409a9faa5 Handle errors from worker initialization 2019-01-13 20:06:18 -05:00
Drew DeVault c047b068c2 Swap message list placeholder for spinner 2019-01-13 20:04:18 -05:00
Drew DeVault f87fe502a6 Handle connection errors properly 2019-01-13 19:41:21 -05:00
Drew DeVault cf66462000 Simplify approach to directory list
This doesn't really need to be abstract tbh
2019-01-13 15:32:52 -05:00
Drew DeVault 755aa9af73 Filter dirlist according to user config 2019-01-13 14:32:22 -05:00
Drew DeVault 2349b7de86 Add directory list widget 2019-01-13 14:26:46 -05:00
Drew DeVault c286d3da6b Move ex line into account 2019-01-13 13:33:43 -05:00
Drew DeVault b76deea963 Move status line into account, update behavior 2019-01-13 13:25:56 -05:00
Drew DeVault 0911cd5050 Initialize worker in account widget 2019-01-13 13:03:28 -05:00
Drew DeVault 648ca983f6 Add basic account widget, populate real acct views 2019-01-13 12:39:06 -05:00