Connecting as guess in the first run
This commit is contained in:
parent
f7db449adc
commit
d9a7369df8
1 changed files with 21 additions and 2 deletions
23
src/app.rs
23
src/app.rs
|
@ -57,6 +57,24 @@ impl AppLogic {
|
||||||
Err(error) => println!("{:?}", error)
|
Err(error) => println!("{:?}", error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn connect_guest(&mut self, server: Option<String>) {
|
||||||
|
let server_url = match server {
|
||||||
|
Some(s) => s,
|
||||||
|
None => String::from("https://matrix.org")
|
||||||
|
};
|
||||||
|
|
||||||
|
let res = self.command_chan_tx
|
||||||
|
.send(Command::Connect {
|
||||||
|
homeserver_url: Url::parse(&server_url).unwrap(),
|
||||||
|
connection_method: ConnectionMethod::Guest
|
||||||
|
});
|
||||||
|
|
||||||
|
match res {
|
||||||
|
Ok(_) => {},
|
||||||
|
Err(error) => println!("{:?}", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// State for the main thread.
|
/// State for the main thread.
|
||||||
|
@ -155,8 +173,9 @@ impl App {
|
||||||
let args = env::args().collect::<Vec<_>>();
|
let args = env::args().collect::<Vec<_>>();
|
||||||
let args_refs = args.iter().map(|x| &x[..]).collect::<Vec<_>>();
|
let args_refs = args.iter().map(|x| &x[..]).collect::<Vec<_>>();
|
||||||
|
|
||||||
// TODO: connect as guess user or use stored data
|
// connecting as guest
|
||||||
//self.logic.lock().unwrap().connect(String::from("TODO"), String::from("TODO"), None);
|
// TODO: Use stored user if exists
|
||||||
|
self.logic.lock().unwrap().connect_guest(None);
|
||||||
|
|
||||||
// Poll the matrix communication thread channel and run the closures to allow
|
// Poll the matrix communication thread channel and run the closures to allow
|
||||||
// the threads to run actions in the main loop.
|
// the threads to run actions in the main loop.
|
||||||
|
|
Loading…
Reference in a new issue