aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-03-23 13:03:15 +0000
committerFuwn <[email protected]>2021-03-23 13:03:15 +0000
commitca77f715e6e2e9fc57e8918110d8fee8b5a7f3f8 (patch)
tree430fe71bcb414c218382e41faf57c3e4e0ead2ab /src/server
parentfix: `room_id` not being set and sent (diff)
downloadwhirl-ca77f715e6e2e9fc57e8918110d8fee8b5a7f3f8.tar.xz
whirl-ca77f715e6e2e9fc57e8918110d8fee8b5a7f3f8.zip
feature: Send WORLDSMASTER greeting on join
Created function `create_text_command_with_action` which is stable, but only with the preset action. Will expand on this once an understanding of how actions work is met.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/auto/server.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/server/auto/server.rs b/src/server/auto/server.rs
index 21a978c..7437501 100644
--- a/src/server/auto/server.rs
+++ b/src/server/auto/server.rs
@@ -4,7 +4,7 @@ use mio::{Poll, Token, Ready, PollOpt, Events};
use std::collections::{HashMap, HashSet};
use std::str::from_utf8;
use crate::cmd::buddy_list::create_buddy_list_notify_command;
-use crate::cmd::text::create_text_command;
+use crate::cmd::text::{create_text_command, create_text_command_with_action};
use crate::cmd::property::{create_property_update_command, create_property_request_command};
use super::cmd::room::create_room_id_redirect_command;
use rand::Rng;
@@ -99,13 +99,27 @@ impl AutoServer {
info!("received session initialization command");
sockets.get_mut(&token).unwrap()
.write_all(&create_property_request_command()).unwrap();
- info!("sent session initialization command")
+ info!("sent session initialization command");
}
// PROPSET
- 15 => info!("received property set command"),
+ 15 => {
+ info!("received property set command");
+ sockets.get_mut(&token).unwrap()
+ .write_all(&create_text_command_with_action(
+ "WORLDSMASTER",
+ "Welcome to Whirlsplash!"
+ )).unwrap();
+ info!("sent worldsmaster greeting");
+ },
// BUDDYLISTUPDATE
29 => {
info!("received buddy list update command");
+
+ let received_buddy = from_utf8(
+ &buffer[4..*&buffer.get(3).unwrap().to_owned() as usize]
+ ).unwrap();
+ debug!("received buddy: {}", received_buddy);
+
sockets.get_mut(&token).unwrap()
.write_all(&create_buddy_list_notify_command("Wirlaburla"))
.unwrap();