🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #136248

Re: {[Dialog] Script writers?

#136248
From: matija
Date: Mon, 27 Oct 2003 13:14
70 lines
3721 bytes
Gember Breuk, completely geschtonkenflapped, wrote:
>>> One asks about a script to remove PGP sigs from displayed message, but
>>> my own try did not do it yet. 
>>      that shouldn't be too hard. post your code here and we'll see
>>      if we can do something about it.
> This script works some, but I don't know yet how to do a variable for
> different sizes at the bottom.

     i think you took a slightly wrong approach. i admit i don't
     have much PGP-signed posts in my database, but from the looks
     of one such post, i assume it follows this structure:


     -----BEGIN PGP SIGNED MESSAGE-----
     Hash: xxx
     
     (regular message)

     -----BEGIN PGP SIGNATURE-----
     Version: yyy
     
     dfkjhdfsiuerwyefijhdfslkjherreiwuwryeuierwyodfisue
     rewoiurwoweriufdfsljkdflkfsdkldfjdsdlkjfsd
     rwepoierweropiopei
     -----END PGP SIGNATURE-----


     so, try this:


     for i := 0 to message.count-1 do
     begin
       if pos(PGPHead, message.strings[i]) > 0 then
       begin
         // delete the '-----BEGIN PGP SIGNED MESSAGE-----' line
         message.delete(i);
         
         // delete the 'Hash: foo' line which is directly below
         // note: i'm guessing that the message will "shift up"
         // and the 'Hash: foo' line will now be at index "i".
         message.delete(i);
         
         // insert notification
         message.insert(i, '(PGP sig removed)');
         
         // exit the "i" loop, we're done with the header
         break;
       end;
     end;

     // get the location of the PGP signature
     for i := 0 to message.count-1 do
     begin
       // PGPFoot = '-----BEGIN PGP SIGNATURE-----'     
       if pos(PGPFoot, message.strings[i]) > 0 then sigStart := i;
       
       // PGPFootEnd = '-----END PGP SIGNATURE-----'
       if pos(PGPFootEnd, message.strings[i]) > 0 then sigEnd := i;     
     end;

     // don't do anything if the PGP signature is missing/invalid     
     if (sigStart <> 0) and (sigEnd <> 0) then
       // delete the PGP signature
       for n := sigStart to sigEnd do message.delete(n);


-- 
there is a cheer. the gnomes have learned a new way to say hooray.   [-shpongle]

address is scrambled - remove SPAMISEVIL to reply
Technical Details
Message-ID: <1xni3j10vlez5.dlg@shpongle.604>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!text1.nnrp.aus1!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.freenet.de!news.rwth-aachen.de!fu-berlin.de!CARNet.hr!not-for-mail
References: <12txmxtn5irmt.dlg@news.aosrr.com> <1deejdf59cdc1.dlg@shpongle.604> <5hqzswgsdayo.dlg@news.aosrr.com>

Show Full Headers
Complete Article Headers
Message-ID: <1xni3j10vlez5.dlg@shpongle.604>
Subject: Re: {[Dialog] Script writers?
Date: Mon, 27 Oct 2003 14:14:09 +0100
From: matija <mSkPrAnMic@jaIgSor.srEcVe.IhLr>
References: <12txmxtn5irmt.dlg@news.aosrr.com> <1deejdf59cdc1.dlg@shpongle.604> <5hqzswgsdayo.dlg@news.aosrr.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!text1.nnrp.aus1!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.freenet.de!news.rwth-aachen.de!fu-berlin.de!CARNet.hr!not-for-mail
Newsgroups: news.software.readers
Organization: 604
Lines: 70
NNTP-Posting-Host: cmung3258.cmu.carnet.hr
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: bagan.srce.hr 1067260448 3723 193.198.140.210 (27 Oct 2003 13:14:08
 GMT)
X-Complaints-To: abuse@carnet.hr
NNTP-Posting-Date: Mon, 27 Oct 2003 13:14:08 +0000 (UTC)
User-Agent: 40tude_Dialog/2.0.7.46hr (b244fc07.437.72)
X-Afraid-Of: spiders
X-Face: "wB!^cgWZ=;
 q%#:6lkzMWJ-O*>}<FSIu#HEqp5P2E#=mTGgQ-\^YM|Vt(j_|:*GI8?,7A9Z
 mkgCj|$f)nB@*>(B14sXotbL/"G.Z0u$]5\GcxnO4')%FUE\48H!!$rCLV.`
X-Mastered: the art of pizza making
X-Searching-For: GMT soundtrack (guy sigsworth)