Commit Graph

873 Commits (02e86d1fade9faefc14b890e3cec8ed2255bb839)

Author SHA1 Message Date
Manos Pitsidianakis 0d8bedd2d5
melib/jmap: make is_online() await for connection
Closes	#126 https://git.meli.delivery/meli/meli/issues/126
3 years ago
Manos Pitsidianakis 81d1265601
melib/imap: escape IMAP passwords properly
Closes #125
3 years ago
Manos Pitsidianakis d8e9a00563
melib/imap: add quoted REFERENCES field in parsing of responses 3 years ago
Manos Pitsidianakis 36e29cb6fd
Add configurable mailbox sort order
Closes #25

```
     sort_order unsigned integer           (optional) Override sort order on the sidebar for this mailbox.  Example:

                                           [accounts."imap.example.com".mailboxes]
                                             "INBOX" = { index_style = "plain" }
                                             "INBOX/Sent" = { sort_order = 0 }
                                             "INBOX/Drafts" = { sort_order = 1 }
                                             "INBOX/Lists" = { sort_order = 2 }
```
3 years ago
Manos Pitsidianakis 5f003a31be
melib/addressbook/vcard: Parse vCards with just LF instead of CRLF line endings
According to the vcard RFC
https://datatracker.ietf.org/doc/html/rfc6350#section-3.2 all lines must
end with CRLF (\r\n or 0x0d 0x0a)

Some VCard sources use only newline, which, while spec violating is easy
to recover from. So parse them as if they are correct.

Closes #121
3 years ago
Manos Pitsidianakis 2580522931
melib/addressbook: log vcard parsing failures 3 years ago
Manos Pitsidianakis 37d0846195
melib/email/address: quote display_name if it contains "," 3 years ago
Manos Pitsidianakis ffc498a5d0
melib/smtp: fix Cc and Bcc ignored when sending mail 3 years ago
Manos Pitsidianakis 240374950a
melib/email/address: quote display_name if it contains "." 3 years ago
Manos Pitsidianakis 505adca54d
Add forward mail option
Forward email with shortcut 'forward' (default ctrl+f)

This opens a composing tab letting you to select receiver etc.

"composing" config setting "forward_as_attachment" selects the
forwarding behavior:

- "ask" asks you ever time
- true always forwards by attaching the entire email as a single
attachment
- false always forwards by inlining the email, like most email clients
do.

Closes #120
3 years ago
Manos Pitsidianakis 733de5a5fb
Fix some clippy suggestions 3 years ago
Manos Pitsidianakis 7533df86e0
Fix compilation for netbsd-9.2
$ rustc -V
rustc 1.52.1
$ cargo -V
cargo 1.52.0

Pre-requisite steps needed for build:
- Needed to install mozilla certs
- Needed to set OPENSSL_DIR=/usr
3 years ago
Manos Pitsidianakis 526a246430
melib/nntp: update total/new counters on new articles 3 years ago
Alex.F 69916f267b
add 'GB18030' charset 3 years ago
Manos Pitsidianakis 07e166e1fb
melib/error: Add kinds: NotImplemented, NotSupported, OSError 3 years ago
Manos Pitsidianakis c8da6d2049
melib/nntp: implement refresh 3 years ago
Manos Pitsidianakis 90042379a6
melib/{imap,nntp}: throw error on extra unusued conf flags 3 years ago
Manos Pitsidianakis 09dc0a2409
melib/conf: deserialize ToggleFlag from bool & string 3 years ago
Manos Pitsidianakis 3bc187c570
melib/collections: add RwRef{,Mut} structs 3 years ago
Manos Pitsidianakis b49d965695
Fix unused var etc warnings 3 years ago
Manos Pitsidianakis 6235164df2
melib/nntp: increase chunk size 3 years ago
Manos Pitsidianakis 521f634e7b
melib/nntp: implement NNTP posting 3 years ago
Manos Pitsidianakis f097593bed
melib/datetime: fix date format string 3 years ago
Ludovic LANGE b08570349d
Notmuch dynamic library can now be loaded on macos
On macos, the name of dynamic libraries is a little bit different than on Unix.
The code was looking for a `libnotmuch.so.5` library, while on macos
it's installed as `libnotmuch.5.dylib`.

This commit uses cfg attribute to conditionally change the library name.

