/* This file is part of Lupt. Lupt is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Lupt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lupt. If not, see */ //! Chat Pinnd(पिण्ड) is Actor to manage Websocket Chat related action mod user; mod message; use std::{collections::HashMap, vec}; use actix::prelude::*; use actix_broker::BrokerSubscribe; use crate::{ws_sansad, broker_messages as ms, broker_messages::util::Resp}; #[allow(dead_code)] pub struct ChatPinnd { kaksh: HashMap, // kunjika, Kaksh vyaktigat_waitlist: Vec, } pub struct Kaksh { length: Option, last_message_id: u128, loog: Vec } pub struct Loog { addr: Addr, kunjika: String, name: String, tags: Option> } #[derive(Debug, Clone)] pub struct Vyakti { name: String, tags: Vec } pub struct VyaktiWatchlist { kunjika: String, name: String, tags: Vec, addr: Addr } impl Actor for ChatPinnd { type Context = Context; fn started(&mut self, ctx: &mut Self::Context) { // for actix broker self.subscribe_system_async::(ctx); self.subscribe_system_async::(ctx); self.subscribe_system_async::(ctx); self.subscribe_system_async::(ctx); self.subscribe_system_async::(ctx); self.subscribe_system_async::(ctx); self.subscribe_system_async::(ctx); } } impl Default for ChatPinnd { fn default() -> Self { ChatPinnd { kaksh: HashMap::new(), vyaktigat_waitlist: Vec::new() } } } impl Loog { fn new(addr: Addr, kunjika: String, name: String, tags: Option>) -> Self { Loog { addr, kunjika, name, tags } } } impl SystemService for ChatPinnd {} impl Supervised for ChatPinnd {}