Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down
22 changes: 22 additions & 0 deletions src/types/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading