annotate gaim2blt.pl @ 1688:85d8c64e969d

[gaim-migrate @ 1698] linky linky committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 06 Apr 2001 19:10:28 +0000
parents 73be09912842
children 7506587a394d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1685
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 #!/usr/bin/perl
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 ## gaim buddy list to aim blt format converter
1686
73be09912842 [gaim-migrate @ 1696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1685
diff changeset
4 my $top = 1;
1685
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 if ($ARGV[0] && $ARGV[1]) {
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 open (FILE,$ARGV[0]);
1686
73be09912842 [gaim-migrate @ 1696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1685
diff changeset
7 print "Config {\n version 1\n}\nUser {\n screename $ARGV[1]\n}\nBuddy {\n list {\n";
1685
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 foreach $line (<FILE>) {
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 chomp ($line);
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 $line =~ s/^ +//; ## strip any preceding spaces
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 next unless $line =~ /^[bg]/; ## Ignore everything but the b and g lines
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 @buddy = split(//,$line); ## strip off the first 2 chars of the line.
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 shift @buddy; ## crappy way to do it, but I didn't want to
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 shift @buddy; ## mess up screen names with spaces in them.
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 foreach $char (@buddy) {
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 $buddy .= $char;
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 }
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 @screenname = split(/:/,$buddy); ## split off the aliases
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 if ($line =~ /^g/) {
1686
73be09912842 [gaim-migrate @ 1696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1685
diff changeset
21 print " }\n" unless $top;
73be09912842 [gaim-migrate @ 1696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1685
diff changeset
22 print " $screenname[0] {\n";
73be09912842 [gaim-migrate @ 1696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1685
diff changeset
23 $top = 0;
1685
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 } elsif ($line =~ /^b/) {
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 print " $screenname[0]\n";
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 }
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 $buddy = undef;
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 }
1686
73be09912842 [gaim-migrate @ 1696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1685
diff changeset
29 print " }\n }\n}\n";
1685
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 } else {
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 print "\n\n\n\tExample:\n\n\t\tgaim2blt.pl gaim.buddy.file YourScreenName\n\n\n\n";
e8e190793fe3 [gaim-migrate @ 1695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 }