diff --git a/Cargo.lock b/Cargo.lock index 2ccb6ae..37ee401 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -428,9 +428,9 @@ dependencies = [ [[package]] name = "imap-proto" -version = "0.16.4" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e70cd66882c8cb1c9802096ba75212822153c51478dc61621e1a22f6c92361" +checksum = "ba1f9b30846c3d04371159ef3a0413ce7c1ae0a8c619cd255c60b3d902553f22" dependencies = [ "nom", ] diff --git a/Cargo.toml b/Cargo.toml index 3bacf63..cd400a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,10 @@ [package] name = "imap" version = "3.0.0-alpha.15" -authors = ["Jon Gjengset ", - "Matt McCoy "] +authors = [ + "Jon Gjengset ", + "Matt McCoy ", +] documentation = "https://docs.rs/imap/" repository = "https://github.com/jonhoo/rust-imap" homepage = "https://github.com/jonhoo/rust-imap" @@ -26,10 +28,10 @@ native-tls = { version = "0.2.2", optional = true } rustls-connector = { version = "0.19.0", optional = true } regex = "1.0" bufstream = "0.1.3" -imap-proto = "0.16.1" +imap-proto = "0.16.6" nom = { version = "7.1.0", default-features = false } base64 = "0.22" -chrono = { version = "0.4.37", default-features = false, features = ["std"]} +chrono = { version = "0.4.37", default-features = false, features = ["std"] } lazy_static = "1.4" ouroboros = "0.18.0" diff --git a/src/types/fetch.rs b/src/types/fetch.rs index 57e914f..08ff6fb 100644 --- a/src/types/fetch.rs +++ b/src/types/fetch.rs @@ -241,6 +241,28 @@ impl<'a> Fetch<'a> { }) } + /// Extract the `X-GM-MSGID` of a `FETCH` response + /// + /// This is a Gmail-specific extension. See their + /// [developer's page](https://developers.google.com/gmail/imap/imap-extensions) for details. + pub fn gmail_msgid(&'a self) -> Option<&'a u64> { + self.fetch.iter().find_map(|av| match av { + AttributeValue::GmailMsgId(msgid) => Some(msgid), + _ => None, + }) + } + + /// Extract the `X-GM-THRID` of a `FETCH` response + /// + /// This is a Gmail-specific extension. See their + /// [developer's page](https://developers.google.com/gmail/imap/imap-extensions) for details. + pub fn gmail_thrid(&'a self) -> Option<&'a u64> { + self.fetch.iter().find_map(|av| match av { + AttributeValue::GmailThrId(thrid) => Some(thrid), + _ => None, + }) + } + /// Get an owned copy of the [`Fetch`]. pub fn into_owned(self) -> Fetch<'static> { Fetch {