aboutsummaryrefslogtreecommitdiffstats
path: root/worker/types/messages.go
Commit message (Collapse)AuthorAgeFilesLines
* model: change flags array to bitmaskRobin Jarry2023-01-041-2/+2
| | | | | | | Using a list of integers is not optimal. Use a bit mask instead. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* types: remove unused FullMessage.Info fieldRobin Jarry2022-10-251-1/+0
| | | | | | | | This field is always nil. Either we should initialize it to a proper value or remove it. Since it is unused, remove it. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* aerc: use single event loopTim Culverhouse2022-10-071-0/+11
| | | | | | | | | Combine tcell events with WorkerMessages to better synchronize state with IO and UI. Remove Tick loop for rendering. Use events to trigger renders. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: stop checkmail if there are pending actionskt programs2022-09-291-0/+5
| | | | | | | | | | | | | Pass message containing remaining directories to check. Account widget will recursively call CheckMail with the remaining directories until a Done message is returned. Only needed for IMAP worker as other workers run check-mail-cmd in a separate goroutine. Suggested-By: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: kt programs <ktprograms@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* cache: fetch flags from UITim Culverhouse2022-09-201-1/+2
| | | | | | | | | | | | | | | When cached headers are fetched, an action is posted back to the Worker to immediately fetch the flags for the message from the server (we can't know the flags state, therefore it's not cached). When scrolling, a lag occurs when loading cached headers because the n+1 message has to wait for the flag request to return before the cached headers are retrieved. Collect the message UIDs in the UI that need flags, and fetch them based off a debounce timer in a single request. Post the action from the UI to eliminate an (ugly) go routine in the worker. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* worker: introduce MoveMessages typeTim Culverhouse2022-08-221-0/+12
| | | | | | | | Introduce a MoveMessages worker message to use for improved message moving in subsequent patches. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: enable filtering of server-side threadsTim Culverhouse2022-07-101-2/+4
| | | | | | | | | | | | | | This patch enables the filtering of a threaded view which uses server-built threads. Filtering is done server-side, in order to preserve the use of server-built threads. In adding this feature, the filtering of notmuch folders was brought up to feature parity with the other workers. The filters function the same (ie: they can be stacked). The notmuch filters, however, still use notmuch syntax for the filtering. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: add option to cache headersTim Culverhouse2022-06-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add option to cache headers for imap accounts. Cache db is located at $XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale entries when aerc is first opened. Two new account level configuration options are introduced: * cache-headers (Default: false) * cache-max-age (Default: 30 days (720 hours)) The change in worker/imap/open.go is to set the selected directory. This is required to access the UIDVALIDITY field, which is used in combination with the message ID to form the key for use in the cache db. The key structure is: "header.{UIDVALIDITY}.{UID}" Where reasonable, cache does not stop aerc from running. In general, if there is an error in the cache, aerc should continue working as usual. Errors are either displayed to the user or logged. All messages are stored without flags, and when retrieved have the flags set to SEEN. This is to prevent UI flashes. A new method to FetchMessageFlags is introduced to update flags of cached headers. This is done asynchronously, and the user will see their messages appear and then any flags updated. The message will initially show as SEEN, but will update to unread. I considered updating the cache with the last-known flag state, however it seems prudent to spare the R/W cycle and assume that - eventually - all messages will end up read, and if it isn't the update will occur rather quickly. Note that leveldb puts a lock on the database, preventing multiple instances of aerc from accessing the cache at the same time. Much of this work is based on previous efforts by Vladimír Magyar. Implements: https://todo.sr.ht/~rjarry/aerc/2 Thanks: Vladimír Magyar <vladimir@mgyar.me> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: inwit <inwit@sindominio.net> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirlist: update RUE counts for imap/maildir on move|copy|delete|archiveTim Culverhouse2022-06-071-0/+6
| | | | | | | | | | | | | | | | | | | When moving/copying/deleting/archiving a message in imap, the RUE counts displayed in the dirlist would not update properly. Maildir has (had) an implementation that recounts the entire directory and updates the DirectoryInfo after one of these actions. This patch implements a more efficient method of updating, and also enables it to apply to IMAP without any additional requests. Upon completion of the action, the counts are manually updated with the count of messages in the action and recent and/or unseen states of those messages. This is more efficient for maildir, because we aren't counting everything in the store. For IMAP, we get the updates for free because we are only performing the update after confirmation from the server that the action has happened. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* feat: add background mail polling option for all workersTim Culverhouse2022-05-311-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Check for new mail (recent, unseen, exists counts) with an external command, or for imap with the STATUS command, at start or on reconnection and every X time duration IMAP: The selected folder is skipped, per specification. Additional config options are included for including/excluding folders explicitly. Maildir/Notmuch: An external command will be run in the background to check for new mail. An optional timeout can be used with maildir/notmuch. Default is 10s New account options: check-mail check-mail-cmd (maildir/notmuch only) check-mail-timeout (maildir/notmuch only), default 10s check-mail-include (IMAP only) check-mail-exclude (IMAP only) If unset, or set less than or equal to 0, check-mail will be ignored Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: auto-reconnects on connection errorKoni Marti2022-01-191-0/+4
| | | | | | | | | if the worker emits a connection error, the ui will automatically send back a reconnect command. The worker then establishes a new connection. Auto-reconnect is disabled when the user sends the disconnect command. Fixes: https://todo.sr.ht/~rjarry/aerc/1 Signed-off-by: Koni Marti <koni.marti@gmail.com>
* imap: emits connection error on logoutKoni Marti2022-01-191-0/+5
| | | | | | | | implements a new connection error message. This allows the worker to emit a connection-related error message to the ui when the imap client closes the loggedOut channel. Signed-off-by: Koni Marti <koni.marti@gmail.com>
* messages: allow displaying email threadsy0ast2021-11-131-0/+10
| | | | | | | | | | | | | Display threads in the message list. For now, only supported by the notmuch backend and on IMAP when the server supports the THREAD extension. Setting threading-enable=true is global and will cause the message list to be empty with maildir:// accounts. Co-authored-by: Kevin Kuehler <keur@xcf.berkeley.edu> Co-authored-by: Reto Brunner <reto@labrat.space> Signed-off-by: Robin Jarry <robin@jarry.cc>
* go.mod: change base git urlRobin Jarry2021-11-051-2/+2
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* Add support for :rmdirARaspiK2020-08-191-0/+6
| | | | | | | | | | | | | | | | | | | | | The `:rmdir` command removes the current directory (`-f` is required if the directory is not empty). This is not supported on the notmuch backend. An issue with the maildir backend is that some sync programs (e.g. offlineimap) may recover the directory after it is deleted. They need to specifically be configured to accept deletions, or special commands need to be executed (e.g. `offlineimap --delete-folder`) to properly delete folders. A danger of using this on the IMAP backend is that it is possible for a new message to be added to the directory and for aerc to not show it immediately (due to a slow connection) - using `:rmdir` at this moment (with `-f` if the directory already contains messages) would delete the directory and the new message that just arrived (and all other contents). This is documented in aerc(1) so that users are aware of possible risks.
* run go fmtReto Brunner2020-07-171-2/+2
|
* Add additional flagging functionalityARaspiK2020-07-081-3/+4
| | | | | | | | | | | | | | More mail flags can now be set, unset, and toggled, not just the read/seen flag. This functionality is implemented with a new `:flag` and `:unflag` command, which are extensions to the matching `:read` and `:unread` commands, adding support for different flags. In fact, the `read`/`unread` commands are now recognized aliases to `flag`/`unflag`. The new commands are also well documented in aerc(1). The change mostly extends the previous read/unread setting functionality by adding a selection for the flag to change.
* Set AnsweredFlag on successful replySrivathsan Murali2020-05-251-0/+6
|
* imap: Remove FetchMessageBodyPart.{Encoding,Charset}Reto Brunner2020-05-161-4/+2
| | | | Fixes https://todo.sr.ht/~sircmpwn/aerc2/352 exactly as suggested by emersion.
* store.FetchFull: Change callback type to expose entire messageBen Fiedler2020-05-011-0/+1
| | | | | This is a prerequisite for allowing the FetchFull message to return both the message content and the message headers.
* Mark sent messages as "seen" in maildirGalen Abell2020-03-031-1/+1
| | | | | | | - Add maildir flags to complement a messages imap flags - Set the "seen" flag on sent messages when using the maildir backend - Cleanup AppendMessage interface to use models.Flag for both IMAP and maildir
* remove the dirInfoUpdateRequest functionalityReto Brunner2020-02-291-7/+0
| | | | | The notmuch worker followed suit in handling the dirInfo submission manually. That removes the last user so we might as well remove the functionality.
* Request DirInfo whenever the unread count may have changedReto Brunner2020-02-161-0/+7
| | | | | | | Actions such as read / unread or the addition of new messages do change the read/unread/recent count. Hence we request an update from the workers. Workers going over the network should probably cache the information and invalidate it only if necessary
* FetchBodyParts: decode source in the workersReto Brunner2020-01-051-2/+4
| | | | | | | Previously the workers returned a mixture of decoded / encoded parts. This lead to a whole bunch of issues. This commit changes the msgviewer and the commands to assume parts to already be decoded
* add LabelList eventReto Brunner2019-12-211-0/+5
|
* Add sorting functionalityJeffas2019-09-201-0/+1
| | | | | | | | There is a command and config option. The criteria are a list of the sort criterion and each can be individually reversed. This only includes support for sorting in the maildir backend currently. The other backends are not supported in this patch.
* Add modify-labels commandReto Brunner2019-09-121-0/+7
| | | | | This adds the event type as well as the command implementation, but no backend supports it yet.
* extract search criteria parsing into the backendsReto Brunner2019-08-291-3/+1
|
* #190 Handle gmail duplicate folderDaniel Bridges2019-07-111-0/+1
|
* Use []uint32 instead of imap.SeqSetBen Burwell2019-07-081-5/+5
| | | | | | | | A sequence-set is an IMAP-specific implementation detail. Throughout the UI, aerc simply operates using lists of opaque identifiers. In order to loosen the coupling between the UI and IMAP in particular, replace most usages of imap.SeqSet with []uint32, leaving the translation to a SeqSet to the IMAP backend as needed.
* Factor UI models out of the worker message packageBen Burwell2019-07-081-19/+6
| | | | | | | | Before, the information needed to display different parts of the UI was tightly coupled to the specific messages being sent back and forth to the backend worker. Separating out a models package allows us to be more specific about exactly what a backend is able to and required to provide for the UI.
* worker/imap: implement searchDrew DeVault2019-06-241-0/+10
|
* Add :read and :unread commandsDrew DeVault2019-06-091-0/+7
|
* Add archive commandRobert Günzler2019-06-091-0/+5
| | | | | | | | | | | | | | | 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.
* implements ability to view headers in message viewYash Srivastav2019-06-071-0/+2
|
* Remove worker callbacks when Done is receivedDrew DeVault2019-06-021-1/+1
|
* Flesh out multipart switcherDrew DeVault2019-05-201-1/+1
|
* Verify TLS certificatesDrew DeVault2019-05-201-11/+0
| | | | | | 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.
* worker/types/worker: make ID allocation atomicSimon Ser2019-05-191-5/+5
| | | | | | | | 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.
* s/aerc2/aerc/gDrew DeVault2019-05-171-1/+1
|
* Copy sent emails to the Sent folderDrew DeVault2019-05-151-0/+20
| | | | Or rather, to a user-specified folder
* Implement move, mv commandsDrew DeVault2019-05-141-6/+0
|
* Implement :copy (aka :cp)Drew DeVault2019-05-141-0/+12
|
* Rename FetchMessageBodies to FetchFullMessagesDrew DeVault2019-03-311-2/+2
|
* Don't parse mail in worker; send a reader insteadDrew DeVault2019-03-311-4/+3
|
* Pull BodyStructure up from IMAP workerDrew DeVault2019-03-311-5/+19
|
* Add body fetching support codeDrew DeVault2019-03-291-2/+7
|
* Implement :delete-messageDrew DeVault2019-03-201-0/+10
|
* Implement message store side of message fetchingDrew DeVault2019-03-141-2/+2
|
* Fetch valid UIDs from server after opening dirDrew DeVault2019-03-101-0/+33
|