Exemplo n.º 1
0
        public bool AddUser(string nick, string URL)   //Add a new user that just connected to the new list of users
        {
            foreach (var user in users)
            {
                if (user.Nick == nick)
                {
                    return(false);
                }
            }

            ICChat c = (ICChat)Activator.GetObject(typeof(ICChat), URL);

            users.Add(new User(nick, URL, c));
            System.Console.WriteLine($"User {nick} joined the chat.");

            foreach (var user in users.Where(x => x.Nick != nick)) //Notify other users that someone joinned
            {
                user.getICChat().ReceiveNewConnection(nick, true);;
            }
            return(true);
        }
Exemplo n.º 2
0
 public void Subscribe(ICChat client)
 {
     clientList.Add(client);
 }
Exemplo n.º 3
0
 public User(string nick, string url, ICChat ic)
 {
     this.Nick  = nick;
     this.Url   = url;
     this.ichat = ic;
 }