aboutsummaryrefslogtreecommitdiff
path: root/worker
AgeCommit message (Collapse)Author
2019-08-29extract search criteria parsing into the backendsReto Brunner
2019-08-26Notmuch: use adhoc write connection.Reto Brunner
Notmuch only allows a single write connection, all other clients trying to modify the db block. Hence we should only open one when we actually need it. Apparently we also need to refresh the RO DB connection upon modification, else we get stale message tag results
2019-08-26imap worker: do not copy mailbox status mutexWagner Riffel
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-08-08maildir: Preserve flags when copying messagesBen Burwell
2019-08-08Add notmuch backendReto Brunner
This commit introduces the notmuch backend. The backend is conditionally compiled in if the "notmuch" tag is provided. Most of the message types are implemented, with the notable exceptions of DeleteMessages as well as any copy / move / append type. Reason being, that those aren't normally applicable in a notmuch based workflow. Changes v2 --> v3, based on review comments * Use account config for configuration
2019-08-08Extract message parsing to common worker moduleReto Brunner
Things like FetchEntityPartReader etc can be reused by most workers working with raw email files from disk (or any reader for that matter). This patch extract that common functionality in a separate package.
2019-08-08Don't print imap errors to uiJelle Besseling
This fixes ~sircmpwn/aerc2#245. This sets up the imap client to send error messages to the logger of the worker. Errors now end up in the bottom status line. https://todo.sr.ht/~sircmpwn/aerc2/245
2019-08-02Clean maildirs when openedBen Burwell
This removes old aborted deliveries from the tmp directory.
2019-07-19Fix error handling in maildir workerNicolai Dagestad
2019-07-19Register worker in init.Reto Brunner
This allows backends which can't always be compiled due to missing dependencies (say libnotmuch) to be compiled conditionally with buildflags.
2019-07-17maildir: Watch for new messagesBen Burwell
When a directory is opened, start watching its "new" subdirectory for incoming messages using the fsnotify library. When creation events are detected, run the Unseen routine to move the message from new to cur and add new UIDs to the store, updating the UI's list of directory contents as we go.
2019-07-17Fix header decodingBen Burwell
Email headers can be encoded with different charsets, which is signalled using a special character sequence. The go-message package provides two different methods for accessing header values, Get(key) (actually inherited from the embedded textproto.Header) which returns the raw header value and Text(key), which returns the header's value decoded as UTF-8. Before, in the maildir backend, we were using the Get method which sometimes resulted in encoded headers being displayed in the UI. This patch replaces the incorrect usage of Get() with Text().
2019-07-13Fix missing format fields in maildir/container.goDrew DeVault
2019-07-12Implement maildir copyBen Burwell
Create a delivery in the destination directory with the content of the source message.
2019-07-12Add maildir backend workerBen Burwell
Add the initial implementation of a backend for Maildir accounts. Much of the functionality required is implemented in the go-message and go-maildir libraries, so we use them as much as possible. The maildir worker hooks into a new maildir:// URL scheme in the accounts.conf file which points to a container of several maildir directories. From there, the OpenDirectory, FetchDirectoryContents, etc messages work on subdirectories. This is implemented as a Container struct which handles mapping between the symbolic email folder names and UIDs to the concrete directories and file names.
2019-07-11#190 Handle gmail duplicate folderDaniel Bridges
2019-07-11Support imaps with oauthbearer authentication (Gmail)Frode Aannevik
imaps+oauthbearer://user:token@host?token_endpoint=... - the config Source password is used as access token if no token_endpoint parameter is set - the config Source password is used as refresh token if token_endpoint parameter is set, and used to exchange with an access token The implementation has only been tested with Gmail. source = imaps+oauthbearer://{username}:{refersh_token}@imap.gmail.com:993? \ client_id=XX&\ client_secret=XX&\ token_endpoint=https%3A%2F%2Faccounts.google.com%2Fo%2Foauth2%2Ftoken client credentials created with https://console.developers.google.com/apis/credentials refresh token created with https://github.com/google/gmail-oauth2-tools/blob/master/python/oauth2.py rel: https://todo.sr.ht/~sircmpwn/aerc2/42
2019-07-08Factor IMAP-specific structs out of UI modelsBen Burwell
Before, we were using several IMAP-specific concepts to represent information being displayed in the UI. Factor these structures out of the IMAP package to make it easier for other backends to provide the required information.
2019-07-08Use []uint32 instead of imap.SeqSetBen Burwell
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.
2019-07-08Factor UI models out of the worker message packageBen Burwell
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.
2019-07-04Sort out dirstore once and for allDrew DeVault
2019-06-24worker/imap: rig up search directory handlerDrew DeVault
2019-06-24worker/imap: implement searchDrew DeVault
2019-06-14imap: block until directory list is fully receivedDrew DeVault
This fixes issues with INBOX mysteriously not being present at times
2019-06-14imap: respect the folder config optionReto Brunner
2019-06-09Add :read and :unread commandsDrew DeVault
2019-06-09Update our message flags when server updates themDrew DeVault
2019-06-09Add archive commandRobert Günzler
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-08Fetch headers w/peek to leave emails unreadYash Srivastav
2019-06-07implements ability to view headers in message viewYash Srivastav
2019-06-02Wait for listing to complete before sending DoneDrew DeVault
2019-06-02Don't send Done until finished fetching messagesDrew DeVault
2019-06-02Remove worker callbacks when Done is receivedDrew DeVault
2019-05-26Skip non selectable mailboxes in directory listingReto Brunner
If a MailboxInfo has the attribute \Noselect, it is not possible to use this name as a selectable mailbox. Therefore it should not be passed to the directory handlers. The issue pops up if one has a hierarchy like this: INBOX INBOX/lists/stuff INBOX/lists/otherStuff Even though lists is not a valid inbox (doesn't contain mail, only other maildirs) it will show up in the directory listing, when we iterate over the MailboxInfo. It does have the corresponding attribute set though and we can simply filter it out.
2019-05-20Load IMAP worker for imap+insecureDrew DeVault
2019-05-20Flesh out multipart switcherDrew DeVault
2019-05-20Verify TLS certificatesDrew DeVault
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-20asdfDrew DeVault
2019-05-19worker/types/worker: remove mutexSimon Ser
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-19worker/types/worker: make ID allocation atomicSimon Ser
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-19worker/types/worker: set ID before sending messageSimon Ser
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-17s/aerc2/aerc/gDrew DeVault
2019-05-15Copy sent emails to the Sent folderDrew DeVault
Or rather, to a user-specified folder
2019-05-14Implement move, mv commandsDrew DeVault
2019-05-14Implement :copy (aka :cp)Drew DeVault
2019-05-13Handle external message deletionsDrew DeVault
2019-05-13Handle incoming emails gracefullyDrew DeVault
2019-04-29worker/imap: use the IMAP connection from a single goroutineSimon Ser
Unfortunately, the IMAP protocol hasn't been designed to be used from multiple goroutines at the same time. For instance, if you fetch twice the same message from two different goroutines, it's not possible to tell whether the response is for one receiver or the other. For this reason, go-imap clients aren't safe to use from multiple goroutines. This commit changes the IMAP workers to be synchronous again (a command is executed only after the previous one has completed). To use IMAP from different threads, popular clients (e.g. Thunderbird) typically open multiple connections.
2019-04-27worker/types: fix Worker.Callbacks race conditionSimon Ser
Worker.Process* functions were called in different goroutines than Worker.Post*. Protect the map with a mutex. Also make the map unexported to prevent external unprotected accesses. Worker.Process* functions used to delete items from the map. However they didn't delete the element they retrieved: callbacks[msg.InResponseTo()] was read while callbacks[msg] was deleted. I'm not sure I understand why. I tried to delete the element that was accessed - but this broke everything (UI froze at "Connecting..."). I don't believe any elements were actually removed from the map, so the new code just doesn't remove anything.
2019-03-31Make message viewer real, part twoDrew DeVault