« Irlande : les photos (étape 3 : Dublin) | Accueil | Last months in Paris »

Create a .ctt file

Posté le jeudi 08 novembre 2007 à 08:02 PM

In order to help my girlfriend with a MSN account transition I had to create a .ctt file. It's a pretty simple XML-formatted file containing a batch of MSN ids. The file is created by MSN using the export contact commands and can be used to restore them.

There is an example of the file :

<?xml version="1.0"?>
<messenger>
<service name=".NET Messenger Service">
<contactlist>
<contact>bletofarineblah@gmail.com</contact>
<contact>bletofarinebleh@gmail.com</contact>
</contactlist>
</service>
</messenger>

And a simple, quick and dirty Perl file who looks into a .csv file for something looking like e-mails and create a .ctt from it.

#!/usr/bin/perl -w

use strict;

print "<?xml version=\"1.0\"?>\n";
print "<messenger>\n";
print " <service name=\".NET Messenger Service\">\n";
print " <contactlist>\n";

while (<STDIN>) {
if ($_ =~ m/,([^,]+@[^,]+)/) {
print " <contact>$1</contact>\n";
}
}

print " </contactlist>\n";
print " </service>\n";
print "</messenger>\n";