<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html"/>
	<xsl:template match="message">
		<div style="width: 100%; padding: 5px 0px 5px 0px; margin: 0px;">
		<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
		<div>
			<xsl:choose>
				<xsl:when test="@direction='3'" />
				<xsl:when test="@direction='2'" />
				<xsl:when test="@direction='1'">
					<!-- Outgoing -->
					<xsl:attribute name="style">
						<xsl:text>border-style: solid; border-width: 1px 1px 1px 1px; padding: 2px; clear: both; font-weight: bold; background-color: #9AB; border-color: #9AB; width: 80%; float: right; text-align: right; margin-top: 5px;</xsl:text>
					</xsl:attribute>
					<b><kopete-i18n>Message to %TO_METACONTACT_DISPLAYNAME%</kopete-i18n> @<xsl:value-of select="@time"/></b>
				</xsl:when>
				<xsl:otherwise>
					<!-- Incoming -->
					<xsl:attribute name="style">
						<xsl:text>border-style: solid; border-width: 1px 1px 1px 1px; padding: 2px; clear: both; font-weight: bold; background-color: #ccc; border-color: #ccc; width: 80%; float: left; text-align: left; margin-top: 5px;</xsl:text>
					</xsl:attribute>
					<b><kopete-i18n>Message from %FROM_METACONTACT_DISPLAYNAME%</kopete-i18n> @<xsl:value-of select="@time"/></b>
				</xsl:otherwise>
			</xsl:choose>
			</div>
			<div style="clear: both; width: 100%; text-align: center;">
				<xsl:attribute name="dir">
					<xsl:value-of select="body/@dir"/>
				</xsl:attribute>
				<xsl:choose>
					<xsl:when test="@direction='3'">
						<!--action message-->
						<span style="color:darkgreen">
							<xsl:text> * </xsl:text>
							<span>
								<xsl:attribute name="dir">
									<xsl:value-of select="from/contact/metaContactDisplayName/@dir"/>
								</xsl:attribute>
								<xsl:value-of disable-output-escaping="yes" select="from/contact/metaContactDisplayName/@text"/>
							</span>
							<xsl:text> </xsl:text>
							<xsl:value-of disable-output-escaping="yes" select="body"/>
						</span>
					</xsl:when>
					<xsl:when test="@direction='2'">
						<!--internal message-->
						<i><xsl:value-of disable-output-escaping="yes" select="body"/></i>
					</xsl:when>
					<xsl:when test="@direction='1'">
						<xsl:attribute name="style">
							<xsl:value-of select="@style" />
							<xsl:text>padding: 2px; width: 80%; clear: both; background-color: #CDE; border: 1px solid #9ab; float: right; text-align: right; margin-bottom: 5px;</xsl:text>
						</xsl:attribute>
						<xsl:value-of disable-output-escaping="yes" select="body"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="style">
							<xsl:value-of select="@style" />
							<xsl:text>padding: 2px; width: 80%; clear: both; background-color: #EEE; border: 1px solid #CCC; float: left; text-align: left; margin-bottom: 5px;</xsl:text>
						</xsl:attribute>
						<xsl:value-of disable-output-escaping="yes" select="body"/>
					</xsl:otherwise>
				</xsl:choose>
			</div>
		</div>
	</xsl:template>
</xsl:stylesheet>

