comparison buddytrans @ 5:494816c30ca7

[gaim-migrate @ 14] Last of the files committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 23 Mar 2000 03:23:41 +0000
parents
children
comparison
equal deleted inserted replaced
4:4f8c70a9f762 5:494816c30ca7
1 #!/usr/bin/perl -w
2 #
3 # gaim
4 #
5 # Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #
21 # ---
22 #
23 # Buddy List Conversion Script Written By: John Assalone <assalonej@kpe.com>
24 # Modifications by: Rob Flynn <IM: Rob Flynn> <rflynn@blueridge.net>
25 #
26 # Syntax: ./buddytrans buddy.list gaimlist
27 #
28
29 print "Gaim - Buddy List Translator\n";
30 print "----------------------------\n";
31
32 if ((!$ARGV[0]) || (!$ARGV[1]))
33 {
34 print "Syntax: ./buddytrans buddy.lst gaimlist\n";
35 exit(0);
36 }
37
38 $source = $ARGV[0];
39 $dest = $ARGV[1];
40 if (-e $source)
41 {
42 print("Source=$source, Dest=$dest\n");
43
44 if (-e $dest)
45 {
46 print ("$dest exists! Should I continue? ");
47 if (<STDIN> =~ /^y/i)
48 {
49 do_trans();
50 }
51 else { exit(0); }
52 }
53
54 do_trans();
55
56 sub do_trans {
57 open (SOURCE, $source);
58 open (DEST, ">$dest");
59 print DEST "toc_set_config {m 1\n";
60 while ($line = <SOURCE>) {
61 chomp($line);
62 if ($line =~ /[a-zA-Z]+/) {
63 if ($line =~ /^\s/) { $line =~ s/\s//; }
64 $line =~ s/\s/\*/;
65 ($field, $name) = split(/\*/, $line);
66 if ($field eq "group") {
67 $name =~ s/\"//g;
68 print DEST "g $name\n";
69 next;
70 }
71 if ($field eq "buddy") {
72 $name =~ s/\"//g;
73 print DEST "b $name\n";
74 next;
75 }
76 else { next; }
77 }
78 else { next; }
79 }
80 print DEST "}";
81 }
82 print "Conversion Complete.\n";
83 } else {
84 print "Source file must exist!\n\nSyntax: ./buddytrans buddy.lst gaimlist\n";
85 exit(0);
86 }
87