diff --git a/Cargo.lock b/Cargo.lock index 2ccb6ae..501b986 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.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e70cd66882c8cb1c9802096ba75212822153c51478dc61621e1a22f6c92361" +checksum = "de555d9526462b6f9ece826a26fb7c67eca9a0245bd9ff84fa91972a5d5d8856" dependencies = [ "nom", ] diff --git a/Cargo.toml b/Cargo.toml index 3bacf63..42841ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ 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 = { "path" = "../tokio-imap/imap-proto"} nom = { version = "7.1.0", default-features = false } base64 = "0.22" chrono = { version = "0.4.37", default-features = false, features = ["std"]} 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 {