Commit Graph

54 Commits (4ac52d9d5b5ca2ae64e5f20912aca26391a52ddb)

Author SHA1 Message Date
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 9a46e58029
imap: don't retry command on reconnection
If a command fails and connection is restarted, don't try the command
again; it only made sense in the previous connection's context.
2020-02-19 17:06:26 +02:00
Manos Pitsidianakis f208948651
melib: add mailbox delete/create to IMAP 2020-02-08 23:54:14 +02:00
Manos Pitsidianakis 6a096dd405
Add missing copyright preambles 2020-01-31 03:54:58 +02:00
Manos Pitsidianakis 5dc477bcd5
Fix some unused etc warnings 2020-01-27 17:32:12 +02:00
Manos Pitsidianakis 77d9cef6fc
melib/imap: small fixes
- Ignore final line ("M__ OK ...") when parsing FETCH response.

- Remove unnecessary import and reword some error messages
2020-01-27 15:55:01 +02:00
Manos Pitsidianakis 7f8c638361
melib/imap: add mailbox creation ability 2020-01-20 15:58:59 +02:00
Manos Pitsidianakis ca7d72e732
melib: Replace String with Cow<'static, str> 2020-01-07 12:55:27 +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 9211913405
meli/backends: honor mailbox subscriptions in IMAP/JMAP 2019-12-18 15:44:44 +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 7732b851e6
melib: fix minor header parsing errors
- set_subject checked if last byte was control character instead of last
character. Characters can be multi-byte, duh.
- email::parser::date didn't provide for Date values that had -0000
instead of +0000 (that's a chrono requirement/bug)
2019-12-12 00:44:47 +02:00
Manos Pitsidianakis 9fae0f2fa3
melib/imap: prevent minor blocking cases 2019-12-11 01:36:04 +02:00
Manos Pitsidianakis f05a4205f7
melib/ui: small fixes
- melib/imap: accept quoted strings with escaped quotes in
protocol_parser
- ui/accounts: return unavailabity correctly if folder's worker slot is
empty instead of judging only by its vacancy
- ui/MailView: set view as not dirty if envelope loading from backend
fails so that it stops requesting it in every subsequent redraw
2019-12-11 00:17:11 +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 569127fac5
melib/imap: detect untagged CAPABILITY responses
Gmail sends an untagged CAPABILITY response before accepting login, so
be smarter when logging in
2019-12-11 00:01:22 +02:00
Manos Pitsidianakis 8235af9237
melib/imap: quote mailbox names on SELECT/EXAMINE 2019-12-10 23:56:25 +02:00
Manos Pitsidianakis a20e08eb43
imap: treat \NoSelect mailboxes as empty
\NoSelect are mailboxes that can't be selected, thus treat them as if
they are empty.
2019-12-10 23:54:19 +02:00
Manos Pitsidianakis 0eaf17871a
melib: add set_tags command in BackendOp 2019-12-08 11:25:54 +02:00
Manos Pitsidianakis dab9b39f4d
melib/imap: detect tag (\* flag) support 2019-12-07 17:17:08 +02:00
Manos Pitsidianakis 9d8d3e09f4
melib: remove unused methods from BackendOp 2019-12-06 12:33:58 +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 05d9ca6e0d
small fixes 2019-11-21 15:44:18 +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 7463248da8
melib: change BackendOp::set_flag() signature 2019-11-15 21:32:55 +02:00
Manos Pitsidianakis 8f36678abf
melib: make Backendfolder::children return slice 2019-11-14 17:55:24 +02:00
Manos Pitsidianakis 56cda63c83
Fix some warnings 2019-11-14 17:55:24 +02:00
Manos Pitsidianakis f83db67a38
melib/imap: don't stop IDLE session
Previous behaviour: connection with IDLE was stopped every 5 minutes to
poll the other threads. As a result messages received within that time
window when there was no IDLING were never received.
Current behaviour: polling is done in the main connection.
2019-11-12 22:18:00 +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 580f0be8a4
imap: fix cases that would block connection
Fix blocking if TLS negotiation can't start

Fix blocking if IDLE connection dies.
2019-11-10 13:32:31 +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 0566937a76
imap: reconnect if connection timed out 2019-11-02 12:25:18 +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
Matthias Beyer a0602274f8
Run cargo fmt 2019-10-04 20:47:25 +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 080b8ae775
imap: add log entry on connection retry & failure 2019-09-15 23:44:42 +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 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