aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-log-manager.xsl
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-06-02 23:56:53 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-06-02 23:56:53 +0800
commit9dde03a4b7e7398df502b05d18d1010b4ee88cab (patch)
tree8d45dac7656d61f2b9487a7567a4ede3227e3f4d /libempathy/empathy-log-manager.xsl
parente1110b246ff83d6add4bbf01c6ec8a8460070491 (diff)
downloadgsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.tar
gsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.tar.gz
gsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.tar.bz2
gsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.tar.lz
gsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.tar.xz
gsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.tar.zst
gsoc2013-empathy-9dde03a4b7e7398df502b05d18d1010b4ee88cab.zip
Log chats and display 10 last messages when opening a new chat.
2007-06-02 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/gossip-group-chat.c: * libempathy-gtk/gossip-private-chat.c: * libempathy-gtk/gossip-chat.c: * libempathy/empathy-log-manager.c: * libempathy/empathy-log-manager.h: * libempathy/empathy-log-manager.xsl: * libempathy/Makefile.am: Log chats and display 10 last messages when opening a new chat. svn path=/trunk/; revision=114
Diffstat (limited to 'libempathy/empathy-log-manager.xsl')
-rw-r--r--libempathy/empathy-log-manager.xsl148
1 files changed, 148 insertions, 0 deletions
diff --git a/libempathy/empathy-log-manager.xsl b/libempathy/empathy-log-manager.xsl
new file mode 100644
index 000000000..a934f3ab3
--- /dev/null
+++ b/libempathy/empathy-log-manager.xsl
@@ -0,0 +1,148 @@
+<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+
+ <xsl:output method="html" encoding="utf-8" indent="yes"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <style type="text/css">
+ <xsl:text>
+ body {
+ background: #fff;
+ font-family: Verdana, "Bitstream Vera Sans", Sans-Serif;
+ font-size: 10pt;
+ }
+ .stamp {
+ color: #999;
+ }
+ .top-day-stamp {
+ color: #999;
+ text-align: center;
+ margin-bottom: 1em;
+ }
+ .new-day-stamp {
+ color: #999;
+ text-align: center;
+ margin-bottom: 1em;
+ margin-top: 1em;
+ }
+ .nick {
+ color: rgb(54,100, 139);
+ }
+ .nick-self {
+ color: rgb(46,139,87);
+ }
+ .nick-highlight {
+ color: rgb(205,92,92);
+ }
+ </xsl:text>
+ </style>
+ <title><xsl:value-of select="$title"/></title>
+ </head>
+ <body>
+ <xsl:apply-templates/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="get-day">
+ <xsl:param name="stamp"/>
+ <xsl:value-of select="substring ($stamp, 1, 8)"/>
+ </xsl:template>
+
+ <xsl:template name="format-stamp">
+ <xsl:param name="stamp"/>
+ <xsl:variable name="hour" select="substring ($stamp, 10, 2)"/>
+ <xsl:variable name="min" select="substring ($stamp, 13, 2)"/>
+
+ <xsl:value-of select="$hour"/>:<xsl:value-of select="$min"/>
+ </xsl:template>
+
+ <xsl:template name="format-day-stamp">
+ <xsl:param name="stamp"/>
+ <xsl:variable name="year" select="substring ($stamp, 1, 4)"/>
+ <xsl:variable name="month" select="substring ($stamp, 5, 2)"/>
+ <xsl:variable name="day" select="substring ($stamp, 7, 2)"/>
+
+ <xsl:value-of select="$year"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$day"/>
+ </xsl:template>
+
+ <xsl:template name="header">
+ <xsl:param name="stamp"/>
+ <div class="top-day-stamp">
+ <xsl:call-template name="format-day-stamp">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="a">
+ <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
+
+ <xsl:value-of disable-output-escaping="yes" select="@href"/>
+
+ <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
+
+ <xsl:value-of select="@href"/>
+ <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="log">
+
+ <div class="top-day-stamp">
+ <xsl:call-template name="format-day-stamp">
+ <xsl:with-param name="stamp" select="//message[1]/@time"/>
+ </xsl:call-template>
+ </div>
+
+ <xsl:for-each select="*">
+
+ <xsl:variable name="prev-time">
+ <xsl:call-template name="get-day">
+ <xsl:with-param name="stamp" select="preceding-sibling::*[1]/@time"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="this-time">
+ <xsl:call-template name="get-day">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$prev-time &lt; $this-time">
+ <div class="new-day-stamp">
+ <xsl:call-template name="format-day-stamp">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </div>
+ </xsl:if>
+
+ <xsl:variable name="stamp">
+ <xsl:call-template name="format-stamp">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <span class="stamp">
+ <xsl:value-of select="$stamp"/>
+ </span>
+
+ <xsl:variable name="nick-class">
+ <xsl:choose>
+ <xsl:when test="not(string(@id))">nick-self</xsl:when>
+ <xsl:otherwise>nick</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <span class="{$nick-class}">
+ &lt;<xsl:value-of select="@name"/>&gt;
+ </span>
+
+ <xsl:apply-templates/>
+ <br/>
+
+ </xsl:for-each>
+
+ </xsl:template>
+
+</xsl:stylesheet>