public UserMessage[] GetMessagesSinceTime(User user, DateTime time) { UserMessage[] message = UserMessages.Where((m) => user.Equals(m.Recipient) && m.TimeSent <= time).ToArray(); UserMessages.RemoveAll(u => message.Contains(u)); return message; }
public void ToggleSysMessages(User user) { if (SysMessageRecievers.Contains(user)) SysMessageRecievers.Remove(user); else SysMessageRecievers.Add(user); }
bool SendMessage(User u, string message) { UserMessage m = new UserMessage() { Recipient = u, TimeSent = DateTime.Now, Message = message, }; UserMessages.Add(m); return true; }
public void RegisterUser(string username, string password, string hostmask) { SHA256 p = SHA256Managed.Create(); byte[] phash = p.ComputeHash(Encoding.UTF8.GetBytes(password)); User newUser = new User() { DisplayName = username, PermissionSet = Permissions.None, hostmasks = new string[] { hostmask }, passwordHash = phash, LastOnline = DateTime.Now, Online = true, }; UserList.Add(newUser); }