Commit graph

167 commits

Author SHA1 Message Date
Jos van den Oever
4c94c87686 Clippy fixes 2018-09-12 19:31:26 +02:00
Johannes Schilling
b7927aa33e client: remove outdated comment from fn login 2018-08-30 21:27:52 +02:00
Johannes Schilling
73efb03882 client: more docs, move Connection impl block
as discussed/suggested at
https://github.com/mattnenterprise/rust-imap/pull/84#pullrequestreview-150636568
2018-08-30 19:32:33 +02:00
Johannes Schilling
1708db5ae2 adjust tests to the change in structs 2018-08-29 17:46:39 +02:00
Johannes Schilling
515d574742 src/lib.rs: sync code in doc-comment with examples/basic.rs
is there some way to include the code directly from examples/basic.rs?
2018-08-29 17:37:57 +02:00
Johannes Schilling
da2ac87ca7 client: move matching in login functions to macro
as suggested in PR #84 comments
2018-08-29 15:55:43 +02:00
Johannes Schilling
71f8e6bcd2 rename types as per suggestion in PR #84 2018-08-29 14:40:02 +02:00
Johannes Schilling
820d1eccf7 client: separate out UnauthenticatedClient, InnerClient
fixes #80 (client separation)
2018-08-11 12:38:50 +02:00
Jon Gjengset
72925cf1d8
Handle unilateral server responses
Fixes #81.
2018-07-21 12:29:50 -04:00
Jon Gjengset
4c4fd89232
rustfmt 2018-07-21 12:29:34 -04:00
Jon Gjengset
dea9398e08
Don't crash when parsing empty result
Partial fix for #81.
2018-07-18 16:14:35 -04:00
Shaun Savage
4bdfe96915 changed email to body 2018-06-28 16:36:07 +00:00
Shaun Savage
ba8afa7918 changed try! to ? 2018-06-27 23:17:49 +00:00
Shaun Savage
923e01279a remove unwrap() 2018-06-26 20:23:11 +00:00
Jon Gjengset
d132de4834
New imap-proto 2018-04-27 16:27:38 -04:00
Jon Gjengset
c28d08851c
Bump version for new imap-proto 2018-04-27 10:56:03 -04:00
Jon Gjengset
73c8d0ddc2
Move README example into src/lib.rs
This way it'll be run as a doctest and we'll know if it breaks (again).

