Mercurial > pidgin
view gaim2blt.pl @ 4331:bbd7b12986a8
[gaim-migrate @ 4595]
Okay, a few new goodies in here!
HTTP redirect support! Sean wants to be able to drag-and-drop themes from
our new themes page, but they're hiding behind a script that redirects.
Rather than lose functionality in the script, I added redirects here. Works
like a charm.
Smarter memory reallocation! The buffer was being reallocated every byte.
That means 10,000,000 of data would cause 10,000,000 reallocations. Now
it starts off with a buffer of 4096 (for HTTP headers) or 8192 (for data)
and reads until it's full. When full, the buffer increases by half of the
previous size.
Content-Length support! The HTTP headers are scanned for a Content-Length
header. If found, it uses this for the buffer instead of 8192. This should
reduce the number of reallocations to 0.
Have fun draggening-and-droppening.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 18 Jan 2003 00:53: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