Closes #106
3 years ago
Manos Pitsidianakis bcca9abe66
docs: Use example.com in documentation
Closes #96
4 years ago
Manos Pitsidianakis 24b4c117e7
melib: don't use both {set,push}_references()
set_references() already calls push_references()
4 years ago
Manos Pitsidianakis b0fba401e6
melib/mbox: consistent line endings in MboxFormat::append 4 years ago
Manos Pitsidianakis 63d2fb93f4
melib/nntp: fix not connecting with TLS 4 years ago
Manos Pitsidianakis cf9457882a
melib/mbox: add MboxMetadata type and write support 4 years ago
Manos Pitsidianakis 3fa9e355c2
melib/email: add Flag is_*() methods 4 years ago
Manos Pitsidianakis 3dae84182c
melib/mbox: add module-level doc 4 years ago
Manos Pitsidianakis 4050f6893f
melib/mbox: add MboxFormat::append() method
Add support for writing mbox files
4 years ago
Manos Pitsidianakis dcccd303ac
melib/mbox: rename MboxReader to MboxFormat 4 years ago
Manos Pitsidianakis 22a64e2d76
melib: Remove unnecessary "pub use" std exports 4 years ago
Manos Pitsidianakis 781a1d0e1b
melib/backends: add collection() method to MailBackend
Keep track of the Collection state in the backend side
4 years ago
Manos Pitsidianakis 08af46f5ef
melib/datetime: fix test compile failure 4 years ago
Manos Pitsidianakis 2f47f1eebd
melib/jmap: fix mailbox children relationships being ignored 4 years ago
Manos Pitsidianakis eca10a5660
melib/backends: add mailbox management events to RefreshEventKind
Add mailbox management events from RFC 5423 Internet Message Store
Events

https://tools.ietf.org/html/rfc5423#page-8
4 years ago
Manos Pitsidianakis a697dfabbd
melib/jmap: use receivedAt as alternative to Date in Envelope gen 4 years ago
Manos Pitsidianakis 23997bdec0
melib/jmap: add UTCDate queries in EmailFilterCondition
Not necessarily working, added as stubs for future work

Closes #62
4 years ago
Manos Pitsidianakis 2e6a1e1ef8
melib/datetime: rename tests for consistency 4 years ago
Manos Pitsidianakis fe200a3218
melib/datetime: isolate unsafe blocks
Isolate unsafe blocks where possible to make code review easier
4 years ago
Manos Pitsidianakis bf9143d8e4
melib/datetime: use Cow<'_, CStr> in timestamp_to_string()
Use Cow to avoid unnecessary allocations when provided a nul-terminated
format string
4 years ago
Manos Pitsidianakis 441dcb62ca
melib/datetime: add format string constants 4 years ago
Manos Pitsidianakis 4cd3e28244
melib/datetime: fix import style inconsistencies 4 years ago
Manos Pitsidianakis 3dba6fdf60
melib/datetime: add posix locale arg in timestamp_to_string() 4 years ago
Manos Pitsidianakis 50cd81772f
melib/jmap: impl watch() with polling
Concerns #22
4 years ago
Manos Pitsidianakis 613c3de3d2
melib/connections: add async sleep(dur: Duration) 4 years ago
Manos Pitsidianakis 62db7d7f32
melib/jmap: put JmapSession behind mutex
And deserialize API urls to Arc<String>.
4 years ago
Manos Pitsidianakis db69349251
melib/notmuch: avoid parsing entire email in Envelope creation 4 years ago
Manos Pitsidianakis 806254436b
melib/notmuch: add AccountHash field to NotmuchDb 4 years ago
Manos Pitsidianakis 4f164dc700
melib/notmuch: cleanup Query new() method 4 years ago
Manos Pitsidianakis ab0ef1b63c
melib/thread: hash Message-ID for ThreadNodeHash
Make ThreadNodeHash predictable.
4 years ago
Manos Pitsidianakis b966ee8fbd
melib/email: return &mut Self in set_*() methods
Return &mut Self to allow chaining setter methods
4 years ago
Manos Pitsidianakis 34e970d922
melib/datetime: Add Locale struct for error checking 4 years ago
Zisu Andrei f7cbd9a64d
melib/datetime: Set C locale for strptime parsing
This is the locale that should be used for computer interoperability
when doing date and time parsing and formatting.

