/**********************************************************************
 * LeechCraft - modular cross-platform feature rich internet client.
 * Copyright (C) 2006-2014  Georg Rudoy
 *
 * Boost Software License - Version 1.0 - August 17th, 2003
 *
 * Permission is hereby granted, free of charge, to any person or organization
 * obtaining a copy of the software and accompanying documentation covered by
 * this license (the "Software") to use, reproduce, display, distribute,
 * execute, and transmit the Software, and to prepare derivative works of the
 * Software, and to permit third-parties to whom the Software is furnished to
 * do so, all subject to the following:
 *
 * The copyright notices in the Software and this entire statement, including
 * the above license grant, this restriction and the following disclaimer,
 * must be included in all copies of the Software, in whole or in part, and
 * all derivative works of the Software, unless such copies or derivative
 * works are solely in the form of machine-executable object code generated by
 * a source language processor.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
 * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
 * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 **********************************************************************/

#ifndef PLUGINS_AZOTH_INTERFACES_IRICHTEXTMESSAGE_H
#define PLUGINS_AZOTH_INTERFACES_IRICHTEXTMESSAGE_H
#include <QtPlugin>

namespace LC
{
namespace Azoth
{
	/** @brief Interface for messages supporting rich text contents.
	 * 
	 * If a message supports rich text contents (like HTML formatting or
	 * inline images) and wants to advertise this, it should also
	 * implement this interface in addition to the plain IMessage.
	 * 
	 * The contents returned by GetRichBody() should only supplement the
	 * plain text string returned by IMessage::GetBody(). That is, the
	 * string returned IMessage::GetBody() should have basically the
	 * same meaning as the one from GetRichBody().
	 * 
	 * @sa IMessage
	 */
	class IRichTextMessage
	{
	public:
		virtual ~IRichTextMessage () {}

		/** @brief Returns the rich text contents.
		 * 
		 * The returned string is expected to be an HTML string. It
		 * should be possible to append the string contents as the child
		 * of HTML's body element.
		 * 
		 * The contents of the returned string should have the same
		 * semantic meaning to the user as the ones of the string
		 * returned by the IMessage::GetBody(). Ideally, the latter
		 * should be equal to the contents of this one stripped of all
		 * the HTML formatting.
		 * 
		 * The string contents aren't escaped by the core. All the
		 * required escaping should be done by the interface
		 * implementation itself.
		 * 
		 * @return The HTML-formatted rich text string.
		 * 
		 * @sa SetRichBody(), IMessage::GetBody()
		 */
		virtual QString GetRichBody () const = 0;
		
		/** @brief Sets the rich text contents.
		 * 
		 * This function is called to set the HTML-formatted rich
		 * contents of the message. The passed string satisfies all the
		 * requirements mentioned in the GetRichBody() documentation.
		 * 
		 * This function should NOT update the usual plain-text body of
		 * the message, it would be set separately.
		 * 
		 * @param[in] text The HTML-formatted contents of the message.
		 * 
		 * @sa GetRichBody(), IMessage::SetBody()
		 */
		virtual void SetRichBody (const QString& text) = 0;
	};
}
}

Q_DECLARE_INTERFACE (LC::Azoth::IRichTextMessage,
	"org.Deviant.LeechCraft.Azoth.IRichTextMessage/1.0")

#endif
