view gaim2blt.pl @ 1737:82c824fe018e

[gaim-migrate @ 1747] be able to handle offline messages. should make it so that they have the correct timestamp, but eh. that'll have to come later, when the UI can handle it. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 21 Apr 2001 01:59:38 +0000
parents 73be09912842
children 7506587a394d
line wrap: on
line source

#!/usr/bin/perl 

##  gaim buddy list to aim blt format converter
my $top = 1;
if ($ARGV[0] && $ARGV[1]) {
	open (FILE,$ARGV[0]);
	print "Config {\n version 1\n}\nUser {\n screename $ARGV[1]\n}\nBuddy {\n list {\n";
	foreach $line (<FILE>) {
		chomp ($line);
		$line =~ s/^ +//;			## strip any preceding spaces
		next unless $line =~ /^[bg]/;    	## Ignore everything but the b and g lines
		@buddy = split(//,$line);		## strip off the first 2 chars of the line.
		shift @buddy;				##   crappy way to do it, but I didn't want to
		shift @buddy;				##   mess up screen names with spaces in them.
		foreach $char (@buddy) {
			$buddy .= $char;
		}
		@screenname = split(/:/,$buddy);	## split off the aliases
		
		if ($line =~ /^g/) {
			print "  }\n" unless $top;
			print "  $screenname[0] {\n";
			$top = 0;
		} elsif ($line =~ /^b/) {
			print "   $screenname[0]\n";
		}
	$buddy = undef;
	}
	print "  }\n }\n}\n";
} else {
	print "\n\n\n\tExample:\n\n\t\tgaim2blt.pl gaim.buddy.file YourScreenName\n\n\n\n";
}