Without this, on systems which don't have the US locale set, the parsing
returns 0.
4 years ago
Manos Pitsidianakis 829f1243fb
melib/imap: fix invalid FETCH edge case
If mailbox was empty, this FETCH would request "0:*" which is an invalid
message set since message sequence numbers start with 1.
4 years ago
Manos Pitsidianakis 1be30968ca
melib/mbox: fix FreeBSD compilation
Reported in #92
4 years ago
Manos Pitsidianakis 92475c349a
melib/mbox: return Result in file locking 4 years ago
Zisu Andrei 0034f195e3
melib/imap: Lazy evaluate idle capability
With the eager evaluation, you run the risk of checking the capabilities
store before any connection to the server may have been opened.
Therefore, the capabilities uid_store will be empty and it will fall
back to poll_with_examine even if the server might have support for
idle.
4 years ago
Manos Pitsidianakis b2e853dd7b
melib/imap: update unseen count on \Seen set_flags() 4 years ago
matzipan@gmail.com aa503deb76
melib/imap: Set special usage attributes for INBOX
Without this change, the usage is not correctly identified when calling
imap_mailboxes in the imap backend.
4 years ago
Manos Pitsidianakis fee8f5b575
melib/backends: move IsSubscribedFn to backends mod 4 years ago
Manos Pitsidianakis 7e977fe627
melib/imap/cache/sync: explicitly remove new seen messages from unseen counter 4 years ago
Manos Pitsidianakis 09684e821d
melib/imap: check INBOX when pausing IDLE 4 years ago
Manos Pitsidianakis 68f9d1220b
melib/imap: remove DoubleEndedIterator for ImapLineIterator 4 years ago
Manos Pitsidianakis 1408690a9a
melib/imap: don't retry watch conn on non-network error 4 years ago
Manos Pitsidianakis 5327dae02d
melib/text_processing: add LineBreakText iterator
A lazy stateful iterator for line breaking text. Useful for very long text where you don't want to linebreak it completely before user requests specific lines.
4 years ago
Manos Pitsidianakis 453bb0b2b2
melib/smtp: implement gmail XOAUTH2 authentication method 4 years ago
Manos Pitsidianakis bedf181aff
melib/imap: examine all mailboxes before idle 4 years ago
Manos Pitsidianakis 9dd21eea50
melib/threads: prefer local ThreadNode env_hash
When inserting an envelope in a thread and its Message-ID already exists
with an associated envelope, overwrite the association if the previous
associated envelope is from a foreign mailbox and current envelope is
not. This happens when mail from a sent folder has been inserted in eg
your INBOX, but somehow INBOX has a copy of your own message as well.
This can happen when mailing lists that send you copies of your own
posts.

The problem with this was that in IMAP your mailing list copy was unseen
and you could not mark it seen because the thread only knew about your
Sent mailbox copy.
4 years ago
Manos Pitsidianakis 4939a1ad9e
melib/imap: remove some debug prints 4 years ago
Manos Pitsidianakis 8e7583a32f
melib/imap: don't clear mailbox counts before fetching 4 years ago
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.
4 years ago
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
4 years ago
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
4 years ago
Manos Pitsidianakis 92c12d3526
melib/imap: implement OAUTH2 authentication 4 years ago
Manos Pitsidianakis d4f508642a
widgets: allow text overflow in text fields
Show text content of a text field that exceeds the visible width
properly.
4 years ago
Manos Pitsidianakis 2ef2add67f
imap: fix untrimmed query str resulting in invalid search criteria in cyrus 4 years ago
Manos Pitsidianakis f9ce5327c2
melib/imap: fix some LazyCountSet logic errors in sync 4 years ago
Manos Pitsidianakis 041257f9a6
melib/text_processing: fix CodePointsIterator implementation
Old implementation was redundant and broken.
4 years ago
Manos Pitsidianakis 1da6d75b08
melib/text_processing: add new wcwidth implementation
Download and parse Unicode data files to judge code point width.
Inspired by https://github.com/ridiculousfish/widecharwidth/
4 years ago
Manos Pitsidianakis a7c0bca8ce
Fix test errors and warnings 4 years ago
Manos Pitsidianakis d404910a0f
melib/smtp: impl AUTH LOGIN
AUTH LOGIN is deprecated but predictably still around.
4 years ago
Manos Pitsidianakis aa7ebf2918
melib/smtp: fix SMTP syntax error on DSN notify use 4 years ago
Manos Pitsidianakis 2544f54107
melib/compose: prevent bare newlines in finalised drafts 4 years ago
Manos Pitsidianakis f0800f38a8
melib/maildir: make MaildirOp return Result<PathBuf> 4 years ago
Manos Pitsidianakis a34f0aac5b
melib: fix bincode serialization
Previous commit changed bincode deserializes in maildir and sqlite3.rs
from bincode::deserialize_from to using bincode::config::DefaultOptions
and bincode::Options trait's method deserialize_from.

However, these two different deserializes use a different default
settings: https://github.com/servo/bincode/issues/348

Specifically, varint encoding for integers is the default for
DefaultOptions but not when using bincode::{de,}serialize_* functions.
That means that serialized structs were not able to be deserialized.
This commit makes all {de,}serializations use the DefaultOptions
interface rather than the top level functions.
4 years ago
Manos Pitsidianakis 353ac2d029
melib: set upper limit for bincode deserialize
If struct memory layout changes, bincode deserialize fails with memory
allocation error of an obscene amount of bytes. Set upper limit to
deserialized bytes in each place deserialize happens.
4 years ago
Rudi Horn f1bdae65ee
melib/jmap: add HTTP redirect policy to client
Meli currently uses the .well-known/jmap URL and the RFC8620 requires that any redirects are followed (https://tools.ietf.org/html/rfc8620#section-2.2). This small change allows redirects to happen.
4 years ago
Manos Pitsidianakis 9a9c876f4a
melib: add more encodings
Add more encodings already supported by `encoding` crate:

  - iso-8859-3,
  - iso-8859-4,
  - iso-8859-5,
  - iso-8859-6,
  - iso-8859-8,
  - iso-8859-10,
  - iso-8859-13,
  - iso-8859-14,
  - iso-8859-16,
  - gb-2312
  - big-5
  - iso-2022-jp
  - euc-jp
  - koi8-r
  - koi8-u
  - utf-16
4 years ago
Manos Pitsidianakis d5aa2cb3ef
melib/line_break: add segment tree impl
The widths of subslices of a line are calculated in each call to
`binary_search_by` when reflowing long lines. This can be done in Ologn
queries with a segment tree.
4 years ago
Manos Pitsidianakis 00f5c4b9c0
melib/maildir: split parsing into big chunks 4 years ago
Manos Pitsidianakis 662706607b
melib: remove memmap dependency
It's unmaintained, and the IO performance gains are negligible
4 years ago
Manos Pitsidianakis 91fe7435f7
melib/imap: add suggestion on STARTTLS error
If server port is 993 (IMAPS) and starttls is enabled, suggest turning
it off if starttls fails.
4 years ago
Manos Pitsidianakis 7a9c150f33
melib/imap: fetch References header along with ENVELOPE
Threading was broken if information was needed from References header.
For example, mailman might alter some Message-IDs when using its NNTP
bridge and the complete references are necessary to rebuild the thread,
which is only available in References whereas ENVELOPE has only
In-Reply-To.
4 years ago
Manos Pitsidianakis b9f4d718c7
melib/sqlite3: reset db on version mismatch 4 years ago
Manos Pitsidianakis 54cb4ea623
melib/build.rs: remove unnecessary file creation 4 years ago
Manos Pitsidianakis a702a04043
melib/attachments: add SMIME signature variant 4 years ago
Manos Pitsidianakis 4c1a9b2485
Fix minor warnings 4 years ago
Manos Pitsidianakis 20840625d6
melib/gpgme: trim header file 4 years ago
Manos Pitsidianakis d51d0187a6
melib/imap: change byte cache String -> Vec<u8> 4 years ago
Manos Pitsidianakis 2944fc992b
melib/imap/untagged: handle EXPUNGE if our MSNs invalid 4 years ago
Manos Pitsidianakis 535d04f4f0
melib/imap/untagged: lower mbox count on EXPUNGE events 4 years ago
Manos Pitsidianakis cd68008e67
melib: Implement delete_messages for IMAP, Maildir 4 years ago
Manos Pitsidianakis 9ce62c735a
compose: add key selection state for gpg operations
Closes #81
4 years ago
Manos Pitsidianakis 4dd8474c30
gpgme: add PartialEq impl for Key 4 years ago
Manos Pitsidianakis afe7eed9ef
melib/compose: don't base64 encode unless it's not ascii 4 years ago
Manos Pitsidianakis 59e60f8d28
gpgme: add context flag set/get 4 years ago
Manos Pitsidianakis afee1e2be5
melib/compose: fix wrong Content-Type on PGP signatures and message/rfc822 4 years ago
Manos Pitsidianakis 5d968b7c40
imap: fix out of bounds panic on receive EXPUNGE
Closes #82
4 years ago
Manos Pitsidianakis 23ca41e3e8
add libgpgme feature 4 years ago
Manos Pitsidianakis b9c07bacef
melib: decode text inline message/rfc822 attachments 4 years ago
Manos Pitsidianakis b0e50a29bd
melib/list_management: don't ignore "NO" in List-Post 4 years ago
Manos Pitsidianakis e407b1e224
melib: add README.md and email module doco 4 years ago
Manos Pitsidianakis a1e3f269de
melib/imap: don't manually check for mailbox permissions 4 years ago
Manos Pitsidianakis e556191bab
melib/imap: hide LOGIN from debug log 4 years ago
Manos Pitsidianakis ce559b05d7
melib/imap: EXAMINE instead of SELECT in IDLE connection 4 years ago
Manos Pitsidianakis 36cc0d4212
melib/jmap: implement refresh()
Closes #77
4 years ago
Manos Pitsidianakis 425f4b9930
melib/jmap: add Type parameter to Id, State
Make Id, State have a type parameter to the object it refers to (eg
`Id<EmailObject>`) instead of just a String
4 years ago
Manos Pitsidianakis 19d4a191d8
melib/jmap: add email state sync 4 years ago
Manos Pitsidianakis 4cf0b9ffec
melib/jmap: impl copy_messages()
Closes #76
4 years ago
Manos Pitsidianakis baa44109f2
melib/thread: "merge" duplicate messages in threads 4 years ago
Manos Pitsidianakis 28deba708c
melib/imap: check if FETCH reply was intended for us
After sending a FETCH, the command results might be mixed with
unsolicited FETCH replies. Check if that happens.
4 years ago
Manos Pitsidianakis ea0fb114e1
melib/imap: delete reverse_modseq storage
Modsequences are not unique, and many messages may share the same
modsequence. So storing a reverse mapping of modsequences to messages is
invalid.
4 years ago
Manos Pitsidianakis 8e036f045c
melib/imap: accept literal astrings in bodystructure 4 years ago
Manos Pitsidianakis 3210ee5c67
melib/jmap: impl save() message
Closes #60
4 years ago
Manos Pitsidianakis cfc380b47d
melib/jmap: allow empty to,from etc fields in EmailObject 4 years ago
Manos Pitsidianakis 05e4dbcd5a
melib: update smol to 1.0.0 4 years ago
Manos Pitsidianakis 40b63cc3e0
melib/imap: fix unseen count on cache sync 4 years ago
Manos Pitsidianakis 38eff71971
IMAP: don't show \Recent flag as tag
Closes #74
4 years ago
Manos Pitsidianakis 3004789f32
melib/imap: FETCH comma-sep list on untagged Recent response
FETCHing RECENT messages when receiving an untagged RECENT response from
the server didn't separate the message numbers with comma but with
space, which is invalid.
4 years ago
Manos Pitsidianakis 9bafba3905
melib/imap: don't print raw bytes in debug prints 4 years ago
Manos Pitsidianakis 98949a4a72
melib/imap: expand special mailbox detection cases 4 years ago
Manos Pitsidianakis 10a3430233
melib/line_break: fix panics from Unicode13 linebreak test cases 4 years ago
Manos Pitsidianakis 83bee279e6
melib/email/compose: set attachment status
Set Content-Disposition: attachment to, well, attachments.
4 years ago
Manos Pitsidianakis e8f3b6aa24
melib/imap: check for max uid == 0 when resyncing 4 years ago
Manos Pitsidianakis 64a2af3777
melib/email: smarter attachment detection
Look for Content-Disposition: attachment to detect attachments
4 years ago
Manos Pitsidianakis e518b3f16d
melib/imap: use SystemTime for IMAP server timeout 4 years ago
Manos Pitsidianakis 92b25de34e
melib/EnvelopeHashBatch: impl len method 4 years ago
Manos Pitsidianakis 096c2970b3
melib/email/parser: impl RFC6532
RFC6532 International Mail Headers
4 years ago
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.
4 years ago
Manos Pitsidianakis 366e557e1c
melib/email: don't do case sensitive eq for mime parameters 4 years ago
Manos Pitsidianakis 9b0180fdbc
melib/email/parser: impl RFC5322 parser for dates 4 years ago
Manos Pitsidianakis 0e2641f7ed
melib/imap: always retry connection in watch() 4 years ago
Manos Pitsidianakis 67c722958b
melib/email/parser: quoted-printable accept message ending with soft line break 4 years ago
Manos Pitsidianakis a5b6f29f2b
melib/imap: ensure connection is alive before fetching bytes/flags 4 years ago
Manos Pitsidianakis 3b10fa3895
melib/imap: set 9min tcp keepalive on connection 4 years ago
Manos Pitsidianakis 42c4c61518
melib/connections: impl tcp keepalive 4 years ago
Manos Pitsidianakis dee62cc118
melib/imap: fix NoSelect mailboxes not showing up as subscribed 4 years ago