Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. fn main() {
  2. let users: Rc<Vec<User>> = Rc::new(vec!());
  3. let conversations: Rc<Vec<Conversation>> = Rc::new(vec!());
  4. listen("0.0.0.0:30012", |out| Server { out: out, users: users.clone(), conversations: conversations.clone() }).unwrap();
  5. }
  6.  
  7. impl Server {
  8. fn send_to_all_in_convo(&self, convoid: usize, exclude: usize) {
  9. let mut convo: Option<&Conversation> = None;
  10. if let Ok(convos) = Rc::try_unwrap(self.conversations) {
  11. for c in convos.iter() {
  12. if c.id == convoid {
  13. let users = c.users();
  14. for id in users.iter() {
  15. if let Some(user) = self.id_get_user(*id) {
  16. if user.id != exclude {
  17. if c.has_permission(user.id) {
  18.  
  19. }
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement