#!/usr/bin/perl -w use strict; # friends.pl addition: # This script tries to transpose old-style friendlist to # the new-style one. It's not perfect, you might have to tune # your new friendlist by hand, anyway :) (handles for example) # Invented by Erkki Seppälä # written down by Jakub Jankowski # GNU GPL2 code. # you should probably adjust those two my $oldfile = "$ENV{HOME}/.irssi/friends"; my $newfile = "$ENV{HOME}/.irssi/friends-NEW"; # And here we go :) if (-e $oldfile) { my $n = 0; local *I; local *O; open(I, "<$oldfile"); open(O, ">$newfile") or die "Couldn't open $newfile for writing"; print(O "# version = transpose.pl (20011222)\n"); print(O "# written = ".time()."\n"); while () { chomp; if (!/^#/) { ++$n; my @entry = split(/%/, $_); print(O "handle=f$n%hosts=$entry[0]%globflags=%chanflags=$entry[2],$entry[1],%password=$entry[3]%\n"); } } close(O); close(I); } else { print("Failure.\n"); }