Skip to content

Commit

Permalink
Update SystemChatMessage to use serializable chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurshsmith committed Mar 12, 2023
1 parent 2be07e2 commit fa7937f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rusty_group_chat/src/system_chat_message.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
use crate::User;
use crate::{Chat, User};

pub struct SystemChatMessage;

impl SystemChatMessage {
pub fn user_joined(user: &User) -> String {
format!("{} joined.", user.name)
let message = format!("{} joined.", user.name);

Chat::from_system(&message).to_string()
}

pub fn user_left(user: &User) -> String {
format!("{} left.", user.name)
let message = format!("{} left.", user.name);

Chat::from_system(&message).to_string()
}
}

0 comments on commit fa7937f

Please sign in to comment.