Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let users: Rc<Vec<User>> = Rc::new(vec!());
- let conversations: Rc<Vec<Conversation>> = Rc::new(vec!());
- listen("0.0.0.0:30012", |out| Server { out: out, users: users.clone(), conversations: conversations.clone() }).unwrap();
- }
- impl Server {
- fn send_to_all_in_convo(&self, convoid: usize, exclude: usize) {
- let mut convo: Option<&Conversation> = None;
- if let Ok(convos) = Rc::try_unwrap(self.conversations) {
- for c in convos.iter() {
- if c.id == convoid {
- let users = c.users();
- for id in users.iter() {
- if let Some(user) = self.id_get_user(*id) {
- if user.id != exclude {
- if c.has_permission(user.id) {
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement