private void RoomTypeChangedCommand(IDictionary<string, object> command) { var channelId = command.Get(Constants.Arguments.Channel); var isPublic = (command.Get(Constants.Arguments.Message)).IndexOf("public", StringComparison.OrdinalIgnoreCase) != -1; var channel = ChatModel.CurrentChannels.FirstByIdOrNull(channelId); if (channel == null) return; // can't change the settings of a room we don't know channel.Type = isPublic ? ChannelType.Private : ChannelType.InviteOnly; var updateArgs = new ChannelTypeChangedEventArgs { IsOpen = isPublic }; Events.NewChannelUpdate(channel, updateArgs); }
private void RoomTypeChangedCommand(IDictionary <string, object> command) { var channelId = command.Get(Constants.Arguments.Channel); var isPublic = (command.Get(Constants.Arguments.Message)).IndexOf("public", StringComparison.OrdinalIgnoreCase) != -1; var channel = ChatModel.CurrentChannels.FirstByIdOrNull(channelId); if (channel == null) { return; // can't change the settings of a room we don't know } channel.Type = isPublic ? ChannelType.Private : ChannelType.InviteOnly; var updateArgs = new ChannelTypeChangedEventArgs { IsOpen = isPublic }; Events.NewChannelUpdate(channel, updateArgs); }