commit eafd59ae2dda6ab0857e560f84ca667ca58bbf5c
parent e37498bb0e87fceacb59a152493d9bce21564518
Author: Strange <StrangeGuy6228@protonmail.com>
Date: Thu, 9 May 2024 00:57:05 +0530
added --keep-alive defaut to 0 | untested
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -159,13 +159,15 @@ struct Opts {
dnmx_password: Option<String>,
#[arg(short = 'c', long, default_value = "default")]
profile: String,
+ #[arg(long,default_value = "0")]
+ keepalive_send_to: Option<String>,
}
struct LeChatPHPConfig {
url: String,
datetime_fmt: String,
page_php: String,
- keepalive_send_to: Option<String>,
+ keepalive_send_to: String,
members_tag: String,
staffs_tag: String,
}
@@ -176,7 +178,7 @@ impl LeChatPHPConfig {
url: "http://blkhatjxlrvc5aevqzz5t6kxldayog6jlx5h7glnu44euzongl4fh5ad.onion".to_owned(),
datetime_fmt: "%m-%d %H:%M:%S".to_owned(),
page_php: "chat.php".to_owned(),
- keepalive_send_to: Some("0".to_owned()),
+ keepalive_send_to: "0".to_owned(),
members_tag: "[M] ".to_owned(),
staffs_tag: "[Staff] ".to_owned(),
}
@@ -284,7 +286,7 @@ impl LeChatPHPClient {
let send_to = self.config.keepalive_send_to.clone();
thread::spawn(move || loop {
let clb = || {
- tx.send(PostType::Post("<keepalive>".to_owned(), send_to.clone()))
+ tx.send(PostType::Post("<keepalive>".to_owned(), Some(send_to.clone())))
.unwrap();
tx.send(PostType::DeleteLast).unwrap();
};
@@ -2020,7 +2022,7 @@ impl ChatClient {
c.config.page_php = params.page_php.unwrap_or("chat.php".to_owned());
c.config.datetime_fmt = params.datetime_fmt.unwrap_or("%m-%d %H:%M:%S".to_owned());
c.config.members_tag = params.members_tag.unwrap_or("[M] ".to_owned());
- c.config.keepalive_send_to = None;
+ c.config.keepalive_send_to = params.keepalive_send_to.unwrap_or("0".to_owned());
Self {
le_chat_php_client: c,
}
@@ -2076,6 +2078,7 @@ struct Params {
manual_captcha: bool,
refresh_rate: u64,
max_login_retry: isize,
+ keepalive_send_to: Option<String>,
}
#[derive(Clone)]
@@ -2354,6 +2357,7 @@ fn main() -> anyhow::Result<()> {
manual_captcha: opts.manual_captcha,
refresh_rate: opts.refresh_rate,
max_login_retry: opts.max_login_retry,
+ keepalive_send_to: opts.keepalive_send_to,
};
ChatClient::new(params).run_forever();