use strict;
use Irssi 20011118.1727;
use Irssi::Irc;

use vars qw{$VERSION %IRSSI};
$VERSION = '20100208';
%IRSSI = (
          name        => 'fixwin',
          authors     => 'Tristan Horn',
          contact     => 'tristan+perl@ethereal.net',
          url         => 'http://tris.net/',
          license     => 'GPL',
          description => 'Merge all items into ~one window.',
         );

sub cmd_fixwin {
  for my $win (Irssi::windows) {
    for my $item ($win->items) {
      next unless ref $item;
      $win->command("window item move 3") unless $win->{refnum} < 4;
    }
    $win->command("window kill") unless $win->{refnum} < 4;
  }
}

Irssi::command_bind('fixwin', 'cmd_fixwin');
