feat: read a contact's acceptance state

This commit is contained in:
randogoth 2026-09-29 11:08:05 +03:00
parent 4ef0fdaec0
commit 1c4011325f

View file

@ -453,6 +453,17 @@ impl Store {
Ok(changed > 0)
}
/// The acceptance state of an address, if it was ever accepted:
/// Some(true) main tier, Some(false) blocked, None never.
pub fn accepted_state(&self, address: &str) -> Result<Option<bool>, Error> {
Ok(self
.one::<i64>(
"SELECT active FROM accepted WHERE address = ?1",
&[&address],
)?
.map(|active| active != 0))
}
/// The identity frozen at acceptance, if this address is currently
/// accepted; the token for our own mailbox travels in the next message.
pub fn accepted_identity(&self, address: &str) -> Result<Option<[u8; KEY_LEN]>, Error> {