diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /libkpgp/kpgp-3.1-upgrade-address-data.pl | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkpgp/kpgp-3.1-upgrade-address-data.pl')
-rwxr-xr-x | libkpgp/kpgp-3.1-upgrade-address-data.pl | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/libkpgp/kpgp-3.1-upgrade-address-data.pl b/libkpgp/kpgp-3.1-upgrade-address-data.pl new file mode 100755 index 000000000..46c416178 --- /dev/null +++ b/libkpgp/kpgp-3.1-upgrade-address-data.pl @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +# Read all "AddressKeyEntry #" groups and the "EncryptionPreferences" group +# and store the information together in new "Address #" groups + +my %data; + +$currentGroup = ""; +$address = ""; + +while(<>) { + next if /^$/; + # filter out groups: + if( /^\[(.+)\]$/ ) { + $currentGroup = $1; + # delete the obsolete groups + if( ( $currentGroup =~ /^AddressKeyEntry \d*/ ) || + ( $currentGroup eq "EncryptionPreferences" ) ) { + print "# DELETEGROUP [$currentGroup]\n"; + } + next; + } + # store the values of the old groups and delete them + if( $currentGroup =~ /^AddressKeyEntry \d*/ ) { + if( /^Address=(.*)$/ ) { + $address = $1; + } + elsif( /^Key ID=(.*)$/ ) { + $data{$address}{"keyid"} = $1; + } + } + elsif( $currentGroup eq "EncryptionPreferences" ) { + ($address,$encrpref) = split /=/; + chomp $encrpref; + $data{$address}{"encrpref"} = $encrpref; + } +} + +# write the new address groups +$n = 1; +foreach $address ( keys %data ) { + %addressData = %{$data{$address}}; + print "[Address #$n]\n"; + print "Address=$address\n"; + if( exists $addressData{"encrpref"} ) { + $encrpref = $addressData{"encrpref"}; + print "EncryptionPreference=$encrpref\n"; + } + if( exists $addressData{"keyid"} ) { + $keyid = $addressData{"keyid"}; + print "Key IDs=$keyid\n"; + } + $n++; +} +$n--; + +# write the number of address groups +print "# DELETE [General]addressKeyEntries\n"; +print "# DELETE [General]addressEntries\n"; +print "[General]\naddressEntries=$n\n"; + |