mirror of
https://github.com/MeexReay/bRAC.git
synced 2025-06-24 10:52:58 +03:00
minor fixes
This commit is contained in:
parent
f615811f90
commit
492668bfd5
@ -149,6 +149,14 @@ macro_rules! gui_checkbox_setting {
|
||||
};
|
||||
}
|
||||
|
||||
fn update_window_title(ctx: Arc<Context>) {
|
||||
GLOBAL.with(|global| {
|
||||
if let Some(ui) = &*global.borrow() {
|
||||
ui.window.set_title(Some(&format!("bRAC - Connected to {} as {}", ctx.config(|o| o.host.clone()), &ctx.name())))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn open_settings(ctx: Arc<Context>, app: &Application) {
|
||||
let vbox = GtkBox::new(Orientation::Vertical, 10);
|
||||
|
||||
@ -288,6 +296,7 @@ fn open_settings(ctx: Arc<Context>, app: &Application) {
|
||||
};
|
||||
ctx.set_config(&config);
|
||||
save_config(get_config_path(), &config);
|
||||
update_window_title(ctx.clone());
|
||||
}
|
||||
));
|
||||
|
||||
@ -471,6 +480,7 @@ fn build_ui(ctx: Arc<Context>, app: &Application) -> UiModel {
|
||||
config.host = url.clone();
|
||||
ctx.set_config(&config);
|
||||
save_config(get_config_path(), &config);
|
||||
update_window_title(ctx.clone());
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -151,14 +151,8 @@ pub fn prepare_message(ctx: Arc<Context>, message: &str) -> String {
|
||||
},
|
||||
message,
|
||||
if !ctx.config(|o| o.hide_my_ip) {
|
||||
let spaces = if ctx.config(|o| o.auth_enabled) {
|
||||
39
|
||||
} else {
|
||||
54
|
||||
};
|
||||
|
||||
if message.chars().count() < spaces {
|
||||
" ".repeat(spaces-message.chars().count())
|
||||
if message.chars().count() < 54 {
|
||||
" ".repeat(54-message.chars().count())
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ pub fn connect(host: &str, proxy: Option<String>) -> Result<RacStream, Box<dyn E
|
||||
pub fn send_message_spoof_auth(stream: &mut RacStream, message: &str) -> Result<(), Box<dyn Error>> {
|
||||
let Some((name, message)) = message.split_once("> ") else { return send_message(stream, message) };
|
||||
|
||||
if let Ok(f) = send_message_auth(stream, &name, &message, &message) {
|
||||
if let Ok(f) = send_message_auth(stream, &name, &name, &message) {
|
||||
if f != 0 {
|
||||
let name = format!("\x1f{name}");
|
||||
register_user(stream, &name, &name)?;
|
||||
@ -213,10 +213,10 @@ pub fn register_user(
|
||||
name: &str,
|
||||
password: &str
|
||||
) -> Result<bool, Box<dyn Error>> {
|
||||
match stream {
|
||||
dbg!(match stream {
|
||||
RacStream::WRAC(websocket) => wrac::register_user(websocket, name, password),
|
||||
RacStream::RAC(stream) => rac::register_user(stream, name, password)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Send message with auth
|
||||
@ -236,10 +236,10 @@ pub fn send_message_auth(
|
||||
password: &str,
|
||||
message: &str
|
||||
) -> Result<u8, Box<dyn Error>> {
|
||||
match stream {
|
||||
dbg!(match stream {
|
||||
RacStream::WRAC(websocket) => wrac::send_message_auth(websocket, name, password, message),
|
||||
RacStream::RAC(stream) => rac::send_message_auth(stream, name, password, message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Read messages
|
||||
|
Loading…
x
Reference in New Issue
Block a user