Skip to content

Commit e717eb1

Browse files
committed
Add support for gmail x-gm-thrid
1 parent 5900f5e commit e717eb1

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ native-tls = { version = "0.2.2", optional = true }
2626
rustls-connector = { version = "0.19.0", optional = true }
2727
regex = "1.0"
2828
bufstream = "0.1.3"
29-
imap-proto = "0.16.1"
29+
imap-proto = { "path" = "../tokio-imap/imap-proto"}
3030
nom = { version = "7.1.0", default-features = false }
3131
base64 = "0.22"
3232
chrono = { version = "0.4.37", default-features = false, features = ["std"]}

src/types/fetch.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,28 @@ impl<'a> Fetch<'a> {
241241
})
242242
}
243243

244+
/// Extract the `X-GM-MSGID` of a `FETCH` response
245+
///
246+
/// This is a Gmail-specific extension. See their
247+
/// [developer's page](https://developers.google.com/gmail/imap/imap-extensions) for details.
248+
pub fn gmail_msgid(&'a self) -> Option<&'a u64> {
249+
self.fetch.iter().find_map(|av| match av {
250+
AttributeValue::GmailMsgId(msgid) => Some(msgid),
251+
_ => None,
252+
})
253+
}
254+
255+
/// Extract the `X-GM-THRID` of a `FETCH` response
256+
///
257+
/// This is a Gmail-specific extension. See their
258+
/// [developer's page](https://developers.google.com/gmail/imap/imap-extensions) for details.
259+
pub fn gmail_thrid(&'a self) -> Option<&'a u64> {
260+
self.fetch.iter().find_map(|av| match av {
261+
AttributeValue::GmailThrId(thrid) => Some(thrid),
262+
_ => None,
263+
})
264+
}
265+
244266
/// Get an owned copy of the [`Fetch`].
245267
pub fn into_owned(self) -> Fetch<'static> {
246268
Fetch {

0 commit comments

Comments
 (0)