feat: read a contact's acceptance state
This commit is contained in:
parent
4ef0fdaec0
commit
1c4011325f
1 changed files with 11 additions and 0 deletions
|
|
@ -453,6 +453,17 @@ impl Store {
|
||||||
Ok(changed > 0)
|
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
|
/// The identity frozen at acceptance, if this address is currently
|
||||||
/// accepted; the token for our own mailbox travels in the next message.
|
/// 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> {
|
pub fn accepted_identity(&self, address: &str) -> Result<Option<[u8; KEY_LEN]>, Error> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue