|
23 | 23 | //! **The enabled flag is not part of this.** A shared, room or equipment |
24 | 24 | //! mailbox is a disabled account by design and is still a recipient. |
25 | 25 |
|
26 | | -use crate::change::ValueId; |
| 26 | +use crate::change::{KeyId, ValueId}; |
| 27 | +use ogar_dir_core::Guid128; |
27 | 28 |
|
28 | 29 | /// `msExchRemoteRecipientType` flag bits. |
29 | 30 | pub mod flag { |
@@ -334,6 +335,59 @@ impl Recipient { |
334 | 335 | } |
335 | 336 | } |
336 | 337 |
|
| 338 | +/// What Exchange knows an object as, read by its GUID: its recipient types |
| 339 | +/// ([`Recipient`]), its mailbox's `ExchangeGuid` (`msExchMailboxGuid` |
| 340 | +/// on-premises; Exchange Online keeps the same value as the mailbox's |
| 341 | +/// `ExchangeGuid` across a move) and the address it receives at |
| 342 | +/// (`PrimarySmtpAddress`). |
| 343 | +/// |
| 344 | +/// The identity is `node` and, for a mailbox, `exchange_guid`; the address is |
| 345 | +/// a value of the identity, never the key it is found by. |
| 346 | +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 347 | +pub struct ExchangeIdentity { |
| 348 | + /// The object (`objectGUID`). |
| 349 | + pub node: Guid128, |
| 350 | + /// Recipient types; `None` = the source did not read them. |
| 351 | + pub recipient: Option<Recipient>, |
| 352 | + /// `msExchMailboxGuid`; `None` = no mailbox, or not read. |
| 353 | + pub exchange_guid: Option<Guid128>, |
| 354 | + /// `PrimarySmtpAddress`. |
| 355 | + pub primary_smtp: Option<ValueId>, |
| 356 | +} |
| 357 | + |
| 358 | +/// What an object's `mail` label resolves to. The label is the trigger: its |
| 359 | +/// address is looked up once, among the addresses objects actually hold |
| 360 | +/// (UPN, `proxyAddresses`, routing address), and the holder's |
| 361 | +/// [`ExchangeIdentity`] is hydrated by GUID. The label itself never reserves |
| 362 | +/// the address and never decides delivery or access. |
| 363 | +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 364 | +pub enum MailLabel { |
| 365 | + /// The label is an address the labelled object holds itself. |
| 366 | + Own(ExchangeIdentity), |
| 367 | + /// The label names an address another object holds: an admin account |
| 368 | + /// whose `mail` is a user's mailbox (a password-reset target), say. The |
| 369 | + /// identity is the holder's. |
| 370 | + Elsewhere { |
| 371 | + /// The label's comparison key. |
| 372 | + key: KeyId, |
| 373 | + /// The object that holds the address. |
| 374 | + holder: ExchangeIdentity, |
| 375 | + }, |
| 376 | + /// Several objects hold the address: none is hydrated, the holders are |
| 377 | + /// listed (sorted). |
| 378 | + Contested { |
| 379 | + /// The label's comparison key. |
| 380 | + key: KeyId, |
| 381 | + /// Every holder. |
| 382 | + holders: Vec<Guid128>, |
| 383 | + }, |
| 384 | + /// No object holds the address: a stale label. |
| 385 | + Unheld { |
| 386 | + /// The label's comparison key. |
| 387 | + key: KeyId, |
| 388 | + }, |
| 389 | +} |
| 390 | + |
337 | 391 | /// One step of the hybrid remote-mailbox lifecycle (semantic; the actuator |
338 | 392 | /// maps it to its own commands). |
339 | 393 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
|
0 commit comments