public bool CreatePrivateChatroom(PrivateChatroomOptions options) { try { Chatroom c = new Chatroom(options.Id, options.Name, options); AllSubChatrooms.Add(c.Id, c); return(true); } catch (Exception e) { return(false); } }
public Chatroom(int id, string name, PrivateChatroomOptions options = null) { Name = name; Id = id; IdleTimer = new Timer(); IdleTimer.Elapsed += new ElapsedEventHandler(IdleCheck); IdleTimer.Interval = 60000; IdleTimer.Enabled = true; if (options != null) { PasswordHash = options.PasswordHash; if (options.Blacklist != null) { Blacklist = options.Blacklist.Split(','); } Capacity = options.Capacity; Parent = options.Parent; IsPrivate = true; } else { var messages = MessageService.GetRecentChatroomMessages(Id, 1000); foreach (var message in messages) { var m = new ChatroomMesssage() { RawMessage = message.FormattedMessage, IntendedForUserId = message.IntendedForUserId, StyleMessage = message.Style }; FormattedMessagesCache.Add(message.Id, m); FormattedMessageOrder.Add(message.Id); } } }