mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-04 15:03:08 +00:00
Polish chat and add necessary fixes
This commit is contained in:
parent
70fb6ebd3c
commit
0d399e542f
@ -23,8 +23,8 @@ use tui::{
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
use waku::{
|
||||
waku_new, waku_set_event_callback, ContentFilter, Multiaddr, ProtocolId, Running, StoreQuery,
|
||||
WakuMessage, WakuNodeHandle,
|
||||
waku_new, waku_set_event_callback, ContentFilter, Multiaddr, PagingOptions, ProtocolId,
|
||||
Running, StoreQuery, WakuMessage, WakuNodeHandle,
|
||||
};
|
||||
|
||||
enum InputMode {
|
||||
@ -78,10 +78,14 @@ fn retrieve_history(node_handle: &WakuNodeHandle<Running>) -> waku::Result<Vec<C
|
||||
start_time: Some(
|
||||
(Duration::from_secs(Utc::now().timestamp() as u64)
|
||||
- Duration::from_secs(60 * 60 * 24))
|
||||
.as_secs() as usize,
|
||||
.as_nanos() as usize,
|
||||
),
|
||||
end_time: None,
|
||||
paging_options: None,
|
||||
paging_options: Some(PagingOptions {
|
||||
page_size: 25,
|
||||
cursor: None,
|
||||
forward: true,
|
||||
}),
|
||||
},
|
||||
peer.peer_id(),
|
||||
Some(Duration::from_secs(10)),
|
||||
@ -137,9 +141,11 @@ fn main() -> std::result::Result<(), Box<dyn Error>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
unreachable!()
|
||||
waku::Event::Unrecognized(data) => {
|
||||
let mut out = std::io::stderr();
|
||||
write!(out, "Error, received unrecognized event {data}").unwrap();
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
|
||||
// app.node_handle.relay_publish_message(&WakuMessage::new(Chat2Message::new(&app.nick, format!(""))))
|
||||
|
||||
@ -38,6 +38,7 @@ impl Signal {
|
||||
#[serde(untagged, rename_all = "camelCase")]
|
||||
pub enum Event {
|
||||
WakuMessage(WakuMessageEvent),
|
||||
Unrecognized(serde_json::Value),
|
||||
}
|
||||
|
||||
/// Type of `event` field for a `message` event
|
||||
|
||||
@ -239,6 +239,7 @@ pub struct StoreQuery {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct StoreResponse {
|
||||
/// Array of retrieved historical messages in [`WakuMessage`] format
|
||||
#[serde(default)]
|
||||
messages: Vec<WakuMessage>,
|
||||
/// Paging information in [`PagingOptions`] format from which to resume further historical queries
|
||||
paging_options: Option<PagingOptions>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user