Skip to content

Commit

Permalink
Fixed build on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger committed Feb 9, 2025
1 parent c3b2ac2 commit 8fdf670
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions crates/icboard/src/bbs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use async_recursion::async_recursion;
use icy_board_engine::{
icy_board::{
bbs::BBS,
login_server::{SecureWebsocket, Telnet, Websocket, SSH},
login_server::{SecureWebsocket, Telnet, Websocket},
state::{IcyBoardState, NodeState},
IcyBoard,
},
Expand Down Expand Up @@ -62,9 +62,9 @@ pub async fn await_telnet_connections(con: Telnet, board: Arc<tokio::sync::Mutex
bbs.lock().await.get_open_connections().await.lock().await[node].as_mut().unwrap().handle = Some(handle);
}
}

/*
pub async fn await_ssh_connections(_ssh: SSH, _board: Arc<tokio::sync::Mutex<IcyBoard>>, _bbs: Arc<Mutex<BBS>>) -> Res<()> {
/* let addr = if ssh.address.is_empty() {
let addr = if ssh.address.is_empty() {
format!("0.0.0.0:{}", ssh.port)
} else {
format!("{}:{}", ssh.address, ssh.port)
Expand Down Expand Up @@ -102,9 +102,9 @@ pub async fn await_ssh_connections(_ssh: SSH, _board: Arc<tokio::sync::Mutex<Icy
})
.unwrap();
bbs.lock().await.get_open_connections().await.lock().await[node].as_mut().unwrap().handle = Some(handle);
}*/
}
Ok(())
}
}*/

pub async fn await_websocket_connections(con: Websocket, board: Arc<tokio::sync::Mutex<IcyBoard>>, bbs: Arc<Mutex<BBS>>) -> Res<()> {
let addr = if con.address.is_empty() {
Expand Down
5 changes: 3 additions & 2 deletions crates/icboard/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use system_statistics_screen::{SystemStatisticsScreen, SystemStatisticsScreenMes
use tokio::sync::Mutex;
use tui::{print_exit_screen, Tui};

use crate::bbs::{await_securewebsocket_connections, await_ssh_connections, await_websocket_connections};
use crate::bbs::{await_securewebsocket_connections, await_websocket_connections};

mod bbs;
mod call_wait_screen;
Expand Down Expand Up @@ -136,6 +136,7 @@ async fn start_icy_board(arguments: &Cli, file: PathBuf) -> Res<()> {
.unwrap();
}

/*
let ssh_connection = board.lock().await.config.login_server.ssh.clone();
if ssh_connection.is_enabled {
let bbs: Arc<Mutex<BBS>> = bbs.clone();
Expand All @@ -148,7 +149,7 @@ async fn start_icy_board(arguments: &Cli, file: PathBuf) -> Res<()> {
});
})
.unwrap();
}
}*/

let websocket_connection = board.lock().await.config.login_server.websocket.clone();
if websocket_connection.is_enabled {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::os::unix::fs::MetadataExt;
use std::path::PathBuf;

use async_recursion::async_recursion;
Expand Down Expand Up @@ -60,7 +59,7 @@ impl IcyBoardState {
let mut total_size = 0;
for path in &self.session.flagged_files {
if let Ok(data) = path.metadata() {
total_size += data.size();
total_size += data.len();
}
}
self.display_text(IceText::BatchDownloadSize, display_flags::DEFAULT).await?;
Expand Down Expand Up @@ -236,7 +235,7 @@ impl IcyBoardState {
async fn list_dl_batch(&mut self) -> Res<()> {
self.new_line().await?;
for (i, path) in self.session.flagged_files.clone().iter().enumerate() {
let size = if let Ok(data) = path.metadata() { data.size() } else { 0 };
let size = if let Ok(data) = path.metadata() { data.len() } else { 0 };
self.display_text(IceText::FileSelected, display_flags::DEFAULT).await?;
self.set_color(TerminalTarget::Both, IcbColor::dos_light_green()).await?;

Expand Down
2 changes: 1 addition & 1 deletion crates/icy_net/src/connection/websocket.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Connection, ConnectionType};
use async_trait::async_trait;
use bytes::Bytes;
use futures_util::{SinkExt, StreamExt, TryStreamExt};
use futures_util::{SinkExt, StreamExt};
use http::Uri;
use std::io;
use std::io::ErrorKind;
Expand Down
2 changes: 1 addition & 1 deletion crates/icy_net/src/termcap_detect.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{os::unix::thread, time::Duration};
use std::time::Duration;

use regex::Regex;
use tokio::time::sleep;
Expand Down
3 changes: 1 addition & 2 deletions crates/jamjam/src/jam/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::fs::{self, OpenOptions};
use std::io::{BufReader, BufWriter, Seek, SeekFrom, Write};
use std::os::unix::fs::MetadataExt;
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicBool;
use std::time::{SystemTime, UNIX_EPOCH};
Expand Down Expand Up @@ -379,7 +378,7 @@ impl JamMessageBase {

let mut file = fs::OpenOptions::new().append(true).open(last_read_file_name)?;
const LEN: u64 = 16;
self.last_read_record = (file.metadata().unwrap().size() / LEN) as i32;
self.last_read_record = (file.metadata().unwrap().len() / LEN) as i32;
opt.write(&mut file)?;
Ok(opt)
}
Expand Down

0 comments on commit 8fdf670

Please sign in to comment.