Migrating ICQ (and other) contacts to jabber transport
I've been considering migrating completely to jabber since I discovered transports. But poor transition to icq transport was always stopper for me (groups and nicknames lost along the way). I was using multi-protocol clients since then.
Recently two things happened. I discovered a client with message-archiving support called vacuum-im. This is one killer feature I think when implemented properly in clients can persuade many people to switch. Also I'm updating my eeepc and I'm trying to do away with KDE now. So far I had KDE 3.5 working smoothly here, but support has ended long ago and that makes any update pretty painfull.
Kopete (of KDE3) stores contact list in XML file, albeit in bit obscure format. Pulling out relevant information was the easy part, trying to push it back to the client was pretty much useless. Then I've read XMMP specs and was surprised by the simplicity of the needed command. I've made simple XSLT to produce needed command for setting contacts' correct group and name.
Steps to use:
- save following file as kopete_xmmp.xslt
- generate query by calling xsltproc kopete_xmmp.xslt ~/.kde/share/apps/kopete/contactlist.xml
- paste output to XML console of your client of choice (I've used psi)
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Set to your transport --> <xsl:variable name="transport" select='"icq.blesmrt.net"' /> <xsl:template match='/'> <iq type='set' id='roster_icq_contacts'> <query xmlns='jabber:iq:roster'> <xsl:apply-templates/> </query> </iq> </xsl:template> <xsl:template match="plugin-data[ @plugin-id = 'ICQProtocol' ]"> <item xmlns='jabber:iq:roster' subscription='both'> <xsl:attribute name="jid"><xsl:value-of select="plugin-data-field[@key='contactId']"/>@<xsl:value-of select="$transport"/></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="plugin-data-field[@key='displayName']"/></xsl:attribute> <xsl:for-each select="../groups/group"> <xsl:variable name="gid" select='@id' /> <group> <xsl:value-of select="//kopete-group[@groupId=$gid]/display-name"/> </group> </xsl:for-each> </item> </xsl:template> <xsl:template match="text()"/> </xsl:stylesheet>

rss