Commit graph

8 commits

Author SHA1 Message Date
c5cd2b6a8d
mail: Enable direct pgp decryption
When called over systemd, pass will not display a pin-entry field to
decrypt the necessary passwords for email synching.

This prepares automatic background synching.
2020-09-24 14:22:03 +02:00
b176b61b52
mail: Move rollup data to XDG data dir
Moved the file containing sender addresses to filter to the
XDG_DATA_HOME directory (usually `~/.local/share/imapfilter/`) where it
will look for a `rollup.txt` file.

This is to separate the configuration values (the filters themselves)
somewhat from the data they act on (values to filter and searches to
accomplish).
2020-09-23 17:55:08 +02:00
2b289a953b
mail: Add IDLE mode watching
Added option to imapfilter to continuously run in the background and
watch for new incoming mail through the Imap IDLE mode.

By default it will run as one-shot and just sort mail according to
currently active filters. But if enabling the `CONTINUOUS` mode in
config file, it will instead keep running and continuously check for
arriving mail to filter.

This could, in the future, be useful to run on a separate server which
watches remote imap folders and pulls them down to its own storage.

For local usage, a systemd service and timer unit are probably more
suitable than the daemonization of imapfilter.
2020-09-23 17:55:07 +02:00
bf80c9ecf3
mail: Read mails to roll up from external file
Changed rollup filter to read the files to be rolled up from 'rollup.txt'
file in the imapfilter configuration directory. (by default in XDG
basedir-compliant directory such as '~/.config/imapfilter/rollup.txt')

The file consists of sender addresses with a single address on each
line.
2020-09-23 17:55:07 +02:00
698e8a63ee
mail: Refactor imapfilter configuration
Make imapfilter configuraiton more flexible to prepare for different
filters being added.

The program will expect its configuration and filter files to be located
in XDG directory structure, within the sub-folder 'filters'.
E.g.: `/home/user/.config/imapfilter/filters`

A global `configDir` variable is available for any filters, which
describes the path to the current configuration directory.
The path to the filter directory can also be accessed through
`getFilterDir()`.

The configuration runs `accounts.lua` and expects it to return a table
with the individual imap boxes as top level entries, so that filters can
then loop through each account as needed.

Lastly, the config will automatically apply all filters found in the
filters sub-folder. A filter is a '.lua' file within the directory.
Other files can exist in the dir and will not be touched.
2020-09-23 17:55:07 +02:00
0d00953f30
mail: Add afew automatic tagging
Added hook for afew tagging for local mail.

Mail will now arrive tagged only as 'new' by notmuch.
afew will then tag the mail accordingly as inbox unread when it is
personal mail.

It will additionally filter out anything marked as spam, or e-mail
containing a List-Id header, which will be tagged as 'list' and not
arrive in the inbox. This filters out anything arriving from a mailing
list from the inbox.

Removed the archive tag -- anything not in the inbox, and not marked as
list is instead used as an automatic archive.

Mail sent by myself will be automatically tagged as 'sent' and also not
show up in the mailbox.
2020-09-23 17:55:06 +02:00
5a256186c2
mail: Add basic filtering system
imapfilter now looks for account information in an accounts.lua file in
its configuration directory -- the file should return account
information as a table with each account being a top-level entry in the
table.

A sample spam-moving script has been supplied:
For now, it will take a list of sender addresses and put everything in
the list from the inbox into the dump directory.

An example list of senders has been supplied for testing purposes, but
this should eventually be read from a file containing an extensible list
of senders (and perhaps even different properties such as subject, etc.)

The imapfilter xdg alias has been fixed.

Coherence between the imap folder structure and notmuch tagging system
still has to be achieved -- either by aerc using the folder structure as
a query map, or notmuch tags automatically being applied for specific
imap filtering options.
2020-09-23 17:55:06 +02:00
3bbb7d0360
mail: Add checkmail routine
Added script to call for checking mail. Will run individual pre- and
post-hooks. (By default, imapfilter and notmuch update.)

Simple options can be changed through environment variables:

Hooks can be set to different scripts with MBSYNC_PRE and
MBSYNC_POST, respectively.

Will also run mbsync repeatedly, until it exits without error. By
default it will try running it 3 times before giving up, this can be set
with MBSYNC_MAX_TRIES.

No functional imapfilters have been added yet.

mbsync and imapfilter both adhere to the XDG base directory layout
(somewhat), checking for their option files in .config/{isync,imapfilter}
respectively.

Everything still pending changes, the mail eco-system is hard to
wrap one's head around.
2020-09-23 17:55:05 +02:00