[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    [kopete-devel] "/me" in a kopete message
From:       Tobias Leupold <tobias.leupold () web ! de>
Date:       2005-11-03 13:46:36
Message-ID: 436A14BC.1020508 () web ! de
[Download RAW message or body]

Hi :-)

I've written a Psi-like Style for kopete (
http://psi-im.org/psi.affinix.com/ ). Now, I have a question. I would
like to mark incoming or outgoing messages beginning with "/me" as an
action (as Psi does). I don't see how to do that as this time ... so: is
it possible?

Here's my style sheet:

<?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 class="KopeteMessage">

      <xsl:attribute name="id">
        <xsl:value-of select="@id"/>
      </xsl:attribute>

      <!-- First, decide the "full line" style -->

      <xsl:attribute name="style">

        <!-- decide font color by message type -->

        <xsl:choose>

          <!-- internal message -->
          <xsl:when test="@route='internal'">
            <xsl:text>color:green;</xsl:text>
          </xsl:when>

          <!-- action message -->
          <xsl:when test="@type='action'">
            <xsl:text>color:blue;</xsl:text>
          </xsl:when>

          <!-- incoming/outgoing message -->
          <xsl:otherwise>
            <xsl:if test="body/@color">
              <xsl:text>color:</xsl:text><xsl:value-of
select="body/@color"/><xsl:text>;</xsl:text>
            </xsl:if>
          </xsl:otherwise>

        </xsl:choose>

        <!-- if there is a bgcolor, apply it -->
        <xsl:if test="body/@bgcolor">
          <xsl:text>background-color:</xsl:text>
          <xsl:value-of select="body/@bgcolor"/>
          <xsl:text>;</xsl:text>
        </xsl:if>

      </xsl:attribute>

      <!-- Decide the Pre-body output by message type -->

      <xsl:choose>

        <!--internal message-->

        <xsl:when test="@route='internal'">

          <span class="KopeteDisplayTimestamp">
            [<xsl:value-of select="@time"/>]
          </span>

          <span>
            <xsl:text disable-output-escaping="yes">*** </xsl:text>
          </span>

        </xsl:when>

        <!-- action message -->

        <xsl:when test="@type='action'">

          <span class="KopeteDisplayTimestamp">
            [<xsl:value-of select="@time"/>]
          </span>

          <span>
            <xsl:text disable-output-escaping="yes">*</xsl:text>
          </span>

          <span class="KopeteDisplayName">

            <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"/>

            <xsl:text disable-output-escaping="yes"> </xsl:text>

          </span>

        </xsl:when>

        <!-- incoming/outgoing messages -->

        <xsl:otherwise>

          <span>

            <xsl:attribute name="style">

              <xsl:choose>

                <!-- outgoing -->
                <xsl:when test="@route='inbound'">
                  color:red;
                </xsl:when>

                <!-- incoming -->
                <xsl:otherwise>
                  color:blue;
                </xsl:otherwise>

              </xsl:choose>

            </xsl:attribute>

            <span class="KopeteDisplayTimestamp">
              [<xsl:value-of select="@time"/>]
            </span>

            <xsl:text disable-output-escaping="yes">&#60;</xsl:text>

            <span class="KopeteDisplayName">

              <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 disable-output-escaping="yes">&#62; </xsl:text>

          </span>

        </xsl:otherwise>

      </xsl:choose>

      <!-- Body output -->

      <span>

        <xsl:if test="@importance='2'">
          <xsl:attribute name="class">
            <xsl:text>KopeteMessage highlight</xsl:text>
          </xsl:attribute>
        </xsl:if>

        <xsl:attribute name="dir">
          <xsl:value-of select="body/@dir"/>
        </xsl:attribute>

        <xsl:value-of disable-output-escaping="yes" select="body"/>

      </span>

    </div>

  </xsl:template>

</xsl:stylesheet>
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic