aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-04-27 17:02:09 +0000
committerFuwn <[email protected]>2021-04-27 17:02:09 +0000
commitfc5c05bce7a5f9d763d72b870717a530dfcf9524 (patch)
treea9112c07c3cef656be38715cf143797529fbdbb2 /src/server
parentetc: Add a Say Thanks button :) (diff)
downloadwhirl-fc5c05bce7a5f9d763d72b870717a530dfcf9524.tar.xz
whirl-fc5c05bce7a5f9d763d72b870717a530dfcf9524.zip
feature: New configuration file format
Diffstat (limited to 'src/server')
-rw-r--r--src/server/cmd/commands/property/create.rs8
-rw-r--r--src/server/cmd/commands/room/create.rs4
-rw-r--r--src/server/distributor.rs6
-rw-r--r--src/server/hub.rs6
4 files changed, 12 insertions, 12 deletions
diff --git a/src/server/cmd/commands/property/create.rs b/src/server/cmd/commands/property/create.rs
index 8521a8e..948f434 100644
--- a/src/server/cmd/commands/property/create.rs
+++ b/src/server/cmd/commands/property/create.rs
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::{
- config::get_config,
+ config::Config,
server::{
cmd::constants::{PROPUPD, SESSINIT},
net::{
@@ -57,7 +57,7 @@ pub fn create_property_update_as_distributor() -> Vec<u8> {
},
NetworkProperty {
prop_id: VAR_APPNAME,
- value: get_config().unwrap().worldsmaster_username,
+ value: Config::get().unwrap().whirlsplash.worldsmaster_username,
},
],
)
@@ -98,7 +98,7 @@ pub fn create_property_update_as_hub() -> Vec<u8> {
},
NetworkProperty {
prop_id: VAR_APPNAME,
- value: get_config().unwrap().worldsmaster_username,
+ value: Config::get().unwrap().whirlsplash.worldsmaster_username,
},
],
)
@@ -115,7 +115,7 @@ pub fn create_property_request_as_distributor() -> Vec<u8> {
},
NetworkProperty {
prop_id: VAR_APPNAME,
- value: get_config().unwrap().worldsmaster_username,
+ value: Config::get().unwrap().whirlsplash.worldsmaster_username,
},
NetworkProperty {
prop_id: VAR_PROTOCOL,
diff --git a/src/server/cmd/commands/room/create.rs b/src/server/cmd/commands/room/create.rs
index a195936..598d39b 100644
--- a/src/server/cmd/commands/room/create.rs
+++ b/src/server/cmd/commands/room/create.rs
@@ -3,7 +3,7 @@
use bytes::{BufMut, BytesMut};
-use crate::{config::get_config, server::cmd::constants::REDIRID};
+use crate::{config::Config, server::cmd::constants::REDIRID};
pub fn create_room_id_request(room: &str, room_id: u8) -> Vec<u8> {
let mut command = BytesMut::new();
@@ -23,7 +23,7 @@ pub fn create_room_id_request(room: &str, room_id: u8) -> Vec<u8> {
for byte in "0.0.0.0".split('.') {
command.put_u8(byte.parse::<u8>().unwrap());
}
- command.put_u16(get_config().unwrap().hub_port as u16); // Port
+ command.put_u16(Config::get().unwrap().hub.port as u16); // Port
// Length
let mut command_as_vec = command.to_vec();
diff --git a/src/server/distributor.rs b/src/server/distributor.rs
index 4e7a694..fe3bea7 100644
--- a/src/server/distributor.rs
+++ b/src/server/distributor.rs
@@ -18,7 +18,7 @@ use tokio_stream::StreamExt;
use tokio_util::codec::{BytesCodec, Decoder};
use crate::{
- config::get_config,
+ config::Config,
server::{
cmd::{
commands::{
@@ -87,8 +87,8 @@ impl Server for Distributor {
peer.bytes.get_mut()
.write_all(&create_text(Text {
- sender: get_config()?.worldsmaster_username,
- content: get_config()?.worldsmaster_greeting,
+ sender: Config::get()?.whirlsplash.worldsmaster_username,
+ content: Config::get()?.distributor.worldsmaster_greeting,
})).await?;
peer.bytes.get_mut()
.write_all(&create_action()).await?;
diff --git a/src/server/hub.rs b/src/server/hub.rs
index 6a1480f..7513f12 100644
--- a/src/server/hub.rs
+++ b/src/server/hub.rs
@@ -14,7 +14,7 @@ use tokio_stream::StreamExt;
use tokio_util::codec::{BytesCodec, Decoder};
use crate::{
- config::get_config,
+ config::Config,
server::{
cmd::{
commands::{
@@ -85,8 +85,8 @@ impl Server for Hub {
peer.bytes.get_mut()
.write_all(&create_text(Text {
- sender: get_config()?.worldsmaster_username,
- content: get_config()?.worldsmaster_greeting,
+ sender: Config::get()?.whirlsplash.worldsmaster_username,
+ content: Config::get()?.distributor.worldsmaster_greeting,
})).await?;
peer.bytes.get_mut()
.write_all(&create_action()).await?;