mtxchat tidy-up

This commit is contained in:
nworbnhoj 2023-09-09 10:36:37 +10:00
parent 66738c0251
commit a46dad11d2
4 changed files with 12 additions and 6 deletions

View file

@ -40,9 +40,9 @@ mtxchat provides the following basic functionality:
The `mtxchat` code is primarily concerned with the [matrix] specific protocols, while the Chat library handles the UI and pddb storage.
Much of the code in `main.rs` & `lib.rs` has been adapted from `mtxcli`, while `url.rs` and `web.rs` are simple copies.
Much of the code in `main.rs` `lib.rs` `web.rs` & `url.rs` has been adapted from `mtxcli`.
The Chat library provides the UI to display a series of matrix events (Posts) in a matrix room (Dialogue) stored in the pddb. Each Dialogue is stored in the `pddb:dict` `mtxchat` under a descriptive `pddb:key` (ie `#xous-apps:matrix.org`).
The Chat library provides the UI to display a series of matrix events (Posts) in a matrix room (Dialogue) stored in the pddb. Each Dialogue is stored in the `pddb:dict` `mtxchat.dialogue` under a descriptive `pddb:key` (ie `#xous-apps:matrix.org`).
`mtxchat` passes a menu to the Chat UI:
* `room` to type a [matrix] room/server

View file

@ -316,11 +316,13 @@ impl<'a> MtxChat<'a> {
self.set_debug(TOKEN_KEY, &new_token);
self.logged_in = true;
} else {
log::info!(
log::warn!(
"Error: cannnot login with type: {}",
web::MTX_LOGIN_PASSWORD
);
}
} else {
log::warn!("failed to web::get_login_type()");
}
}
if self.logged_in {
@ -654,10 +656,12 @@ impl<'a> MtxChat<'a> {
// returns true if "Connect to WiFi?" yes option is chosen
//
fn wifi_try_modal (&self) -> bool {
fn wifi_try_modal(&self) -> bool {
self.modals.add_list_item("yes").expect("failed radio yes");
self.modals.add_list_item("no").expect("failed radio no");
self.modals.get_radiobutton("Connect to WiFi?").expect("failed radiobutton modal");
self.modals
.get_radiobutton("Connect to WiFi?")
.expect("failed radiobutton modal");
match self.modals.get_radio_index() {
Ok(button) => button == 0,
_ => false,

View file

@ -25,6 +25,8 @@ pub enum ChatOp {
GamRawkeys,
/// redraw our Chat UI
GamRedraw,
/// Show some user help
Help,
/// Add a new MenuItem to the App menu
MenuAdd,
/// Add a new Post to the Dialogue

View file

@ -149,7 +149,7 @@ impl Ui {
(Some(dict), Some(key)) => {
match self
.pddb
.get(&dict, &key, None, false, false, None, None::<fn()>)
.get(&dict, &key, None, true, false, None, None::<fn()>)
{
Ok(mut pddb_key) => {
let mut bytes = [0u8; dialogue::MAX_BYTES + 2];