Emoticons Specification

Emoticons

Introduction
This DRAFT document defines how to make a theme of emoticons typically used in instant messaging applications
The basic scheme is very simple. The theme consists in one sub directory which contains all the pictures and an file that gives each picture ASCII symbols. A .directory file might be used.

File locations
Files involved in this specification are located according to the "desktop base directory specification" which can be found on www.freedesktop.org.
All the files of the theme must be placed in a sub directory of $XDG_DATA_DIRS/emoticons/ The name of the directory must be equal to the name of the theme. That directory must contains a file called emoticons.xml the format of that file is described below.
The theme directory may also contain a .directory file which contains translations of the theme name and/or an icon for that theme.

Format of the emoticons.xml file
Emoticon map files must be well-formed XML files. Implementations should ignore unknown tag or unknown attributes.

Elements
<messaging-emoticon-map> [version="0.1"] 	 The root element is <messaging-emoticon-map> all other elements are contained by it.
<emoticon file="..."> 	 This element represents one emoticon. The attribute file is the name of the image file which must be in the same directory. The extension may be omitted. In that case, the implementation look in that directory for a file with the same name in a supported format.
There are no order for emoticon in the map. But the first icon in the map is generally used to identify the theme graphically. By convention the this SHOULD be :-)
<string> 	 This element may only appear below <emoticon>. It represents the ASCII string which will be matched in the text, and replaced by the image specified by the file attribute of the emoticon.
There may be several strings per emoticon.
There is no order for string inside an emoticon. But the first one SHOULD be the default one, and will be taken if there is a GUI selector.

Format of the image.
All images SHOULD be in a supported format : PNG, GIF or MNG.

Implementations notes

Emoticon parser
There are no real recommendation how to parse emoticons. But an emoticon with a longer string should have the priority over one with a shorter string. (Example: if both :-() and :-( are in a theme, the picture for the first one should be used when :-() is encountered)

Example

<messaging-emoticon-map>
	<emoticon file="smile.png">
			<string>:-)</string>
			<string>:)</string>
			<string>:o)</string>
	</emoticon>

	<emoticon file="wink.png">
			<string>;-)</string>
			<string>;)</string>
	</emoticon>

	<emoticon file="unhappy.png">
			<string>:-(</string>
			<string>:(</string>
	</emoticon>
</messaging-emoticon-map>