aboutsummaryrefslogtreecommitdiff
path: root/src/server/cmd/commands/text/parse.rs
blob: 567003985a4711d512d73ebca940148c2eac777f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyleft (ɔ) 2021-2021 Whirlsplash
// SPDX-License-Identifier: GPL-3.0-only

use std::str::from_utf8;

use crate::server::cmd::commands::text::structure::Text;

pub fn parse_text(data: Vec<u8>, username: &str) -> Text {
  Text {
    sender:  username.to_string(),
    content: from_utf8(&data[6..]).unwrap().to_string(),
  }
}