fumi-core #1
1 changed files with 11 additions and 2 deletions
|
|
@ -887,12 +887,21 @@ pub extern "C" fn smol_contact(store: *mut Store, address: *const c_char) -> *mu
|
|||
let address = text(address)?;
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
// History entries serialize as objects, matching smol_contacts and
|
||||
// the facade's parser — a bare tuple would cross the FFI as a JSON
|
||||
// array and break the first contact that ever gains rotation history.
|
||||
struct History {
|
||||
key: String,
|
||||
until: i64,
|
||||
}
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct Out {
|
||||
key: String,
|
||||
verified: bool,
|
||||
active: Option<bool>,
|
||||
accepted_key: Option<String>,
|
||||
history: Vec<(String, i64)>,
|
||||
history: Vec<History>,
|
||||
}
|
||||
let Some((key, verified)) = store.contact(address)? else {
|
||||
return Ok(ser(&Out {
|
||||
|
|
@ -913,7 +922,7 @@ pub extern "C" fn smol_contact(store: *mut Store, address: *const c_char) -> *mu
|
|||
history: store
|
||||
.history(address)?
|
||||
.into_iter()
|
||||
.map(|(key, until)| (b32(&key), until))
|
||||
.map(|(key, until)| History { key: b32(&key), until })
|
||||
.collect(),
|
||||
})?)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue