Created
June 5, 2021 10:39
-
-
Save ssukhpinder/3b1f3b0280b59c196336562f0432b724 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Chatroom : AChatroom | |
{ | |
private Dictionary<string, User> _users = new Dictionary<string, User>(); | |
public override void Post(string fromUser, string toUser, string msg) | |
{ | |
User participant = _users[toUser]; | |
if (participant != null) | |
{ | |
participant.DM(fromUser, msg); | |
} | |
} | |
public override void Register(User user) | |
{ | |
if (!_users.ContainsValue(user)) | |
{ | |
_users[user.Name] = user; | |
} | |
user.Chatroom = this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment