summaryrefslogtreecommitdiffstats
path: root/kmail/kmail-3.3-move-identities.pl
blob: 835cf4ffd81b04197f7e76d29eb574d24e346f61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl
# David Faure <[email protected]>
# License: GPL

$currentGroup = "";

while (<>) {
    next if /^$/;
    # recognize groups:
    if ( /^\[(.+)\]$/ ) { 
        $currentGroup = $1;
        if ( $currentGroup =~ /^Identity/ ) {
            print "# DELETEGROUP [$currentGroup]\n";
            print "[$currentGroup]\n";
        }
        next;
    };
    # Move over keys from the identity groups
    if ( $currentGroup =~ /^Identity/ ) {
        print;
    }
    # Move over the key for the default identity
    elsif ( $currentGroup eq 'General' ) {
	($key,$value) = split /=/;
	chomp $value;
        if ( $key eq 'Default Identity' ) {
            print "[$currentGroup]\n$key=$value\n";
            print "# DELETE [$currentGroup]$key\n";
        }
    }
}