1685
|
1 #!/usr/bin/perl
|
|
2
|
|
3 ## gaim buddy list to aim blt format converter
|
|
4
|
|
5 if ($ARGV[0] && $ARGV[1]) {
|
|
6 open (FILE,$ARGV[0]);
|
|
7 print "Config {\n version 1\n}\nUser {\n screename $ARGV[1]\n}\nBuddy {\n list {\n ";
|
|
8 foreach $line (<FILE>) {
|
|
9 chomp ($line);
|
|
10 $line =~ s/^ +//; ## strip any preceding spaces
|
|
11 next unless $line =~ /^[bg]/; ## Ignore everything but the b and g lines
|
|
12 @buddy = split(//,$line); ## strip off the first 2 chars of the line.
|
|
13 shift @buddy; ## crappy way to do it, but I didn't want to
|
|
14 shift @buddy; ## mess up screen names with spaces in them.
|
|
15 foreach $char (@buddy) {
|
|
16 $buddy .= $char;
|
|
17 }
|
|
18 @screenname = split(/:/,$buddy); ## split off the aliases
|
|
19
|
|
20 if ($line =~ /^g/) {
|
|
21 print " }\n $screenname[0] {\n";
|
|
22 } elsif ($line =~ /^b/) {
|
|
23 print " $screenname[0]\n";
|
|
24 }
|
|
25 $buddy = undef;
|
|
26 }
|
|
27 print " }\n";
|
|
28 } else {
|
|
29 print "\n\n\n\tExample:\n\n\t\tgaim2blt.pl gaim.buddy.file YourScreenName\n\n\n\n";
|
|
30 }
|