Added chat service Updated packet service to pass the tcp stream around in a Arc type. Updated character position data to not require multiplying the coords Added more debug logs Added an interceptor for gRPC comms with the chat server Updated build and push script for the chat server changes
22 lines
852 B
Rust
22 lines
852 B
Rust
use crate::chat_channels::ChatChannel;
|
|
use crate::chat_service::Clients;
|
|
use crate::chat_service::chat::ChatMessage;
|
|
|
|
/// A dedicated module for guild chat.
|
|
#[derive(Debug)]
|
|
pub struct GuildChat;
|
|
|
|
impl ChatChannel for GuildChat {
|
|
fn handle_message(&self, message: ChatMessage, sender_id: &str, clients: &Clients) {
|
|
// This is a placeholder. In a real implementation, verify
|
|
// guild membership by consulting your Character or Guild service.
|
|
let clients_lock = clients.lock().unwrap();
|
|
for (id, tx) in clients_lock.iter() {
|
|
// For demonstration, send only to clients whose IDs contain
|
|
// "guild". Replace this logic with your actual membership check.
|
|
if id != sender_id && id.contains("guild") {
|
|
let _ = tx.try_send(message.clone());
|
|
}
|
|
}
|
|
}
|
|
} |