Commit Graph

59 Commits (1408690a9a0d0976c17397be33bd4e886088a914)

Author SHA1 Message Date
Manos Pitsidianakis 1408690a9a
melib/imap: don't retry watch conn on non-network error 2020-12-02 17:10:43 +02:00
Manos Pitsidianakis bedf181aff
melib/imap: examine all mailboxes before idle 2020-11-30 02:20:09 +02:00
Manos Pitsidianakis 4939a1ad9e
melib/imap: remove some debug prints 2020-11-30 02:20:09 +02:00
Manos Pitsidianakis 5f6b4745b8
melib/imap: don't use UNSEEN select response for unseen count
UNSEEN field in SELECT/EXAMINE response is meant to be the message
sequence number of the first unseen message, not the count of unseen
messages.
2020-11-30 02:20:08 +02:00
Manos Pitsidianakis 76c1c1a213
melib/imap: don't examine unloaded mailboxes for updates
In examine_updates() which is periodically executed in the IMAP watch
thread, the mailbox's contents get fetched regardless if the user has
fetched the mailbox before. That means eg a large mailbox that was
unused by the user might perform a large fetch all of a sudden without
the user's knowledge/touch.

Add `warm` property in ImapMailbox that states whether the mailbox has
been loaded before in current execution.

Closes #88 IMAP: don't examine unloaded mailboxes for updates, just for message count stats
2020-11-30 02:20:08 +02:00
Manos Pitsidianakis ddfadc748d
melib/imap: don't fetch RFC822 except when requested
In some cases when handling new server events, the entire body message
was unnecessarily fetched.

Closes #87 IMAP: don't fetch RFC822 except when requested
2020-11-30 02:20:08 +02:00
Manos Pitsidianakis ce559b05d7
melib/imap: EXAMINE instead of SELECT in IDLE connection 2020-09-24 12:15:00 +03:00
Manos Pitsidianakis 3618bdcffb
melib/imap: treat server input as bytes
Server input was assumed valid ascii and converted haphazardly to &str.
Don't do that, since it might not be valid UTF8.
2020-09-16 15:17:48 +03:00
Manos Pitsidianakis 0e2641f7ed
melib/imap: always retry connection in watch() 2020-09-16 13:11:28 +03:00
Manos Pitsidianakis 17a4ccdcbc
melib/imap: perform reconnect on IDLE failure 2020-09-14 19:32:43 +03:00
Manos Pitsidianakis 352f7505fc
melib/imap: don't poll \Noselect mailboxes for updates 2020-09-13 00:24:26 +03:00
Manos Pitsidianakis 06a58a70bd
melib/imap: introduce a conf flag for server timeout
timeout integer                       (optional) Timeout to use for server connections in seconds.  A timeout of 0 seconds means there's no timeout.  (16)
2020-09-12 22:07:42 +03:00
Manos Pitsidianakis d00055fdb1
melib/imap: update online instant only on server read IO 2020-09-11 17:02:27 +03:00
Manos Pitsidianakis 1751509739
melib/imap: prevent false IDLE wakeups
Prevent IDLE loop waking up when receiving continuation "+ " lines
2020-09-11 17:02:27 +03:00
Manos Pitsidianakis b4fe34eacf
melib/imap: add ImapCache trait 2020-08-28 00:31:35 +03:00
Manos Pitsidianakis 75f59ee726
melib/imap: split by lines when reading IDLE unsolicited responses 2020-08-27 17:26:39 +03:00
Manos Pitsidianakis e9a80b32ac
melib/imap: small cleanups 2020-08-26 20:08:44 +03:00
Manos Pitsidianakis f7c9f21575
melib/imap: add CONDSTORE support
Closes #52
2020-08-26 00:54:06 +03:00
Manos Pitsidianakis 031e81ac8f
imap: add UntaggedResponse::UIDFetch 2020-07-26 16:09:41 +03:00
Manos Pitsidianakis 0a7f283582
imap: prevent deadlock in watch::examine_updates
uid_store.mailboxes was locked before calling examine_updates, which
calls examine_mailbox() which also attempts to lock uid_store.mailboxes
2020-07-17 22:45:25 +03:00
Manos Pitsidianakis 931863436d
imap: remove blocking imap backend, replace with async 2020-07-06 15:27:08 +03:00
Manos Pitsidianakis f8b84a192c
imap: add current_mailbox enum MailboxSelection
Add enum to track the currently selected Mailbox in the IMAP connection
2020-07-06 11:32:03 +03:00
Manos Pitsidianakis 91badc3960
imap: count message totals using HashSet
This way it's easy to know if a flag change in an envelope requires the
unseen total of a mailbox to change.
2020-06-26 21:12:56 +03:00
Manos Pitsidianakis d7444a5b19
imap: recognize EXPUNGE events 2020-06-23 20:11:04 +03:00
Manos Pitsidianakis c7fbc5cafb
imap: remove redundant passing of AccountHash 2020-06-11 11:43:18 +03:00
Manos Pitsidianakis 2d3f49d64d
imap: index by (MailboxHash, UID) instead of just UID
Mailboxes can share UIDs.
2020-06-11 11:41:08 +03:00
Manos Pitsidianakis b4dfc1f89d
imap: add experimental header caching with sqlite3
Add support for header caching. It is currently unstable and should not
be used. It can be turned on by specifying "X_header_caching" to true in
the IMAP account's configuration.

