Skip to content

Commit

Permalink
Added more options to conferences.
Browse files Browse the repository at this point in the history
Now the icb conferences are close to the pcboard ones.

Only things missing are:  maintain old msgs.index and last message exported.
Not sure if any of these make sense. Last Message Exported should be stored somewhere else.
Doesn't make sense.

And .NDX would rely on the PCB Mail format which is no longer used.
  • Loading branch information
mkrueger committed Feb 8, 2025
1 parent 633363a commit 8f9a8b4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
55 changes: 54 additions & 1 deletion crates/icy_board_engine/src/icy_board/conferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,50 @@ use super::{
commands::Command,
doors::DoorList,
file_directory::DirectoryList,
is_false, is_null_16, is_null_8, is_null_i32,
is_false, is_null_16, is_null_8, is_null_f64, is_null_i32,
message_area::{AreaList, MessageArea},
pcbconferences::{PcbAdditionalConferenceHeader, PcbConferenceHeader},
security_expr::SecurityExpression,
user_base::Password,
IcyBoardSerializer,
};

#[derive(Default, Clone, Serialize, Deserialize)]
pub enum ConferenceType {
#[default]
Normal,
InternetEmail,
InternetUsenet,
UsnetModeratedNewsgroup,
UsnetPublicNewsgroup,
FidoConference,
}

impl ConferenceType {
pub fn from_u8(value: u8) -> Self {
match value {
0 => Self::Normal,
1 => Self::InternetEmail,
2 => Self::InternetUsenet,
3 => Self::UsnetModeratedNewsgroup,
4 => Self::UsnetPublicNewsgroup,
5 => Self::FidoConference,
_ => Self::Normal,
}
}

pub fn to_u8(&self) -> u8 {
match self {
Self::Normal => 0,
Self::InternetEmail => 1,
Self::InternetUsenet => 2,
Self::UsnetModeratedNewsgroup => 3,
Self::UsnetPublicNewsgroup => 4,
Self::FidoConference => 5,
}
}
}

#[serde_as]
#[derive(Default, Clone, Serialize, Deserialize)]
pub struct Conference {
Expand Down Expand Up @@ -128,6 +164,13 @@ pub struct Conference {
#[serde(skip_serializing_if = "is_false")]
pub long_to_names: bool,

#[serde(default)]
#[serde(skip_serializing_if = "is_false")]
pub force_echomail: bool,

#[serde(default)]
pub conference_type: ConferenceType,

pub users_menu: PathBuf,
pub sysop_menu: PathBuf,
pub news_file: PathBuf,
Expand Down Expand Up @@ -173,8 +216,16 @@ pub struct Conference {
#[serde(skip)]
pub doors: DoorList,

#[serde(default)]
#[serde(skip_serializing_if = "is_null_f64")]
pub charge_time: f64,

#[serde(default)]
#[serde(skip_serializing_if = "is_null_f64")]
pub charge_msg_read: f64,

#[serde(default)]
#[serde(skip_serializing_if = "is_null_f64")]
pub charge_msg_write: f64,
}

Expand Down Expand Up @@ -270,6 +321,8 @@ impl ConferenceBase {
record_origin: d.record_origin,
prompt_for_routing: d.prompt_for_routing,
long_to_names: d.long_to_names,
force_echomail: d.force_echo,
conference_type: ConferenceType::from_u8(d.conf_type),
};
confs.push(new);
}
Expand Down
4 changes: 4 additions & 0 deletions crates/icy_board_engine/src/icy_board/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ pub fn is_null_i32(b: impl std::borrow::Borrow<i32>) -> bool {
*b.borrow() == 0
}

pub fn is_null_f64(b: impl std::borrow::Borrow<f64>) -> bool {
*b.borrow() == 0.0
}

const UTF8_BOM: [u8; 3] = [0xEF, 0xBB, 0xBF];

pub fn read_with_encoding_detection<P: AsRef<Path>>(path: &P) -> Res<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ impl PcbConferenceHeader {

#[derive(Default, Clone, Debug)]
pub struct PcbAdditionalConferenceHeader {
pub force_echo: bool,
pub force_echo: bool, // *
pub read_only: bool, //*
pub no_private_msgs: bool, // *
pub ret_receipt_level: u8, // *
Expand Down

0 comments on commit 8f9a8b4

Please sign in to comment.