//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;

namespace CommunityServer.Files.Components
{
	/// <summary>
	/// Summary description for CensorshipModule.
	/// </summary>
	public class CensorshipModule : BaseFilesFormattedBodyModule
	{
		public CensorshipModule()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		protected override void Format(Entry e)
		{
			if( CSContext.Current.SiteSettings.EnableCensorship )
			{
				e.FormattedBody = Transforms.CensorPost( e.FormattedBody );
				e.Subject = Transforms.CensorPost( e.Subject );
			
				if(e.PostID > 0)
					e.EditNotes = Transforms.CensorPost( e.EditNotes );
			}
		}

		protected override void Format(EntryComment ec)
		{
			if( CSContext.Current.SiteSettings.EnableCensorship )
			{
				ec.FormattedBody = Transforms.CensorPost( ec.FormattedBody );
				ec.Subject = Transforms.CensorPost( ec.Subject );
			}
		}
	}
}

