From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- kmail/upgrade-signature.pl | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 kmail/upgrade-signature.pl (limited to 'kmail/upgrade-signature.pl') diff --git a/kmail/upgrade-signature.pl b/kmail/upgrade-signature.pl new file mode 100755 index 000000000..23c3d63b6 --- /dev/null +++ b/kmail/upgrade-signature.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl + +my (%data); +my $section = ""; + +sub process { + # delete obsolete keys: + print "# DELETE [$section]UseSignatureFile\n"; + + # now determine the type of signature: + if ( $data{'usefile'} =~ /false/i ) { + # type = inline + if ( $data{'inline'} ne "" ) { + print "[$section]\nSignature Type=inline\n"; + } else { + print "[$section]\nSignature Type=disabled\n"; + print "# DELETE [$section]Inline Signature\n"; + } + print "# DELETE [$section]Signature File\n"; + } else { + # type = file or command + if ( $data{'file'} =~ /\|$/ ) { + # a trailing pipe means: + # type = command + chop $data{'file'}; + print "[$section]\nSignature Type=command\n"; + print "[$section]\nSignature Command=", $data{'file'}, "\n"; + print "# DELETE [$section]Signature File\n"; + print "# DELETE [$section]Inline Signature\n"; + } elsif ( $data{'file'} eq "" ) { + # empty filename means: + # type = disabled + print "[$section]\nSignature Type=disabled\n"; + print "# DELETE [$section]Inline Signature\n"; + print "# DELETE [$section]Signature File\n"; + } else { + # type = file + print "[$section]\nSignature Type=file\n"; + print "# DELETE [$section]Inline Signature\n"; + } + } +} + +#loop over all lines to find Identity sections: +while (<>) { + if ( /\[(Identity[^]]*)\]/ ) { + # new group means that we have to process the old group: + if ( $section ne "" ) { process(); } + $section = $1; + %data = (); + next; + } + chomp; + # We need to prevent this script from begin run twice + # since it would set all signatures to 'disabled' then. + # Presence of the Signature Type key is the best indicator. + /^Signature Type/ and exit; + /^Inline Signature=(.*)$/ and $data{'inline'} = $1; + /^Signature File=(.*)$/ and $data{'file'} = $1; + /^UseSignatureFile=(.*)$/ and $data{'usefile'} = $1; +} +#and don't forget to preocess the last group ;-) +if ( $section ne "" ) { process(); } -- cgit v1.2.1