#!/usr/bin/perl -w
use strict;

my $newfolder = shift;
my $statusfile= "/home/aehlig/conf/mutt-current-folder.txt";
my $oldfolder = `cat \Q$statusfile\E`; chomp($oldfolder);

$oldfolder or $oldfolder="INBOX";

$newfolder =~ s/^=//;
$newfolder =~ s/\///;

print "Mutt is switching from $oldfolder to $newfolder\n";

system "echo \Q$newfolder\E > \Q$statusfile\E";

fork() and exit;

system "maildirdiff-sync", $oldfolder;

