🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #262863

Re: 40tude find & replace 4 characters before sending message!!!!!!

#262863
From: VanguardLH
Date: Mon, 10 Sep 2018 01:32
141 lines
5993 bytes
VanguardLH wrote:

> Doyun Jahng wrote:
> 
>> Response to VanguardLH <V@nguard.LH> 
>> 
>>> What if you deleted all allowed charsets except us-ascii?
>> 
>> Red herring. Many hours waste on 40tude charsets and order!
>> Would not ask if was easy!
> 
> Did you even try by deleting ALL allowed charset for your posts except
> us-ascii?  Doesn't look like it because you are still mentioning order
> (of the charsets).  There is no order when there is only one item.
> 
>> Search and replace is only solution to work! Best is script just
>> before sending.
> 
> Then you need to learn Delphi in which Dialog was written and upon which
> its scripts are based.  After writing the script, assign it to the
> OnBeforeSendingMessage event in Dialog.
> 
> Probably the one most experienced with Dialog's code and writing scripts
> is Bernd Rose.  Either wait for him to show up or start an new thread
> titled "Attention Bernd Rose - Need your help with scripting."
> 
>> Script would search & replace four character before sent!
> 
> There used to be examples of scripts at:
> 
> http://www.40tude.com/dialog/wiki/index.php/Script_Library
> 
> That could give clues on how to write scripts inside of Dialog.  Alas,
> there was no documentation from the author on the scope of global
> objects defined within the context of scripts or the vars used as
> arguments in the function declaration, so Dialog will often report
> errors in scripts.  However, that domain is long gone.
> 
> I have a script attached to Dialog's OnBeforeSavingMessage event which
> might provide a clue how to write one for the OnBeforeSendingMessage
> event.  Basically my script (which I got from an example in the old
> Dialog script library site) traverses through the lines of the body of a
> message to strip out the worthless PGP signatures.  You would modify the
> script to walk through each line and in each line then walk through
> character by character until the EOL.  You could use a compound 'if'
> statement looking for a set of characters that, if found, would get
> replaced with the character you wanted.  Delphi has the 'case' command
> that you could use instead of multiple ifs: you would walk through each
> character in a line looking for a match on a set of characters and, if
> found then uses the case command to determine what to do depending on
> which character was found.
> 
> Pascal (on which Delphi is based) has its ReplaceStr() function.  Maybe
> you could walk through each line in the message and pass that string to
> ReplaceStr() to replace all occurences of one character with another.
> You could have 4 ReplaceStr() commands, one for each Unicode character
> you are changing to the ASCII7 character.  Delphi apparently has a
> differently named function: stringreplace.  See:
> 
> http://www.delphibasics.co.uk/RTL.asp?Name=stringreplace
> 
> The following is what I use for the OnBeforeSavingMessage event.  Just
> use it for clues on how to walk through lines in the body of the
> message.
> 
> //Remove PGP signature from newsgroup messages
> 
> program OnBeforeSavingMessage;
> const pgp_sig_start='

Hmm, not sure why my post got truncated.  Here is the script that I use
(attached to a different event) to get rid of PGP signatures:

//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.
Technical Details
Message-ID: <vlqix6ao91mv$.dlg@v.nguard.lh>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
References: <pn1qed$28a6$1@adenine.netfront.net> <1537aq73i3hah.dlg@v.nguard.lh> <pn241i$bot$1@adenine.netfront.net> <1cnxz2t8qh6sh.dlg@v.nguard.lh>

Show Full Headers
Complete Article Headers
Message-ID: <vlqix6ao91mv$.dlg@v.nguard.lh>
Subject: Re: 40tude find & replace 4 characters before sending message!!!!!!
Date: Sun, 9 Sep 2018 20:32:50 -0500
From: VanguardLH <V@nguard.LH>
References: <pn1qed$28a6$1@adenine.netfront.net> <1537aq73i3hah.dlg@v.nguard.lh> <pn241i$bot$1@adenine.netfront.net> <1cnxz2t8qh6sh.dlg@v.nguard.lh>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
Newsgroups: news.software.readers
Organization: Usenet Elder
Lines: 141
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: individual.net XrqmYszfcOdGQjDS8stpGAk4y7yMV30WtoSs6zAxk40tCGIHDb
Keywords: VanguardLH VLH811
Cancel-Lock: sha1:53iJHwvFbhROMzkoXTKFx5ll8lk=
User-Agent: 40tude_Dialog/2.0.15.41
X-Received-Bytes: 5838
X-Received-Body-CRC: 669059421