aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_server/src/cmd/commands/property/create.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-06 00:09:18 +0000
committerFuwn <[email protected]>2021-06-06 00:09:18 +0000
commite46da84bd264993d32a45b88bd5d51af0c6ef5ed (patch)
tree7588d6b85683a339deb65fab248b3927012157e3 /crates/whirl_server/src/cmd/commands/property/create.rs
parentrefactor(whirl_server): remove single imports (diff)
downloadwhirl-e46da84bd264993d32a45b88bd5d51af0c6ef5ed.tar.xz
whirl-e46da84bd264993d32a45b88bd5d51af0c6ef5ed.zip
refactor(whirl_server::net): move orphan functions to methods within property list struct
Diffstat (limited to 'crates/whirl_server/src/cmd/commands/property/create.rs')
-rw-r--r--crates/whirl_server/src/cmd/commands/property/create.rs248
1 files changed, 118 insertions, 130 deletions
diff --git a/crates/whirl_server/src/cmd/commands/property/create.rs b/crates/whirl_server/src/cmd/commands/property/create.rs
index d689857..c9f0e04 100644
--- a/crates/whirl_server/src/cmd/commands/property/create.rs
+++ b/crates/whirl_server/src/cmd/commands/property/create.rs
@@ -22,147 +22,135 @@ use crate::{
VAR_SMTP_SERVER,
VAR_UPDATETIME,
},
- converter::property_list_to_bytes,
- structure::NetworkProperty,
+ network_property::NetworkProperty,
+ property_list::PropertyList,
},
};
pub fn property_update_as_distributor() -> Vec<u8> {
- property_list_to_bytes(
- Command::PropUpd as i32,
- 0xFF,
- vec![
- NetworkProperty {
- prop_id: VAR_MAIL_DOMAIN,
- value: "worlds3d.com".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SMTP_SERVER,
- value: "mail.worlds.net:25".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SCRIPT_SERVER,
- value: "http://www-dynamic.us.worlds.net/cgi-bin".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_EXTERNAL_HTTP_SERVER,
- value: "http://www-static.us.worlds.net".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SERVERTYPE,
- value: "1".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_PROTOCOL,
- value: "24".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_APPNAME,
- value: Config::get().whirlsplash.worldsmaster_username,
- },
- ],
- )
+ PropertyList(vec![
+ NetworkProperty {
+ prop_id: VAR_MAIL_DOMAIN,
+ value: "worlds3d.com".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SMTP_SERVER,
+ value: "mail.worlds.net:25".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SCRIPT_SERVER,
+ value: "http://www-dynamic.us.worlds.net/cgi-bin".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_EXTERNAL_HTTP_SERVER,
+ value: "http://www-static.us.worlds.net".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SERVERTYPE,
+ value: "1".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_PROTOCOL,
+ value: "24".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_APPNAME,
+ value: Config::get().whirlsplash.worldsmaster_username,
+ },
+ ])
+ .as_bytes(Command::PropUpd as i32, 0xFF)
}
pub fn property_update_as_hub() -> Vec<u8> {
- property_list_to_bytes(
- Command::PropUpd as i32,
- 0xFF,
- vec![
- NetworkProperty {
- prop_id: VAR_UPDATETIME,
- value: "1000000".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_MAIL_DOMAIN,
- value: "worlds3d.com".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SMTP_SERVER,
- value: "mail.worlds.net:25".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SCRIPT_SERVER,
- value: "http://www-dynamic.us.worlds.net/cgi-bin".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_EXTERNAL_HTTP_SERVER,
- value: "http://www-static.us.worlds.net".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SERVERTYPE,
- value: "3".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_PROTOCOL,
- value: "24".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_APPNAME,
- value: Config::get().whirlsplash.worldsmaster_username,
- },
- ],
- )
+ PropertyList(vec![
+ NetworkProperty {
+ prop_id: VAR_UPDATETIME,
+ value: "1000000".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_MAIL_DOMAIN,
+ value: "worlds3d.com".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SMTP_SERVER,
+ value: "mail.worlds.net:25".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SCRIPT_SERVER,
+ value: "http://www-dynamic.us.worlds.net/cgi-bin".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_EXTERNAL_HTTP_SERVER,
+ value: "http://www-static.us.worlds.net".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SERVERTYPE,
+ value: "3".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_PROTOCOL,
+ value: "24".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_APPNAME,
+ value: Config::get().whirlsplash.worldsmaster_username,
+ },
+ ])
+ .as_bytes(Command::PropUpd as i32, 0xFF)
}
pub fn property_request_as_distributor() -> Vec<u8> {
- property_list_to_bytes(
- Command::SessInit as i32,
- 0x01,
- vec![
- NetworkProperty {
- prop_id: VAR_ERROR,
- value: "0".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_APPNAME,
- value: Config::get().whirlsplash.worldsmaster_username,
- },
- NetworkProperty {
- prop_id: VAR_PROTOCOL,
- value: "24".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SERVERTYPE,
- value: "1".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SERIAL,
- value: "DWLV000000000000".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_PRIV,
- value: "0".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_CHANNEL,
- value: "dimension-1".to_string(),
- },
- ],
- )
+ PropertyList(vec![
+ NetworkProperty {
+ prop_id: VAR_ERROR,
+ value: "0".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_APPNAME,
+ value: Config::get().whirlsplash.worldsmaster_username,
+ },
+ NetworkProperty {
+ prop_id: VAR_PROTOCOL,
+ value: "24".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SERVERTYPE,
+ value: "1".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SERIAL,
+ value: "DWLV000000000000".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_PRIV,
+ value: "0".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_CHANNEL,
+ value: "dimension-1".to_string(),
+ },
+ ])
+ .as_bytes(Command::SessInit as i32, 0x01)
}
pub fn property_request_as_hub() -> Vec<u8> {
- property_list_to_bytes(
- Command::SessInit as i32,
- 0x01,
- vec![
- NetworkProperty {
- prop_id: VAR_ERROR,
- value: "0".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_SERVERTYPE,
- value: "3".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_UPDATETIME,
- value: "1000000".to_string(),
- },
- NetworkProperty {
- prop_id: VAR_PROTOCOL,
- value: "24".to_string(),
- },
- ],
- )
+ PropertyList(vec![
+ NetworkProperty {
+ prop_id: VAR_ERROR,
+ value: "0".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_SERVERTYPE,
+ value: "3".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_UPDATETIME,
+ value: "1000000".to_string(),
+ },
+ NetworkProperty {
+ prop_id: VAR_PROTOCOL,
+ value: "24".to_string(),
+ },
+ ])
+ .as_bytes(Command::SessInit as i32, 0x01)
}