view gaim2blt.pl @ 9071:2233d33b2285

[gaim-migrate @ 9847] This fixes the bug where other GtkTextTags (e.g. from gtkspell) would confuse us slightly and make us end and restart tags at seemingly random places. I.e. we would do like </b><b> for seemingly no good reason. This caused the double link bug on protocols where links didn't have descriptions. <a href="http://foo.bar">http://foo.bar</a> might be split into two links. On AIM that doesn't matter, but on Yahoo and MSN it does. I might have implemented this slightly differently, but I'm assuming that datallah tested this good and so I don't want to mess with it if it works. Oh yeah, did i mention datallah wrote this patch? Thanks! People might want to test this well and make sure we still generate good html. This is probably one of the most important functions in imhtml, with gtk_imhtml_insert_html_at_iter being the other one. The latter parses html and inserts it into a GtkTextBuffer, while the function this patch patches takes a GtkTextBuffer (or a piece of one) and turns it into html. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Wed, 26 May 2004 05:25:06 +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