# HG changeset patch # User Eric Warmenhoven # Date 988408269 0 # Node ID fe303467a026ea8a506b9e4457e71a53b0348b4e # Parent c55038f061dde4662982e58cb05e067787bd7a84 [gaim-migrate @ 1771] these aren't necessary anymore because gaim can import winaim lists. committer: Tailor Script diff -r c55038f061dd -r fe303467a026 buddytrans --- a/buddytrans Fri Apr 27 20:09:11 2001 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -#!/usr/bin/perl -w -# -# gaim -# -# Copyright (C) 1998-1999, Mark Spencer -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# --- -# -# Buddy List Conversion Script Written By: John Assalone -# Modifications by: Rob Flynn -# -# Syntax: ./buddytrans buddy.list gaimlist -# - -print "Gaim - Buddy List Translator\n"; -print "----------------------------\n"; - -if ((!$ARGV[0]) || (!$ARGV[1])) -{ - print "Syntax: ./buddytrans buddy.lst gaimlist\n"; - exit(0); -} - -$source = $ARGV[0]; -$dest = $ARGV[1]; -if (-e $source) -{ - print("Source=$source, Dest=$dest\n"); - - if (-e $dest) - { - print ("$dest exists! Should I continue? "); - if ( =~ /^y/i) - { - do_trans(); - } - else { exit(0); } - } - - do_trans(); - -sub do_trans { - open (SOURCE, $source); - open (DEST, ">$dest"); - print DEST "toc_set_config {m 1\n"; - while ($line = ) { - chomp($line); - if ($line =~ /[a-zA-Z]+/) { - if ($line =~ /^\s/) { $line =~ s/\s//; } - $line =~ s/\s/\*/; - ($field, $name) = split(/\*/, $line); - if ($field eq "group") { - $name =~ s/\"//g; - print DEST "g $name\n"; - next; - } - if ($field eq "buddy") { - $name =~ s/\"//g; - print DEST "b $name\n"; - next; - } - else { next; } - } - else { next; } - } - print DEST "}"; -} - print "Conversion Complete.\n"; -} else { - print "Source file must exist!\n\nSyntax: ./buddytrans buddy.lst gaimlist\n"; - exit(0); -} - diff -r c55038f061dd -r fe303467a026 buddytrans.c --- a/buddytrans.c Fri Apr 27 20:09:11 2001 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -#include -#include -#include -#include -#include -#include - -void do_trans(int, int); - -int main(int argc, char **argv) { - char *srcn; - char *destn; - int src; - int dest; - char *resp; - - - printf("Gaim - Buddy List Translator\n"); - printf("----------------------------\n"); - - if (argc != 3) { - printf("Syntax: %s buddy.lst gaimlist\n", argv[0]); - exit(0); - } - - srcn = argv[1]; - destn = argv[2]; - - if ((src = open(srcn, O_RDONLY)) != -1) { - printf("Source=%s, Dest=%s\n", srcn, destn); - - if ((dest = open(destn, O_WRONLY | O_CREAT | O_EXCL)) == -1) { - printf("%s exists! Should I continue? ", destn); - scanf("%s", resp); - if (strchr(resp, 'y') || strchr(resp, 'Y')) { - dest = open(destn, O_WRONLY | O_CREAT | - O_TRUNC); - do_trans(src, dest); - } else - exit(0); - } else - do_trans(src, dest); - printf("Conversion Complete.\n"); - } else { - printf("Source file must exist!\n\nSyntax: %s buddy.lst gaimlist\n", argv[0]); - exit(0); - } - return 0; -} - -void do_trans(int source, int destin) { - FILE *src; - FILE *dest; - char line[1024]; - - umask(644); - src = fdopen(source, "r"); - dest = fdopen(destin, "w"); - - fprintf(dest, "toc_set_config {m 1\n"); - while (fgets(line, sizeof line, src)) { - line[strlen(line) - 1] = 0; - if (strpbrk(line, "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) { - char *field, *name; - if (line[0] == ' ' || line[0] == '\t' || - line[0] == '\n' || line[0] == '\r' || - line[0] == '\f') - field = strdup(line + 1); - else - field = strdup(line); - name = strpbrk(field, " \t\n\r\f"); - name[0] = 0; - name += 2; - name[strlen(name) - 1] = 0; - printf("%s, %s\n", field, name); - if (!strcmp("group", field)) { - fprintf(dest, "g %s\n", name); - } else if (!strcmp("buddy", field)) { - fprintf(dest, "b %s\n", name); - } - free(field); - } - } - fprintf(dest, "}"); - fclose(src); - fclose(dest); -} diff -r c55038f061dd -r fe303467a026 buddytrans2 --- a/buddytrans2 Fri Apr 27 20:09:11 2001 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -#!/usr/bin/perl -w -# -# gaim -# -# Copyright (C) 1998 - 2000, Mark Spencer -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# --- -# -# Buddy List Conversion Script Written By: John Assalone -# Modifications by: Rob Flynn -# Obfuscated by: Schuyler Erle -# -# Use this script to convert the new WinAIM buddy list format to gaim's format. -# -# Syntax: ./buddytrans buddy.list gaimlist -# - -use strict; -use 5.003; - -sub translate_lst -{ - my $src = shift; - my ($line, $field, $name, $out); - - $out = "m 1\n"; - - for $line (grep(/\w/o, split(/[\r\n]+/o, $src))) { - ($field, $name) = ($line =~ /^\s*(\w)\w*\s+(.+)$/go); - $name =~ y/"//d; - $out .= "$field $name\n" if $field and $name; - } - - $out -} - -sub translate_blt -{ - my $src = shift; - my $out = "m 1\n"; - my $grp; - - $src =~ s/^.*?Buddy\s+{.*?list\s+{//gos; - - while ( $src =~ / } | - (?: "([^"]+)" | (\S+) ) \s* - (?: {(.+?)} | ([^\n]+) ) \s*/gosx ) { - - last unless defined( $grp = $1 || $2 ); - - $out .= join( "\n", "g $grp", - map { "b $_" } - grep { defined($_) and /\S/o } - split ( /"([^"]+)"|\s+/, ($3 || $4) ) ) - . "\n" - } - - $out; -} - -sub buddy_trans -{ - my ($src_file, $dest_file) = @_; - - die "Syntax: $0 buddy.lst gaimlist\n" - unless ($src_file and $dest_file); - - - open SOURCE, "<$src_file" or die "$!: $src_file\n"; - my $src = do { local $/ = undef; }; - close SOURCE; - - if (-e $dest_file) { - print STDERR "$dest_file already exists! Continue? "; - unless (-t and =~ /^y/io) { - print STDERR "Aborted.\n"; - exit -1 - } - } - - open DEST, ">$dest_file" or die "$!: $dest_file\n"; - print DEST ($src =~ /{/os) ? translate_blt($src) : translate_lst($src); - close DEST; - - 0; -} - -buddy_trans( @ARGV );