Commit Graph

31 Commits (4677f9c6bbda791382d3f7bfd6668b9b827e6174)

Author SHA1 Message Date
Manos Pitsidianakis 4677f9c6bb
melib/imap: initialise uid_store folders in folders() 2019-11-27 17:42:11 +02:00
Manos Pitsidianakis b8e4a35963
melib/imap: add default capabilities to SUPPORTED_CAPABILITIES 2019-11-23 19:34:16 +02:00
Manos Pitsidianakis 41a678c6ef
melib: make MailBackend::folders return Result
Change folders() signature:
-    fn folders(&self) -> FnvHashMap<FolderHash, Folder>;
+    fn folders(&self) -> Result<FnvHashMap<FolderHash, Folder>>;

Imap may not be online, therefore we need the ability to return an
error.
2019-11-23 17:47:24 +02:00
Manos Pitsidianakis fc2d9a684d
melib/imap: set has_attachments based on BODYSTRUCTURE
fetch BODYSTRUCTURE along with ENVELOPE from server and set
has_attachments based on the MIME structure of the envelope.

Notes: BODYSTRUCTURE returns the MIME structure of the envelope without
the data, so if it includes a multipart/mixed it *should* have
attachments.
ENVELOPE returns basic headers of the message like Sender, Subject, Date
etc.
2019-11-18 13:00:43 +02:00
Manos Pitsidianakis b2cd4f4b7a
melib/imap: put imap folders in RwLock instead of Mutex
This should prevent lockups if the IMAP conn thread gets blocked
2019-11-18 12:59:04 +02:00
Manos Pitsidianakis 321be8555f
Cleanup startup error exit paths
Make startup methods return Results so that the main binary can exit
cleanly instead of using std::process::exit from arbitrary positions,
which exits the process immediately and doesn't run destructors.
2019-11-16 00:33:22 +02:00
Manos Pitsidianakis 5761f854e2
melib: Add FolderPermissions
permissions() method on BackendFolder and SetPermissions in
FolderOperation enum.
2019-11-11 00:47:23 +02:00
Manos Pitsidianakis c1902f96b5
imap: add UIDVALIDITY check
On UIDVALIDITY change, discard cache and force rescan.
2019-11-10 23:02:23 +02:00
Manos Pitsidianakis 229e879c26
ui/imap: select user given folder before search
IMAP search() didn't select a folder before searching, thus searching
the mailbox the previous user of self.connection had selected.
2019-11-08 17:50:55 +02:00
Manos Pitsidianakis 99697a8fd5
ui: Add search for IMAP
Add basic search utilising the default SEARCH capability.
2019-11-08 15:13:42 +02:00
Manos Pitsidianakis 7936aef476
Fix infinite watch threads spawning
Watch threads were launched every time the account's online status was
checked, added a check to only do it when it was previously offline.
2019-11-08 15:13:42 +02:00
Manos Pitsidianakis 61fa6d3d4b
ui: show supported IMAP CAPABILITIES list in Status
In status page for IMAP accounts, show a list of CAPABILITIES and
whether meli supports them
2019-11-08 15:13:42 +02:00
Manos Pitsidianakis f56b89dde3
melib: add as_any() method to MailBackend trait
Cast the trait object into an &Any object. Then we can downcast it to
its actual type with downcast_ref().
2019-11-08 15:13:42 +02:00
Manos Pitsidianakis d926cadc4d
melib: remove argument from MailBackend operation()
The operation() method on the MailBackend trait returns a trait object
that can read or modify an Envelope directly from the backend. This is
used to get eg the envelope's text, or set flags. It has two arguments,
envelope hash and folder hash.

Only the Maildir backend needed the latter argument, and it can be replaced with a dictionary to match envelope hashes to folder hashes within the Maildir backend.
2019-11-08 15:13:41 +02:00
Manos Pitsidianakis e5b6faf6bd
Add account online status
Add a boolean field to accounts that states if the account can be
accessed. Local backends (Maildir/mbox) return true every time, but
remote backends (IMAP) may not. Accounts start as offline and then get
initialised when their status goes to online. Right now if an IMAP
account startup but later get offline, there are crashes. With this
change the account can be switched back to offline when that happens.
2019-10-24 20:30:17 +03:00
Manos Pitsidianakis ee82ae175a
imap: add support for imaps connections
Take port value and a `use_starttls` flag from the configuration file.
2019-09-21 21:29:33 +03:00
Manos Pitsidianakis 7dc3efaedd
imap: allow conn to be offline and retry on demand
Split the TlsStream of the live IMAP connection to an enum to allow both
offline and online states. The connection is restarted if offline when
requested.
2019-09-20 09:07:55 +03:00
Manos Pitsidianakis 059d86de93
map: restart connection on failure in read_lines 2019-09-15 23:38:31 +03:00
Manos Pitsidianakis bfc36f63de
imap: add byte cache for Envelopes in IMAP backend 2019-09-15 23:38:31 +03:00
Manos Pitsidianakis f394fde143
add priority and info to jobs and workers
jobs now have a priority given to them, in order to parse some mailboxes
(eg INBOX, Sent) first.

worker threads now can set their names and status
2019-09-15 13:21:14 +03:00
Manos Pitsidianakis 81a55abc7c
Update crossbeam to 0.7.2 and remove chan 2019-09-15 13:21:14 +03:00
Manos Pitsidianakis ecb3fd7f3d
Add dyn keyword to Trait objects
And fix some unused var warnings as well
2019-09-15 13:21:14 +03:00
Manos Pitsidianakis d1d11356db
imap: get() ENVELOPE instead of RFC822.HEADER; it's faster 2019-09-15 13:21:14 +03:00
Manos Pitsidianakis 335a1011de
imap: add watch 2019-09-15 13:21:14 +03:00
Manos Pitsidianakis c3e3c98fb0
melib: filter subscribed folders in MailBackend::new() 2019-09-15 13:21:14 +03:00
Manos Pitsidianakis 64dc44f18f
imap: replace unwraps with checks 2019-09-15 13:21:14 +03:00
Manos Pitsidianakis 525bd16493
imap: add folder operations in backend 2019-09-15 13:21:14 +03:00
Manos Pitsidianakis c9f7b41e47
imap: continuous payload delivery in async workers 2019-09-15 13:21:13 +03:00
Manos Pitsidianakis c561814cd6
imap: add `danger_accept_invalid_certs` option 2019-09-15 13:21:13 +03:00
Manos Pitsidianakis 0812242f60
Add IMAP backend
TODOs: new message events (untagged responses)
2019-09-15 13:21:13 +03:00
Manos Pitsidianakis c6674a294d
melib: unwrap mailbox module 2019-06-10 19:40:50 +03:00