Fixes #67.
2018-04-03 13:01:59 -04:00
Jon Gjengset
1d4d6288c1
rustfmt 2018-04-03 13:01:35 -04:00
Curtis McEnroe
6b4461eb07
Borrow TlsConnector
TlsConnector is meant to be reusable and there is no reason to take
ownership over one.
2018-03-18 22:18:15 -04:00
todd
a2df6fffd8 When printing debug info, slice from the start of the line to the CRLF 2018-02-24 16:06:37 -05:00
Jon Gjengset
590b80e3a6 Add structured results for all values using imap-proto (#58)
* First stab at structured types (#28)

Tests currently fail due to djc/imap-proto#2.

LSUB is also broken due to djc/imap-proto#4 (but we don't have tests for
that atm).

* Also parse out RFC822 fetch responses

* Make all the things zero-copy

* Also delegate IntoIterator for ZeroCopy ref

* Fix UNSEEN and LSUB

All tests now pass

* Address @sanmai-NL comments

* Correctly handle incomplete parser responses

* No need for git dep anymore
2018-02-09 11:22:20 -05:00
Jon Gjengset
4332d09f0d
cargo fmt 2017-11-02 22:56:22 -04:00
rhn
5acf34c3b4 Ensures that some operations don't accept invalid data.
Invalid characters in input strings are \r and \n, according to RFC3501 section 4.3.
2017-11-02 21:15:48 +01:00
rhn
c899986685 Make Bad Response error print the actual response 2017-11-02 21:15:48 +01:00
rhn
ed47ae34b7 Replace tabs with 4-spaces 2017-11-02 21:06:13 +01:00
rhn
61485c9036 Quotes various astring tokens as per RFC 3501
Some notable exceptions: messagebox names are defined as `INBOX / astring`, but with this change, INBOX is also quoted.
The `list-mailbox` token is not quoted, as it is not `astring`.
2017-11-02 21:05:29 +01:00
rhn
13316f33b8 Uses raw string for quote!, and adds qoute! tests. 2017-11-02 20:43:12 +01:00
Giulio Collura
1ad1f1f847 Escape password according to RFC3501
Rebased by rhn <gihu.rhn@porcupinefactory.org>
2017-11-02 20:42:08 +01:00
Jon Gjengset
542ee159a4
Remove questionable Ord derives 2017-10-30 20:57:26 -04:00
Sander Maijers
dc7ad26ac1
Make types eagerly implement common traits
See https://rust-lang-nursery.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits
2017-10-30 20:57:06 -04:00
Sander Maijers
0779d3b15e
Don’t panic on receiving data not encoded in UTF-8
Return a `Result` instead.
2017-10-30 20:57:06 -04:00
Jon Gjengset
7c95ae76d6 Swap openssl for native-tls (#43)
* Replace openssl with native-tls

* Add From<TlsError> to allow builder()?

* Update AppVeyor config

* No email since it's not configured
2017-10-01 19:53:03 -04:00
Jon Gjengset
e65bbe1006
rustfmt. fixes #29 2017-09-30 17:58:30 -04:00
Jon Gjengset
b07216ca7a Make IDLE API be more straightforward (#41)
In particular, the API for `IdleHandle` now reflects that it is only
really meant for single-use. It mutably borrows the `Client`, so once
`wait` returns there isn't really a good reason to keep the `IdleHandle`
around (because you'll likely want to issue some other commands).

There is something to be said for being able to operate on the IDLE
stream, but we'll leave that for later.

This also avoids some unfortunate unavoidable panics when the connection
fails while the client is IDLEing.
2017-09-29 22:37:15 -04:00
Jon Gjengset
8383b47f35 Use BufStream for better I/O handling (#39)
* Use bufstream for better read/write

* Read with length 0 == EOF

* Adapt read_delay test to write one chat at a time

* Add test for eof reads

* Neater interface for MockStream
2017-09-27 17:38:51 -04:00
Matt McCoy
b0a095e292 Remove unneeded to_string() function calls
The code was calling to_string() which was turning
String types into String types. This is redundant and we don't need to do it.
2017-07-10 21:47:54 -04:00
Matt McCoy
86e1d46507 rustfmt the codebase (#36)
This will ensure that we are properly formatting this library code according to rust standards
2017-07-10 21:38:13 -04:00
Matt McCoy
fe398fb531 This fixes #23 don't put 0 size read result into buffer. This will prevent it from filling up memory when reading responses 2017-06-20 19:14:00 -04:00
Jos van den Oever
08c2b6847b Add APPEND call. (#30) 2017-05-02 22:08:24 -04:00
drevilt
89a8d0eaf3 update to openssl 0.9 (#31) 2017-05-01 15:39:12 -04:00
Jon Gjengset
e5b4346114 Add IMAP IDLE support (#27)
* Add IMAP IDLE support

This patch adds support for the IMAP IDLE command specified in RFC 2177.
It allows clients to block while waiting for changes to a selected
mailbox, without having to poll the server. This is especially useful
for monitoring a mailbox for new messages.

The API is currently somewhat primitive: users can call `Client::idle()`
to get an IDLE "handle", which they can then call `wait()` on to block
until a change is detected. The implementation also provides
`wait_keepalive()` (which tries to avoid connection timeouts) and
`wait_timeout()` (which allows the user to specify the maximum time to
block).

Further down the line, the handle should probably also implement
`Iterator` to allow clients to watch new events as they happen. This
*could* be implemented today, but given that most other `Client` methods
just return unparsed strings at the moment, I didn't feel like that
enhancement was a high priority. For now, users will have to manually
query the mailbox for what changed.

Fixes #26.

* Avoid unnecessary as_bytes()

* Make wait_keepalive interval configurable

* Avoid ?, which requires Rust 1.13
2017-03-02 17:55:32 -05:00
drevilt
59163929d3 update regex to 0.2 (#25) 2017-03-02 17:16:22 -05:00
drevilt
dc3b4f92e6 update to openssl 0.8 and unspecify micro versions (#22) 2017-03-02 17:08:54 -05:00
Matt McCoy
576b12b68a Use try! for conversion of io error to my error 2016-07-14 20:05:03 -04:00
Matt McCoy
75410ed5b5 Adding debugging functionality 2016-07-14 19:58:25 -04:00
Matt McCoy
e033e4bcde Removing print from readline 2016-07-14 16:35:38 -04:00
Miquel Ruiz
6e872bb340 Refactor tests to better support UID commands 2016-07-12 10:37:09 +01:00
Miquel Ruiz
eb0b4d9b50 Support for UID FETCH & tests 2016-07-11 22:48:03 +01:00
Miquel Ruiz
2f1af34b2d Support for UID COPY & tests 2016-07-11 22:44:46 +01:00
Matt McCoy
2f73134f64 Merge pull request #17 from miquelruiz/master
Add support for "STORE" command
2016-07-11 13:24:43 -04:00