view gaim2blt.pl @ 5388:5d0df915ca09

[gaim-migrate @ 5764] This patch is Sofar's (Auke Kok) napster update warmenhovinated by me. So... the Napster PRPL works with Opennap servers now. Thanks Auke. There are a few places that still need a bit of work. Namely joining and parting chats. I don't have time to look at it right now, but search for XXX and // and you'll see the stuff that is relevant to it, if anyone wants to fix the memleak or two. For any potential Gaim hackers out there, a few notes: -Put all declarations at the top of a block--we're not all using C99 -Please don't use // comments, use /* */ (// is for C) -Try to use dynamic buffers rather than static buffers in most places. I think most of us Gaim people perfer dynamic rather than static. I wish oscar.c was this short. Or this clean. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 15 May 2003 21:43:42 +0000
parents 66bf7ecefedd
children
line wrap: on
line source

#!/usr/bin/perl -w
# Original by Andy Harrison,
# Rewrite by Decklin Foster,
# Available under the GPL.

package Gaim2Blt;
use strict;
use Getopt::Std;
use vars qw(%opts $in_group);

getopts('s:', \%opts);
die "usage: $0 -s 'screen name' gaim.buddy\n" unless $opts{s};

print <<"EOF";
Config {
  version 1
}
User {
  screenname "$opts{s}"
}
Buddy {
  list {
EOF

while (<>) {
    chomp;
    my ($type, $args) = split ' ', $_, 2;
    next unless $type;

    if ($type eq 'g') {
        print "    }\n" if ($in_group);
        print qq(    "$args" {\n);
        $in_group = 1;
    } elsif ($type eq 'b') {
        my ($buddy, $alias) = split /:/, $args;
        print qq(      "$buddy"\n);
    }
}

print <<"EOF";
    }
  }
}
EOF