Beginning with Kopete 1.0, Kopete ships with a plugin called Pipes. Pipes allows you to pipe incoming or outgoing messages through an external script or executable. An incoming message will be piped through the executable before it reaches your chat window, while outgoing messages will be piped through the executable before they are sent over the internet. Pipes can receive text in one of three forms:
- Plain text body
The body of the message, in plain ASCII text
- HTML text body
The body of the message, in HTML, as it would be if your chat peer had sent HTML to you, which will be rendered in the chat window
- XML full message
An XML document that describes all the characteristics of the message, including the HTML body.
This document describes the specifics of the XML format, and how to write a program that can handle it.
Here's an example of what a program will receive in its standard input stream:
<?xml version="1.0" encoding="ISO-8859-1"?>
timestamp="Sat Dec 1 11:06:46 2007"
time="11:06 am" >
<contactDisplayName dir="ltr" text="tdurden" />
<contactDisplayName dir="ltr" text="spacemonkey1234" />
<metaContactDisplayName dir="ltr" text="Robert Paulson" />
<span style=" color:#000000;">hey</span></body>
This XML is loosely based on the XSD used for chatstyles found at the Kopete website. This code represents one message. There are a few things to note:
The "timestamp" attribute in the "message" element is in ISO 8601 standard format.
The "protocolIcon" attribute in the "contact" element is chosen like this:
If the Contact object has the photo property set, that path is used.
If not, the Contact's MetaContact is asked for a picture path, and that is used regardless of being null or not.
The "color" and "bgcolor" attributes in the "body" element are empty strings if they are not set in Kopete. They are in web color format.
The content inside the "body" element has "<" escaped, so it is not confused with the actual XML structure. Obviously, to correctly interpret the body as HTML, one would have to convert the "<"s to "<"s.