Commit Graph

181 Commits (master)

Author SHA1 Message Date
Manos Pitsidianakis 843616221e
Add logging level to Generic jobs
Not every job success should be shown to the user, for example updating
the sqlite3 database. So introduce a level to only show relevant
notifications.
2020-08-26 19:17:54 +03:00
Manos Pitsidianakis c6f11fb592
melib: update notify to 4.0.15 2020-08-26 19:17:54 +03:00
Manos Pitsidianakis 4217839155
melib/email: remove Envelope::from_token 2020-08-26 00:54:07 +03:00
Manos Pitsidianakis 9e9be0b5f3
Remove block_on from mailbox creation/deletion 2020-08-26 00:54:07 +03:00
Manos Pitsidianakis b545a0b905
Show error if watch job fails 2020-08-26 00:54:07 +03:00
Manos Pitsidianakis fc25c7b165
Fix compiler warnings 2020-08-26 00:54:07 +03:00
Manos Pitsidianakis 629997397f
Allow toggle_help (default ?) remapping 2020-08-26 00:54:06 +03:00
Manos Pitsidianakis 53e924eb33
Add edit envelope action back as async 2020-08-26 00:54:06 +03:00
Manos Pitsidianakis 3eadaba34e
Replace old pseudo-async code with blocking rust async 2020-08-26 00:54:06 +03:00
Manos Pitsidianakis a190805384
melib/backends: Add BackendEvent enum 2020-08-26 00:54:06 +03:00
Manos Pitsidianakis 9928ee78e7
Add Reply{ToAuthor,ToAll} actions
- previous Reply action now lets you select recipients by default
- ReplyToAuthor selects the Envelope author as recipient
- ReplyToAll selects all addresses
2020-08-26 00:54:05 +03:00
Manos Pitsidianakis 9afbdd4887
Add insert_user_agent option in composing
Add option for automatically inserting a 'User-Agent' header in new
drafts.
2020-08-26 00:54:05 +03:00
Manos Pitsidianakis bb4754e38a
themes/shortcuts: preserve order of keys 2020-08-26 00:54:05 +03:00
Manos Pitsidianakis 8a6bf3b217
Preserve Account order from configuration file
Use IndexMap to preserve the order of accounts in the UI from the
account definitions.
2020-08-26 00:54:05 +03:00
Manos Pitsidianakis b9e53a7451
melib/smtp: add recipient argument in mail_transaction() 2020-08-16 15:16:27 +03:00
Manos Pitsidianakis fe4dae12df
listing/*: show MailboxEntry::status() when length is 0
Show the MailboxEntry::status() string when self.length == 0, instead of
"MAILBOX is empty".
2020-08-07 00:39:17 +03:00
Manos Pitsidianakis c88eac1cc5
melib/jmap: implement search
Closes #59
2020-08-06 19:46:46 +03:00
Manos Pitsidianakis 52bcecfd4a
conf.rs: reject unknown configuration options
Closes #11
2020-08-03 22:53:06 +03:00
Manos Pitsidianakis c5d0a6c3b6
conf/accounts.rs: don't retry connect on auth error 2020-08-02 00:46:37 +03:00
Manos Pitsidianakis ec0153e7b2
melib: add protocol extension info in MailBackendCapabilities 2020-08-02 00:22:15 +03:00
Manos Pitsidianakis 44fdc0765e
conf/accounts.rs: add 30s job timeout 2020-07-29 14:27:43 +03:00
Manos Pitsidianakis 7fd511e149
conf/shortcuts.rs: implement DotAddressable for Shortcuts 2020-07-26 15:38:11 +03:00
Manos Pitsidianakis 1cc1b0604c
conf/accounts.rs: use QueryTrait when search_backend is None 2020-07-26 15:38:08 +03:00
Manos Pitsidianakis 3f8aa560f0
melib/MailBackend: add MailBackendCapabilities struct 2020-07-25 17:53:04 +03:00
Manos Pitsidianakis 8b90c7fcb6
conf/shortcuts: add shortcut for COMMAND mode
Replace hardcoded Key value with customisable shortcut
"general.enter_command_mode"
2020-07-25 15:19:53 +03:00
Manos Pitsidianakis c2550f60b6
Rename EXECUTE mode to COMMAND
vim uses COMMAND, and we want to be consistent with vim when possible.
2020-07-25 15:19:53 +03:00
Manos Pitsidianakis 989cfcc877
conf/accounts.rs: use mailbox alias if available in MailboxEntry::name() 2020-07-25 15:19:53 +03:00
Manos Pitsidianakis 7744ef1462
conf/accounts.rs: make JobRequest::Generic name Cow<'_, str> 2020-07-25 15:19:53 +03:00
Manos Pitsidianakis d6ef3567f4
conf/accounts.rs: add hash() method 2020-07-25 15:19:53 +03:00
Manos Pitsidianakis 688060ceb6
conf/accounts.rs: always load Inbox 2020-07-25 15:19:53 +03:00
Manos Pitsidianakis 00acba7717
melib/MailBackend: add copy_messages,set_flags,delete_messages methods 2020-07-25 15:19:53 +03:00
Manos Pitsidianakis a049a83fe3
conf/accounts: add insert_job() method 2020-07-25 15:19:53 +03:00
Manos Pitsidianakis f9efaea0ec
ConversationsListing: fix invalid update_line colors 2020-07-25 15:17:35 +03:00
Manos Pitsidianakis 99fbac3806
Remove unused variables/functions 2020-07-23 13:39:58 +03:00
Manos Pitsidianakis 1bd89b3c96
themes: add mail.sidebar_account_name key 2020-07-23 13:23:23 +03:00
Manos Pitsidianakis 0882dbbad0
melib/Collection: put all fields behind a mutex 2020-07-23 13:23:23 +03:00
Manos Pitsidianakis fadb3634e0
melib: take MailboxHash instead of &Mailbox in fetch*() 2020-07-23 13:23:23 +03:00
Manos Pitsidianakis 9103d05617
melib: s/get/fetch in MailBackend methods 2020-07-18 12:34:13 +03:00
Manos Pitsidianakis 996abd323f
Add print setting action
Add experimental print setting action. The command is of the form:

  print account_name listing.index_style

account_name is currently ignored.

The path, e.g. listing.index_style is split by "." and fed to
DotAddressable lookup trait method. The method checks the first segment
in the path if it matches any of the struct's fields, and then calls the
field's lookup method.
2020-07-17 13:33:40 +03:00
Manos Pitsidianakis 0d3fe288c5
sqlite3: make reindex operation async 2020-07-17 00:02:14 +03:00
Manos Pitsidianakis 5ef62a39b8
conf: Rename cache_type to search_backend 2020-07-16 23:57:00 +03:00
Manos Pitsidianakis 017a45d5cd
conf/accounts: add JobRequest::Generic 2020-07-16 22:54:50 +03:00
Manos Pitsidianakis 1f9cdb8be5
conf/accounts: update mailbox status on payload delivery 2020-07-16 18:00:53 +03:00
Manos Pitsidianakis 77dc1d74bf
Add smtp client support for sending mail in UI
`mailer_command` was removed, and a new setting `send_mail` was added.

Its possible values are a string, consisting of a shell command to
execute, or settings to configure an smtp server connection. The
configuration I used for testing this is:

  [composing]
  send_mail = { hostname = "smtp.mail.tld", port = 587, auth = { type = "auto", username = "yoshi", password = { type = "command_eval", value = "gpg2 --no-tty -q -d ~/.passwords/msmtp/yoshi.gpg" } }, security = { type = "STARTTLS" } }

For local smtp server:
  [composing]
  send_mail = { hostname = "localhost", port = 25, auth = { type = "none" }, security = { type = "none" } }
2020-07-15 15:24:01 +03:00
Manos Pitsidianakis ddafde7b37
jobs: save handle for each Job
If we save the JoinHandle for each task, we can cancel it in future
commits if we have to timeout network requests.
2020-07-15 15:22:33 +03:00
Manos Pitsidianakis 9db6b07b71
Remove some needless clones and stuff (thanks to Clippy) 2020-07-13 21:36:55 +03:00
Manos Pitsidianakis 899d497c9c
Rename _cmd options to _command for consistency 2020-07-08 12:12:15 +03:00
Manos Pitsidianakis 3a16dc6522
Show account online error status when offline 2020-07-08 12:10:14 +03:00
Manos Pitsidianakis 89dedbedb7
imap: launch async watch when connection comes online
Closes #38 Make async watch/refresh work in imap
2020-07-06 15:27:08 +03:00
Manos Pitsidianakis b5748c247a
MailBackend: remove connect() method 2020-07-06 15:27:08 +03:00
Manos Pitsidianakis f48343ca89
conf/accounts: add is_{async,remote} fields 2020-07-06 15:27:08 +03:00
Manos Pitsidianakis 94e0aa4fe7
MailBackend: change get() ret type to Result<_> 2020-07-06 15:27:08 +03:00
Manos Pitsidianakis a7e177586a
Fix clippy lints 2020-07-06 15:27:08 +03:00
Manos Pitsidianakis bbedeed3e3
More imap async fixes 2020-07-06 15:27:06 +03:00
Manos Pitsidianakis b3876113aa
BackendOp: return future in as_bytes() 2020-07-06 15:26:39 +03:00
Manos Pitsidianakis 4721073bc3
Rename jobs1 to jobs 2020-07-06 15:26:39 +03:00
Manos Pitsidianakis e06308fed2
MailBackend: change more methods to Futures 2020-07-06 15:26:00 +03:00
Manos Pitsidianakis 03522c0298
melib: Fixup warnings in imap_async, maildir 2020-07-06 15:25:17 +03:00
Manos Pitsidianakis 21051fa862
JobRequest: add more variants 2020-07-06 15:13:01 +03:00
Manos Pitsidianakis ee10cdbcd5
Make get_async() return a Stream 2020-07-06 15:12:11 +03:00
Manos Pitsidianakis a38764f490
Add somewhat-working async IMAP backend 2020-07-06 15:12:05 +03:00
Manos Pitsidianakis 4f3a98f90a
Add job executor 2020-07-06 15:07:44 +03:00
Manos Pitsidianakis 4ae7a57d45
Add save-draft command 2020-06-23 20:11:05 +03:00
Manos Pitsidianakis bfbaf3d617
Utilize EnvelopeRemove events
EnvelopeRemove events were not ever used in the UI
2020-06-23 20:11:04 +03:00
Manos Pitsidianakis efb06be09b
melib: return Result<_> from operation()
Envelope might have been deleted before main thread requests an
operation, which is a race condition.
2020-06-23 20:10:54 +03:00
Manos Pitsidianakis eca1921a8a
collection: add update_flags() method
On NewFlags events, the threads in Collection were not being updated, so
if an envelope's seen status was toggled the thread's unseen count was
  not updated, and thus not reflected in the UI even though the
  envelope's new flags event was registered properly.
2020-06-23 12:27:10 +03:00
Manos Pitsidianakis a6a30f3adb
conf/accounts.rs return Result on init() 2020-06-22 17:32:51 +03:00
Manos Pitsidianakis 0169025d50
build.rs: add proc-macro to generate Override structs for configuration 2020-06-20 23:58:53 +03:00
Manos Pitsidianakis 1241b6073f
Clear tags before applying new ones in NewFlags 2020-06-09 15:39:01 +03:00
Manos Pitsidianakis ca9d4fde58
Discard EnvelopeRename event if envelope is missing from Collection 2020-06-09 15:38:13 +03:00
Manos Pitsidianakis f3d5edfe14
Add copy/move to other account operations 2020-06-08 22:11:43 +03:00
Manos Pitsidianakis c07185a3aa
regexp: add priority field to regular expressions 2020-06-08 00:55:30 +03:00
Manos Pitsidianakis 3e31c46a74
Add "regexp" feature, format text with regexps
`regexp` feature uses the pcre2 library to enable the user to define
regular expressions for matching text and applying text formatting to
the matches. An example from the theme configuration I used to test
this:

  [terminal.themes.win95.text_format_regexps]
  "listing.subject" = { "\\[[^\\]]*\\]" = { attrs = "Bold" } }
  "listing.from" = { "\\<[^\\>]*\\>(?:(?:\\s*$)|(?=,))" = { attrs = "Italics" } }

  [terminal.themes.win95.text_format_regexps."pager.envelope.body"]
  "^>.*$" = { attrs = "Italics" }
  "\\d+\\s?(?:(?:[KkMmTtGg]?[Bb])|(?:[KkMmTtGg][Bb]?)(?=\\s))" = { attrs = "Bold | Underline" }
2020-06-05 10:56:36 +03:00
Manos Pitsidianakis de03b106f3
themes: Add support for Color/Attribute aliases
Add aliases to avoid repetition of raw values when defining new themes.
Aliases are strings starting with "$" and must be defined in the
`color_aliases` and `attr_aliases` fields of a theme.
2020-06-02 18:31:07 +03:00
Manos Pitsidianakis eca8a30c3f
themes: Add Theme struct
Wrap HashMap<Cow<'static, str>, ThemeAttributeInner> into a struct, in
order to add more fields in the future.
2020-06-02 18:31:07 +03:00
Manos Pitsidianakis fa96a4e905
themes: add support for optional field theme value links
Theme attribute values can refer to another theme key instead of
defining a value. Add support for optionally defining the theme key's
field by appending a ".fg" or ".bg" suffix to the link's key.
2020-06-02 18:31:07 +03:00
Manos Pitsidianakis 9c0ee76ff4
themes: Rename Theme struct to Themes 2020-06-02 18:31:07 +03:00
Manos Pitsidianakis bee1baedb2
themes: add indentation level color keys
Add theme keys for the indentation level colors in ThreadView
2020-05-31 16:44:39 +03:00
Manos Pitsidianakis bd404e6937
Execute user shell commands with /bin/sh
Execute user provided command invocations $CMD such as `editor_cmd` with
`/bin/sh` as `/bin/sh -c "$CMD"

Previously, user commands were split by whitespace which must trigger
erroneous behavior if quotes are involved.
2020-05-28 21:02:49 +03:00
Manos Pitsidianakis 608ef9a946
conf: warn on invalid mailbox name conf 2020-05-19 15:00:26 +03:00
Manos Pitsidianakis eb701695f7
Remove fnv crate 2020-05-10 21:18:56 +03:00
Manos Pitsidianakis 3ea1ce5454
errors: add `source` field to MeliError 2020-05-09 14:32:30 +03:00
Manos Pitsidianakis d580b25415
themes: overwrite only explicit key attributes
If user config file overwrites a single attribute and not the others,
for example only bg:

  "mail.listing.tag_default" = { bg = "Blue" }

The other attributes, in this case fg and attrs revert to the default
values of ThemeAttributeInner and not the default value for the key
"mail.listing.tag_default". As a result the above expands to:

  "mail.listing.tag_default" = { fg = Color::Default, bg = "Blue", attrs
  = Attr::Default }

This commit keeps the key value defaults, so the above should expand to:

  "mail.listing.tag_default" = { fg = default_theme["mail.listing.tag_default"].fg, bg = "Blue", attrs
  = default_theme["mail.listing.tag_default"].attrs }
2020-04-10 11:41:00 +03:00
Manos Pitsidianakis 18dcf15e1e
Add open_mailbox shortcut for sidebar 2020-04-05 21:35:36 +03:00
Manos Pitsidianakis d8135674df
themes: add {even,odd}_unseen, {even,odd}_selected, {even,odd}_highlighted
Suggested in #21
2020-04-05 15:57:05 +03:00
Manos Pitsidianakis e633434b93
themes: Fix invalid attribute links panic in is_cyclic
Attribute links are not checked for validity in theme validation, and an
invalid link would cause a panic in is_cyclic.

This commit improves the theme validation errors by printing if the
error lies in a theme key or a link.
2020-04-05 15:57:05 +03:00
Manos Pitsidianakis 4930d1b46c
Add Italics, Blink, Dim and Hidden text attributes
Text attributes have been rewritten as bit flags, so for example instead of
"BoldUnderline" you'd have to define "Bold | Underline" in your theme
settings.

Requested in #21
2020-04-05 15:57:05 +03:00
Manos Pitsidianakis e9a935dbf7
melib: add search method in mail backends 2020-04-05 15:57:05 +03:00
Manos Pitsidianakis 3d7b9ff7cb
Move Query to melib 2020-04-05 15:57:05 +03:00
Manos Pitsidianakis 840005022c
themes: add default tag theme attribute
The theme attribute key is "mail.listing.tag_default"
2020-04-03 10:13:27 +03:00
Manos Pitsidianakis 4c32bf450d
Add {un,}subscribe mailbox operations
Concerns #17
2020-03-24 21:05:06 +02:00
Manos Pitsidianakis 9ff54f236b
Add conf_override! macro
conf_override! wraps struct definitions and defines a secondary Override
struct that wraps each field in an Option. The macro mailbox_settings!
is used to select settings from an account & mailbox index. If a user defines an overriding setting, the macro returns the override instead of the immediately next in the hierarchy setting.

The selection is done for a specific field as follows:

  if per-folder override is defined, return per-folder override
    else if per-account override is defined, return per-account override
      else return global setting field value.
2020-03-18 19:13:07 +02:00
Manos Pitsidianakis a8c1016f37
Add various logic checks 2020-03-12 09:47:39 +02:00
Manos Pitsidianakis b7175c2400
Fix compiler error in --no-default-features build 2020-03-04 22:04:57 +02:00
Manos Pitsidianakis 651dda67cf
Respect autoload mailbox setting 2020-03-02 12:06:19 +02:00
Manos Pitsidianakis a3600c0cd2
Add `filter` option in mail list
Filter mail in mail list.

Example:
[listing]
filter = "not flags:seen" # show only unseen messages
2020-03-01 20:24:00 +02:00
Manos Pitsidianakis 9d20fd5576
Save forked processes for reaping 2020-03-01 17:56:58 +02:00
Manos Pitsidianakis 6c76db2063
Add delete, copy actions for envelopes 2020-03-01 17:48:10 +02:00
Manos Pitsidianakis 2a9059f9b4
Add add-attachment from pipe, default_header_values 2020-03-01 17:45:55 +02:00
Manos Pitsidianakis f10cc954e7
Don't dump mail on Account drop 2020-02-28 09:16:50 +02:00