forked from jonhoo/rust-imap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for APPENDUID response data
If the `UIDPLUS` extension is supported, the server will reply to `APPEND` commands with the UID of the new message. This can even be a list of UIDs if the `MULTIAPPEND` extension is also supported. Make this information available to the user as the result of an `AppendCmd`. The added doc strings have links to the relevant RFCs. Related to jonhoo#131.
- Loading branch information
Showing
4 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use imap_proto::UidSetMember; | ||
use std::fmt; | ||
|
||
/// Meta-information about a message, as returned by | ||
/// [`APPEND`](https://tools.ietf.org/html/rfc3501#section-6.3.11). | ||
/// Note that `APPEND` only returns any data if certain extensions are enabled, | ||
/// for example [`UIDPLUS`](https://tools.ietf.org/html/rfc4315). | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
#[non_exhaustive] | ||
pub struct Appended { | ||
/// The unique identifier validity value of the mailbox that the message was appended to. | ||
/// See [`Uid`] for more details. Only present if server supports [`UIDPLUS`](https://tools.ietf.org/html/rfc4315). | ||
pub uid_validity: Option<u32>, | ||
|
||
/// The unique identifier value of the messages that were appended. | ||
/// Only present if server supports [`UIDPLUS`](https://tools.ietf.org/html/rfc4315). | ||
/// Contains only a single value unless the [`MULTIAPPEND`](https://tools.ietf.org/html/rfc3502) extension | ||
/// was used to upload multiple messages. | ||
pub uids: Option<Vec<UidSetMember>>, | ||
} | ||
|
||
#[allow(clippy::derivable_impls)] | ||
impl Default for Appended { | ||
fn default() -> Appended { | ||
Appended { | ||
uid_validity: None, | ||
uids: None, | ||
} | ||
} | ||
} | ||
|
||
impl fmt::Display for Appended { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
write!( | ||
f, | ||
"uid_validity: {:?}, uids: {:?}", | ||
self.uid_validity, self.uids, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters