aboutsummaryrefslogtreecommitdiff
path: root/src/server/cmd
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-17 10:16:42 +0000
committerFuwn <[email protected]>2021-05-17 10:16:42 +0000
commit1b482ab22031ab9a895b2567ba10a2e553752303 (patch)
treedb4874c46b25655ba7c94b0ab435fdb0d681af55 /src/server/cmd
parentrefactor(global): whirl_config modulized (diff)
downloadwhirl-1b482ab22031ab9a895b2567ba10a2e553752303.tar.xz
whirl-1b482ab22031ab9a895b2567ba10a2e553752303.zip
refactor(global): even more modules becoming crates
I did multiple checks and **yes**, everything still works perfectly fine.
Diffstat (limited to 'src/server/cmd')
-rw-r--r--src/server/cmd/commands/action.rs26
-rw-r--r--src/server/cmd/commands/buddy_list.rs48
-rw-r--r--src/server/cmd/commands/mod.rs12
-rw-r--r--src/server/cmd/commands/property/create.rs168
-rw-r--r--src/server/cmd/commands/property/mod.rs5
-rw-r--r--src/server/cmd/commands/property/parse.rs14
-rw-r--r--src/server/cmd/commands/redirect_id.rs42
-rw-r--r--src/server/cmd/commands/room_id_request.rs18
-rw-r--r--src/server/cmd/commands/subscribe_distance.rs24
-rw-r--r--src/server/cmd/commands/subscribe_room.rs30
-rw-r--r--src/server/cmd/commands/teleport.rs34
-rw-r--r--src/server/cmd/commands/text.rs67
-rw-r--r--src/server/cmd/constants.rs32
-rw-r--r--src/server/cmd/extendable.rs18
-rw-r--r--src/server/cmd/mod.rs9
-rw-r--r--src/server/cmd/set_parser.rs39
-rw-r--r--src/server/cmd/structure.rs22
17 files changed, 0 insertions, 608 deletions
diff --git a/src/server/cmd/commands/action.rs b/src/server/cmd/commands/action.rs
deleted file mode 100644
index 8d1fb0b..0000000
--- a/src/server/cmd/commands/action.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-// TODO: of2m-ify
-//
-// Of2m-ifying isn't much of a priority right now as the whole action ordeal
-// hasn't been fully dissected yet. Once more is known about the inner working
-// of actions, it will be of2m-ified.
-
-use bytes::{BufMut, BytesMut};
-
-pub fn create_action() -> Vec<u8> {
- let mut command = BytesMut::new();
-
- command.put_slice(&[
- 0x01, 0x11, 0x00, 0x05, 0x54, 0x52, 0x41, 0x44, 0x45, 0x07, 0x26, 0x7c, 0x2b, 0x69, 0x6e, 0x76,
- 0x3e,
- ]);
-
- // Convert to vector and insert the length
- let mut command_as_vec = command.to_vec();
- command_as_vec.insert(0, command.len() as u8 + 1);
-
- // Return bytes
- command_as_vec
-}
diff --git a/src/server/cmd/commands/buddy_list.rs b/src/server/cmd/commands/buddy_list.rs
deleted file mode 100644
index 7e9722a..0000000
--- a/src/server/cmd/commands/buddy_list.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use std::str::from_utf8;
-
-use bytes::{BufMut, BytesMut};
-
-use crate::server::cmd::{
- constants::BUDDYLISTNOTIFY,
- extendable::{Creatable, Parsable},
-};
-
-#[derive(Clone)]
-pub struct BuddyList {
- pub buddy: String,
- pub add: i8,
-}
-impl Parsable for BuddyList {
- fn parse(data: Vec<u8>) -> Self {
- Self {
- buddy: from_utf8(&data[4..data[0] as usize - 1])
- .unwrap()
- .to_string(),
-
- // Get the last byte
- add: data[data[0] as usize - 1] as i8,
- }
- }
-}
-impl Creatable for BuddyList {
- fn create(self) -> Vec<u8> {
- let mut command = BytesMut::new();
-
- // Header
- command.put_u8(0x01); // ObjId
- command.put_i8(BUDDYLISTNOTIFY as i8); // Type
-
- // Content
- command.put_u8(self.buddy.len() as u8); // Buddy (name) length
- command.put_slice(self.buddy.as_bytes()); // Buddy (name)
- command.put_u8(self.add as u8); // "Is buddy logged on?" (?)
-
- let mut command_as_vec = command.to_vec();
- command_as_vec.insert(0, command.len() as u8 + 1);
-
- command_as_vec
- }
-}
diff --git a/src/server/cmd/commands/mod.rs b/src/server/cmd/commands/mod.rs
deleted file mode 100644
index 49758c2..0000000
--- a/src/server/cmd/commands/mod.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-pub mod action;
-pub mod buddy_list;
-pub mod property;
-pub mod redirect_id;
-pub mod room_id_request;
-pub mod subscribe_distance;
-pub mod subscribe_room;
-pub mod teleport;
-pub mod text;
diff --git a/src/server/cmd/commands/property/create.rs b/src/server/cmd/commands/property/create.rs
deleted file mode 100644
index 88a9293..0000000
--- a/src/server/cmd/commands/property/create.rs
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-// TODO: of2m-ify?
-
-use whirl_config::Config;
-
-use crate::server::{
- cmd::constants::{PROPUPD, SESSINIT},
- net::{
- constants::{
- VAR_APPNAME,
- VAR_CHANNEL,
- VAR_ERROR,
- VAR_EXTERNAL_HTTP_SERVER,
- VAR_MAIL_DOMAIN,
- VAR_PRIV,
- VAR_PROTOCOL,
- VAR_SCRIPT_SERVER,
- VAR_SERIAL,
- VAR_SERVERTYPE,
- VAR_SMTP_SERVER,
- VAR_UPDATETIME,
- },
- converter::property_list_to_bytes,
- structure::NetworkProperty,
- },
-};
-
-pub fn create_property_update_as_distributor() -> Vec<u8> {
- property_list_to_bytes(
- PROPUPD,
- 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,
- },
- ],
- )
-}
-
-pub fn create_property_update_as_hub() -> Vec<u8> {
- property_list_to_bytes(
- PROPUPD,
- 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,
- },
- ],
- )
-}
-
-pub fn create_property_request_as_distributor() -> Vec<u8> {
- property_list_to_bytes(
- 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(),
- },
- ],
- )
-}
-
-pub fn create_property_request_as_hub() -> Vec<u8> {
- property_list_to_bytes(
- 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(),
- },
- ],
- )
-}
diff --git a/src/server/cmd/commands/property/mod.rs b/src/server/cmd/commands/property/mod.rs
deleted file mode 100644
index 83b015b..0000000
--- a/src/server/cmd/commands/property/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-pub mod create;
-pub mod parse;
diff --git a/src/server/cmd/commands/property/parse.rs b/src/server/cmd/commands/property/parse.rs
deleted file mode 100644
index ef587fe..0000000
--- a/src/server/cmd/commands/property/parse.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use crate::server::net::structure::NetworkProperty;
-
-pub fn find_property_in_property_list(
- property_list: &[NetworkProperty],
- property: i32,
-) -> &NetworkProperty {
- property_list
- .iter()
- .find(|i| i.prop_id == property)
- .unwrap()
-}
diff --git a/src/server/cmd/commands/redirect_id.rs b/src/server/cmd/commands/redirect_id.rs
deleted file mode 100644
index edaf46e..0000000
--- a/src/server/cmd/commands/redirect_id.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use bytes::{BufMut, BytesMut};
-use whirl_config::Config;
-
-use crate::server::cmd::{constants::REDIRID, extendable::Creatable};
-
-#[derive(Debug)]
-pub struct RedirectId {
- pub room_name: String,
- pub room_number: i8,
-}
-impl Creatable for RedirectId {
- fn create(self) -> Vec<u8> {
- let mut command = BytesMut::new();
-
- // Header
- command.put_u8(0x01); // ObjId
- command.put_u8(REDIRID as u8); // Type
-
- // Content
- command.put_u8(self.room_name.len() as u8); // Room name length
- command.put_slice(self.room_name.as_bytes()); // Room name
- // command.put_u8(0x00); // Unimplemented byte (?)
- // command.put_u8(room_id); // Room ID
- command.put_u16(self.room_number as u16); // Room ID
-
- // IP
- for byte in Config::get().whirlsplash.ip.split('.') {
- command.put_u8(byte.parse::<u8>().unwrap());
- }
- command.put_u16(Config::get().hub.port as u16); // Port
-
- // Length
- let mut command_as_vec = command.to_vec();
- command_as_vec.insert(0, command.len() as u8 + 1);
-
- // Return
- command_as_vec
- }
-}
diff --git a/src/server/cmd/commands/room_id_request.rs b/src/server/cmd/commands/room_id_request.rs
deleted file mode 100644
index cc8dbeb..0000000
--- a/src/server/cmd/commands/room_id_request.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use std::str::from_utf8;
-
-use crate::server::cmd::extendable::Parsable;
-
-#[derive(Debug)]
-pub struct RoomIdRequest {
- pub room_name: String,
-}
-impl Parsable for RoomIdRequest {
- fn parse(data: Vec<u8>) -> Self {
- Self {
- room_name: from_utf8(&data[4..data[0] as usize]).unwrap().to_string(),
- }
- }
-}
diff --git a/src/server/cmd/commands/subscribe_distance.rs b/src/server/cmd/commands/subscribe_distance.rs
deleted file mode 100644
index 66f4241..0000000
--- a/src/server/cmd/commands/subscribe_distance.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use byteorder::{BigEndian, ReadBytesExt};
-use bytes::{Buf, BytesMut};
-
-use crate::server::cmd::extendable::Parsable;
-
-#[derive(Debug)]
-pub struct SubscribeDistance {
- pub distance: i16,
- pub room_number: i16,
-}
-impl Parsable for SubscribeDistance {
- fn parse(data: Vec<u8>) -> Self {
- // https://stackoverflow.com/questions/41034635/how-do-i-convert-between-string-str-vecu8-and-u8
- let mut data = BytesMut::from(data.as_slice()).reader();
-
- Self {
- distance: data.read_i16::<BigEndian>().unwrap(),
- room_number: data.read_i16::<BigEndian>().unwrap(),
- }
- }
-}
diff --git a/src/server/cmd/commands/subscribe_room.rs b/src/server/cmd/commands/subscribe_room.rs
deleted file mode 100644
index d936fff..0000000
--- a/src/server/cmd/commands/subscribe_room.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use byteorder::{BigEndian, ReadBytesExt};
-use bytes::{Buf, BytesMut};
-
-use crate::server::cmd::extendable::Parsable;
-
-#[derive(Debug)]
-pub struct SubscribeRoom {
- pub room_number: i8,
- pub x: f32,
- pub y: f32,
- pub z: f32,
- pub distance: f32,
-}
-impl Parsable for SubscribeRoom {
- fn parse(data: Vec<u8>) -> Self {
- // https://stackoverflow.com/questions/41034635/how-do-i-convert-between-string-str-vecu8-and-u8
- let mut data = BytesMut::from(data.as_slice()).reader();
-
- Self {
- room_number: data.read_i16::<BigEndian>().unwrap() as i8,
- x: data.read_i16::<BigEndian>().unwrap() as i8 as f32,
- y: data.read_i16::<BigEndian>().unwrap() as i8 as f32,
- z: data.read_i16::<BigEndian>().unwrap() as i8 as f32,
- distance: data.read_i16::<BigEndian>().unwrap() as i8 as f32, // + 100
- }
- }
-}
diff --git a/src/server/cmd/commands/teleport.rs b/src/server/cmd/commands/teleport.rs
deleted file mode 100644
index 7a2b55e..0000000
--- a/src/server/cmd/commands/teleport.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use byteorder::{BigEndian, ReadBytesExt};
-use bytes::{Buf, BytesMut};
-
-use crate::server::cmd::extendable::Parsable;
-
-#[derive(Debug)]
-pub struct Teleport {
- pub room_id: i8,
- pub exit_type: u8,
- pub entry_type: u8,
- pub x: f32, // i16
- pub y: f32,
- pub z: f32,
- pub direction: f32,
-}
-impl Parsable for Teleport {
- fn parse(data: Vec<u8>) -> Self {
- // https://stackoverflow.com/questions/41034635/how-do-i-convert-between-string-str-vecu8-and-u8
- let mut data = BytesMut::from(data.as_slice()).reader();
-
- Self {
- room_id: data.read_u16::<BigEndian>().unwrap() as i8,
- exit_type: data.read_u8().unwrap(),
- entry_type: data.read_u8().unwrap(),
- x: data.read_i16::<BigEndian>().unwrap() as f32,
- y: data.read_i16::<BigEndian>().unwrap() as f32,
- z: data.read_i16::<BigEndian>().unwrap() as f32,
- direction: data.read_i16::<BigEndian>().unwrap() as f32,
- }
- }
-}
diff --git a/src/server/cmd/commands/text.rs b/src/server/cmd/commands/text.rs
deleted file mode 100644
index 5019fc1..0000000
--- a/src/server/cmd/commands/text.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use std::str::from_utf8;
-
-use bytes::{BufMut, BytesMut};
-
-use crate::server::cmd::{
- constants::TEXT,
- extendable::{Creatable, ParsableWithArguments},
-};
-
-pub struct Text {
- pub sender: String,
- pub content: String,
-}
-impl Creatable for Text {
- fn create(self) -> Vec<u8> {
- let mut command = BytesMut::new();
-
- // Header
- command.put_u8(0x01);
- command.put_i8(TEXT as i8);
-
- // Content
- // TODO: Find a way to parse ObjIds.
- //
- // The below byte is suspected to be the sender's short ObjId.
- command.put_i8(0x00);
-
- command.put_u8(self.sender.len() as u8);
- command.put_slice(self.sender.as_bytes());
- command.put_u8(self.content.len() as u8);
- command.put_slice(self.content.as_bytes());
-
- // Convert to vector and insert the length
- let mut command_as_vec = command.to_vec();
- command_as_vec.insert(0, command.len() as u8 + 1);
-
- // Return bytes
- command_as_vec
- }
-}
-impl ParsableWithArguments for Text {
- /// The first and only element of `args` *should* be the username of the
- /// sender.
- ///
- /// There isn't anything currently stopping someone from passing some other
- /// value so that might be annoying at times.
- ///
- /// Realistically, this method is mostly static so the username will *always*
- /// be passed properly unless someone intentionally commits breaking changes
- /// on purpose regarding what is passed to to this method where called.
- ///
- /// It would be neat to have some sort of ability to statically check if the
- /// `args` argument contains x number of elements at compile time or
- /// something of the sort but the Rust RFC is probably not focused on that.
- ///
- /// So, right now, trust is in the developers' hands to make sure to pass the
- /// right -- number -- of elements to `args`.
- fn parse(data: Vec<u8>, args: &[&str]) -> Self {
- Self {
- sender: args[0].to_string(),
- content: from_utf8(&data[6..]).unwrap().to_string(),
- }
- }
-}
diff --git a/src/server/cmd/constants.rs b/src/server/cmd/constants.rs
deleted file mode 100644
index 22d29c1..0000000
--- a/src/server/cmd/constants.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-pub const LONGLOC: i32 = 1;
-pub const STATE: i32 = 2;
-pub const PROP: i32 = 3;
-pub const SHORTLOC: i32 = 4;
-pub const ROOMCHNG: i32 = 5;
-pub const SESSINIT: i32 = 6;
-pub const SESSEXIT: i32 = 7;
-pub const APPINIT: i32 = 8;
-pub const PROPREQ: i32 = 10;
-pub const DISAPPR: i32 = 11;
-pub const APPRACTR: i32 = 12;
-pub const REGOBJID: i32 = 13;
-pub const TEXT: i32 = 14;
-pub const PROPSET: i32 = 15;
-pub const PROPUPD: i32 = 16;
-pub const WHISPER: i32 = 17;
-pub const TELEPORT: i32 = 18;
-pub const ROOMIDRQ: i32 = 20;
-pub const ROOMID: i32 = 21;
-pub const SUBSCRIB: i32 = 22;
-pub const UNSUBSCR: i32 = 23;
-pub const SUB_DIST: i32 = 24; // SUB-DIST
-pub const REDIRECT: i32 = 25;
-pub const REDIRID: i32 = 26;
-pub const FINGREQ: i32 = 27;
-pub const FINGREP: i32 = 28;
-pub const BUDDYLISTUPDATE: i32 = 29;
-pub const BUDDYLISTNOTIFY: i32 = 30;
-pub const CHANNEL: i32 = 31;
diff --git a/src/server/cmd/extendable.rs b/src/server/cmd/extendable.rs
deleted file mode 100644
index e6f3c2b..0000000
--- a/src/server/cmd/extendable.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-pub trait Parsable {
- fn parse(data: Vec<u8>) -> Self;
-}
-
-pub trait Creatable {
- fn create(self) -> Vec<u8>;
-}
-
-/// Having to do this makes me with there was operator overloading in Rust.
-///
-/// I *could* do this with a macro but since Text is the only struct that
-/// implements this trait, it shouldn't be that big of a deal.
-pub trait ParsableWithArguments {
- fn parse(data: Vec<u8>, args: &[&str]) -> Self;
-}
diff --git a/src/server/cmd/mod.rs b/src/server/cmd/mod.rs
deleted file mode 100644
index ef91de7..0000000
--- a/src/server/cmd/mod.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-pub mod commands;
-
-pub mod constants;
-pub mod extendable;
-mod set_parser;
-mod structure;
diff --git a/src/server/cmd/set_parser.rs b/src/server/cmd/set_parser.rs
deleted file mode 100644
index 6d11f04..0000000
--- a/src/server/cmd/set_parser.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-use crate::server::cmd::structure::Command;
-
-/// Iterate over a command set in the from of bytes and return a list of
-/// human-readable commands.
-fn _parse_command_set(mut data: Vec<u8>) -> Vec<Command> {
- let mut command_set = vec![];
-
- // Iterate over all commands
- loop {
- // Check if any commands are present
- if data.len() <= 2 {
- break;
- }
- if data[0] == 0 {
- break;
- }
-
- let command_length = data[0];
- let mut command = Command {
- length: command_length as i32,
- obj_id: data[1] as i32,
- id: data[2] as i32,
- body: vec![],
- };
- if command.length > 3 {
- command.body = data[3..].to_owned();
- }
- command_set.push(command);
-
- // Remove current command from the command set
- data = data[command_length as usize..].to_vec();
- }
-
- // Return the human-readable command set
- command_set
-}
diff --git a/src/server/cmd/structure.rs b/src/server/cmd/structure.rs
deleted file mode 100644
index 23e91ca..0000000
--- a/src/server/cmd/structure.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
-// SPDX-License-Identifier: GPL-3.0-only
-
-pub struct Command {
- pub length: i32,
- pub obj_id: i32,
- pub id: i32,
- pub body: Vec<u8>,
-}
-impl Command {
- pub fn _new() -> Self { Command::default() }
-}
-impl Default for Command {
- fn default() -> Self {
- Command {
- length: 0,
- obj_id: 0,
- id: 0,
- body: vec![],
- }
- }
-}