The header cache is saved in a sqlite3 database in your XDG_DATA_DIR,
for example:

  /home/epilys/.local/share/meli/17328072387188469646_header_cache.db

Concerns #31 https://git.meli.delivery/meli/meli/issues/31
2020-06-07 14:35:20 +03:00
Manos Pitsidianakis 6ec249dd7f
melib: update nom dependency from 3.2.0 to 5.1.1
That was hecking exhausting
2020-06-06 23:19:07 +03:00
Manos Pitsidianakis 815ff98acc
imap: add smarter untagged reply detection 2020-05-30 14:43:44 +03:00
Manos Pitsidianakis 8648b229ad
Add AccountHash to RefreshEvent
Different accounts might have same inboxes with same MailboxHashes. Use
the hash of the account's name to differentiate.
2020-05-10 22:10:17 +03:00
Manos Pitsidianakis eb701695f7
Remove fnv crate 2020-05-10 21:18:56 +03:00
Manos Pitsidianakis c37d8bd331
imap: add mutex timeout lock and remove unwraps 2020-04-05 15:56:59 +03:00
Manos Pitsidianakis 7a770c7f7b
imap: fetch RFC822 instead of RFC822.HEADER
RFC822.HEADER is not parsed in imap/protocol_parser.rs
2020-03-18 19:19:39 +02:00
Manos Pitsidianakis ca51077f53
imap: Add support for untagged FETCH (FLAG.. messages
IDLE connection can get untagged "* FETCH (FLAGS ({flag_list))" messages
if any client has changed flags. Support this refresh event.
2020-02-28 09:09:43 +02:00
Manos Pitsidianakis 4ac52d9d5b
Replace every use of Folder with Mailbox
Use Mailbox for consistency.
2020-02-26 10:54:10 +02:00
Manos Pitsidianakis 499fd59c6e
melib/imap: implement refresh() 2020-02-25 22:15:13 +02:00
Manos Pitsidianakis bbdc9d69b4
melib/imap: add ImapConnection::connect() 2020-02-25 22:15:13 +02:00
Manos Pitsidianakis f208948651
melib: add mailbox delete/create to IMAP 2020-02-08 23:54:14 +02:00
Manos Pitsidianakis 21526b5faf
melib: make Work use FnOnce closures
There was no need to use Fn() instead of FnOnce()
2019-12-20 00:53:43 +02:00
Manos Pitsidianakis 2b6f6ab42c
melib: Add BackendFolder methods, move special usage logic to backend
- add count() method to return (unseen, total) counts
- add is_subscribed()
- add set_special_usage() and set_is_subscribed()

concerns #8
2019-12-18 08:58:49 +02:00
Manos Pitsidianakis 2e38ea11e2
melib: make MailBackend::is_online() return Result<()>
Return Result<()> instead of bool to indicate connection status in order
to be able to show errors to user.
2019-12-14 18:57:52 +02:00
Manos Pitsidianakis 6f76cd9acc
melib: add special_usage() method to BackendFolder
Eventually after loading potential usage values from configuration,
backends will be able to change the usage values themselves. IMAP and
JMAP have the ability to set Mailbox roles (IMAP needs LIST-SPECIAL
extension
2019-12-11 00:15:36 +02:00
Manos Pitsidianakis 504b658f68
melib/imap: add UidFetchResponse struct and parser
Add handwritten parser for UID FETCH responses and use it for all UID
FETCH calls.
2019-12-11 00:05:41 +02:00
Manos Pitsidianakis 8235af9237
melib/imap: quote mailbox names on SELECT/EXAMINE 2019-12-10 23:56:25 +02:00
Manos Pitsidianakis 0eaf17871a
melib: add set_tags command in BackendOp 2019-12-08 11:25:54 +02:00
Manos Pitsidianakis 3dc0cb1963
imap: send 'finished' signal when watch thread dies 2019-11-25 12:04:27 +02:00
Manos Pitsidianakis eecec551c1
Display watch thread errors to user
Show a proper notification with the error message to the user instead of
just logging it on debug-tracing.
2019-11-23 19:34:16 +02:00
Manos Pitsidianakis 424b244bb7
fixup some TODO and FIXMEs 2019-11-22 13:59:00 +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 56cda63c83
Fix some warnings 2019-11-14 17:55:24 +02:00