mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
fix ChatOp::PostAdd to default correctly to dialogue_key set by ChatOp::DialogueSet
This commit is contained in:
parent
7e485885b7
commit
ffa3d56af4
1 changed files with 20 additions and 15 deletions
|
|
@ -354,7 +354,7 @@ pub fn server(
|
||||||
log::info!("my PID is {}", xous::process::id());
|
log::info!("my PID is {}", xous::process::id());
|
||||||
|
|
||||||
let mut ui = ui::Ui::new(sid, app_name, app_menu, app_cid, opcode_event);
|
let mut ui = ui::Ui::new(sid, app_name, app_menu, app_cid, opcode_event);
|
||||||
|
let mut dialogue_key = None;
|
||||||
let mut allow_redraw = false;
|
let mut allow_redraw = false;
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(sid).unwrap();
|
let msg = xous::receive_message(sid).unwrap();
|
||||||
|
|
@ -408,7 +408,7 @@ pub fn server(
|
||||||
let buffer =
|
let buffer =
|
||||||
unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
||||||
let dialogue = buffer.to_original::<Dialogue, _>().unwrap();
|
let dialogue = buffer.to_original::<Dialogue, _>().unwrap();
|
||||||
let dialogue_key = match dialogue.key {
|
dialogue_key = match dialogue.key {
|
||||||
Some(key) => Some(key.to_string()),
|
Some(key) => Some(key.to_string()),
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
@ -526,19 +526,24 @@ pub fn server(
|
||||||
}
|
}
|
||||||
Some(ChatOp::PostAdd) => {
|
Some(ChatOp::PostAdd) => {
|
||||||
log::info!("ChatOp::PostAdd");
|
log::info!("ChatOp::PostAdd");
|
||||||
let buffer =
|
match dialogue_key {
|
||||||
unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
Some(ref dialogue_id) => {
|
||||||
match buffer.to_original::<api::Post, _>() {
|
let buffer =
|
||||||
Ok(post) => ui
|
unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
||||||
.post_add(
|
match buffer.to_original::<api::Post, _>() {
|
||||||
post.dialogue_id.as_str().unwrap(),
|
Ok(post) => ui
|
||||||
post.author.as_str().unwrap(),
|
.post_add(
|
||||||
post.timestamp,
|
&dialogue_id,
|
||||||
post.text.as_str().unwrap(),
|
post.author.as_str().unwrap(),
|
||||||
None, // TODO implement
|
post.timestamp,
|
||||||
)
|
post.text.as_str().unwrap(),
|
||||||
.unwrap(),
|
None, // TODO implement
|
||||||
Err(e) => log::warn!("failed to deserialize Post: {:?}", e),
|
)
|
||||||
|
.unwrap(),
|
||||||
|
Err(e) => log::warn!("failed to deserialize Post: {:?}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => log::warn!("failed to PostAdd with Dialogue == None"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(ChatOp::PostDel) => {
|
Some(ChatOp::PostDel) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue