ScriptNukePGP
From 40tude Dialog Wiki
This script removes PGP signatures when reading newsgroup posts. It is based on scripts by Matija and Marcus, with help from Jarrod. Thank you!
Updated 6 July 2005 to add changes by Miroslav Sabljic to better handle GnuPG sigs as well. Thank you!
Tested on v2.0.15.1. Paste the script into the OnBeforeSavingMessage event, compile and save.
//Remove PGP signature from newsgroup messages
program OnBeforeSavingMessage;
const pgp_headline='-----BEGIN PGP SIGNED';
const pgp_sig_start='-----BEGIN PGP SIGNATURE-----';
const pgp_sig_end='-----END PGP SIGNATURE-----';
const pgp_sig_fix='- -- ';
const maxint=2147483647;
procedure OnBeforeSavingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean);
var i,j:integer;
s:string;
begin
if isemail=true then exit;
for i:= 0 to message.count-1 do
begin
if pos(pgp_headline, message.strings[i]) > 0 then
begin
// delete the '...PGP SIGNED...' line
message.delete(i);
// delete the 'Hash: foo' line now at index "i".
message.delete(i-1);
// insert notice
// message.insert(i,'---PGP sig removed---');
end;
if pos(pgp_sig_fix, message.strings[i]) > 0 then
begin
// delete the broken signature delimiter '- -- ' and replace it with '-- '
message.delete(i);
message.insert(i,'-- ');
// exit the "i" loop
break;
end;
end;
//setup to delete pgp signature
s:=message.text;
//locate start of pgp signature
i:=pos(pgp_sig_start,s);
begin
//find length of pgp signature string
j := i + pos(pgp_sig_end,copy(s, i, maxint));
if j > i then
begin
//delete pgp signature string
delete(s, i, j-i + length(pgp_sig_end) +1);
message.text:=s;
end;
end;
end;
begin
end.
Gember - gember.breuk@gmail.com