Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Computers don't actually think. You just think they think. (We think.)


computers / news.software.readers / <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds

SubjectAuthor
* <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.dRudolph Rhein
`* Re: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeadeRudolph Rhein
 `- Re: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeadeBernd Rose

1
<dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds

<sn9rks$1t37$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=692&group=news.software.readers#692

  copy link   Newsgroups: news.software.readers
Path: i2pn2.org!i2pn.org!aioe.org!vWb851OrBd/H5BzoFvf5GQ.user.46.165.242.75.POSTED!not-for-mail
From: RudolphR...@nospam.net (Rudolph Rhein)
Newsgroups: news.software.readers
Subject: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds
Date: Sat, 20 Nov 2021 05:55:58 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sn9rks$1t37$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="62567"; posting-host="vWb851OrBd/H5BzoFvf5GQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.41 (Beta 38)
X-Notice: Filtered by postfilter v. 0.9.2
 by: Rudolph Rhein - Sat, 20 Nov 2021 03:55 UTC

Any updates to this RemoveHeaders.ds script you know of?
It removes inserted headers like AV headers for all groups.

program OnBeforeSendingMessage;
const
// ------------------------------------------------
// Configuration settings
// ------------------------------------------------
// Set the header(s) you want to remove here, e.g.,
// Remove_Headers = 'X-Scoring: ,X-Hamster-Info: ';
Remove_Headers = 'X-Antivirus:, X-Antivirus-Status: ';
// Remove header(s) from emails and/or postings
// Please set only to 'true' or 'false'
RemoveFromEmails = true;
RemoveFromNews = true;
// ------------------------------------------------
// -- End of configuration settings --------------- //
// -- No user maintainable parts below this line -- //
// ------------------------------------------------ //
procedure RemoveHeaders ( Message : TStringlist;
IsEmail : boolean
);
var i : integer;
k : integer;
s : string;
CommaPos : integer;
DelHeader : TStringlist;
RemoveH : String;
begin
RemoveH := Remove_Headers;
i := 0;
if ((IsEmail=true) and (RemoveFromEmails=true)) or
((IsEmail=false) and (RemoveFromNews=true)) then begin
If ( RemoveH <> '' ) then begin
try
DelHeader := TStringlist.Create;
if ansipos ( ',', RemoveH) = 0 then begin
DelHeader.Add ( LowerCase ( TrimLeft( RemoveH )));
end // if
else begin
CommaPos := 0;
for k := 1 to length ( RemoveH ) do begin
If RemoveH[k] = ',' then begin
DelHeader.Add ( LowerCase ( TrimLeft (copy ( RemoveH,
CommaPos + 1, k - ( CommaPos + 1 )))));
CommaPos := k;
end; // if
if k = length ( RemoveH ) then
DelHeader.Add ( LowerCase ( TrimLeft (copy ( RemoveH,
CommaPos + 1, k - CommaPos ))));
end; // for
end; // else
s:=Message.text;
while (Message.Strings[i]<>'') do begin
k := 0;
while k <= ( DelHeader.Count - 1 ) do begin
if pos( DelHeader[k], LowerCase ( Message.Strings[i] )) = 1
then begin
delete ( s, pos(DelHeader[k], LowerCase (s) ), length (
Message.Strings[i] ) + 2 );
i := i - 1;
k := DelHeader.Count - 1;
message.text := s;
end; // if
k := k + 1;
end; // while
i := i + 1;
end; //while
message.text:=s;
finally
DelHeader.Free;
end; // try - finally
end; // if
end; // if
end; // RemoveHeaders
function OnBeforeSendingMessage(var Message : TStringlist;
Servername : string;
IsEmail : boolean
):boolean;
begin
RemoveHeaders(Message,IsEmail);
result:=true;
end;
// ------------------------------------------------
begin
end.

Re: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds

<snbknp$pvm$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=693&group=news.software.readers#693

  copy link   Newsgroups: news.software.readers
Path: i2pn2.org!i2pn.org!aioe.org!vWb851OrBd/H5BzoFvf5GQ.user.46.165.242.75.POSTED!not-for-mail
From: RudolphR...@nospam.net (Rudolph Rhein)
Newsgroups: news.software.readers
Subject: Re: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds
Date: Sat, 20 Nov 2021 22:10:19 +0200
Organization: Aioe.org NNTP Server
Message-ID: <snbknp$pvm$1@gioia.aioe.org>
References: <sn9rks$1t37$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="26614"; posting-host="vWb851OrBd/H5BzoFvf5GQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.41 (Beta 38)
X-Notice: Filtered by postfilter v. 0.9.2
 by: Rudolph Rhein - Sat, 20 Nov 2021 20:10 UTC

Rudolph Rhein <RudolphRhein@nospam.net> wrote:
40tude Dialog pascal-based delphi scripts are hard to find.
I just found this on pastebin after a long set of searches.

It seems to be an update to RemoveHeaders.ds with more flexibility.
It allows you to separate work and personal messages for example.

// 40tude Dialog AddRemoveHeaders.ds
// Highly configurable Delphi script to add or remove headers
// Based on http://dialog.datalist.org/scripts/RemoveHeaders.html
// Located at http://dialog.datalist.org/scripts/script_library.html
// This script will add & remove headers based on a decision tree.
// It will also check for mistakes between business & personal use.
// 1. Set the "ForNewsgroup" Boolean as desired (search for "ForNewsgroup :")
// Generic default is: true
// 2. Set the "ForEmail" Boolean as desired (search for "ForEmail :")
// Generic default is: false
// 3. Change identity(ies) as desired (search for "from,")
// Generic defaults are set to: id##
// A sample value is: Kilroy <kilroy@example.com>
// 4. Change newsgroup(s) as desired (search for "newsgroup,")
// Generic defaults are set to: ng1, ng2, ng3, ng4, & ng5
// A sample value is: news.software.readers
// 5. Change server(s) as desired (search for "server,")
// Generic defaults are set to: server1, server2, server3, server4, server5
// A sample value is: aioe
// 6. Change header(s) to remove as desired (search for "Remove_Headers :")
// A sample value is: Remove_Headers := 'User-Agent: '
// 7. Change header(s) to add as desired (search for "Add_Headers :")
// 8. Modify the if-then-else program control as needed.
//
// If you don't set Remove_Header, then none will be removed.
// If you don't set Add_Header, then none will be added.
// For some headers you have to remove them first, then add them back.
// Dialog will error when sending if you add headers without (CR+LF) syntax!
// The original StrMatch fct is case sensitive & matches only the 1st item found!
// Instead, we define a StrContains fct to match multiple either/or newsgroups.
// CASE-SENSITIVITY:
// Headerfield names are case insensitive as per RFC 5322 & RFC 5234.
// MIME headerfields above the media types & transfer encodings are not
// case sensitive as per RFC 2045.
// In general, parameter names are case insensitive while the
// value of the parameter is case sensitive.
// The "charset" parameter defines an exception as per RFC 2046 so
// that the value of the charset parameter is case insensitive
// This means that both "US-ASCII" & "us-ascii" have the same meaning.
// The "charset" parameter is allowed to contain "quoted-string" values
// as per RFC 2045 where the value of a quoted string parameter does not
// include the quote delimiters.
// Therefore: charset="US-ASCII" is the same as charset=US-ASCII.
// Quote delimiters are used for values containing forbidden characters.
program OnBeforeSendingMessage;
(*
Format for Remove_Headers: {} = required, [] = optional
{HeaderName: }[,HeaderName: ][,HeaderName: ][...]
Examples:
- Single header: 'User-Agent: '
- Multiple headers: 'User-Agent: ,X-Face: '
*)
// The user is not expected to need to customize "RemoveHeaders()".
procedure RemoveHeaders(Message : TStringlist;
const Remove_Headers: String
);
var i : integer;
k : integer;
s : string;
CommaPos : integer;
DelHeader : TStringlist;
RemoveH : String;
begin
RemoveH := Remove_Headers;
i := 0;
If ( RemoveH <> '' ) then begin
try
DelHeader := TStringlist.Create;
if ansipos ( ',', RemoveH) = 0 then begin
DelHeader.Add ( LowerCase ( TrimLeft( RemoveH )));
end // if
else begin
CommaPos := 0;
for k := 1 to length ( RemoveH ) do begin
If RemoveH[k] = ',' then begin
DelHeader.Add ( LowerCase ( TrimLeft (copy ( RemoveH, CommaPos + 1, k - ( CommaPos + 1 )))));
CommaPos := k;
end; // if
if k = length ( RemoveH ) then
DelHeader.Add ( LowerCase ( TrimLeft (copy ( RemoveH, CommaPos + 1, k - CommaPos ))));
end; // for
end; // else
s:= Message.text;
while (Message.Strings[i]<>'') do begin
k := 0;
while k <= ( DelHeader.Count - 1 ) do begin
if pos( DelHeader[k], LowerCase ( Message.Strings[i] )) = 1 then
begin
delete ( s, pos(DelHeader[k], LowerCase (s) ), length (Message.Strings[i] ) + 2 );
i := i - 1;
k := DelHeader.Count - 1;
message.text := s;
end; // if
k := k + 1;
end; // while
i := i + 1;
end; //while
message.text:=s;
finally
DelHeader.Free;
end; // try - finally
end; // if
end; // RemoveHeaders
(*
Format for Add_Headers: {} = required, [] = optional
{HeaderName: HeaderValue{#13#10}}[HeaderName: HeaderValue{#13#10}][...]
Examples: (each header must end with CR+LF)
- Single header: 'User-Agent: '#13#10
- Multiple headers: 'User-Agent: MyNewsClient'#13#10'X-Comment: To be, or not to be'#13#10
*)
// The user is not expected to need to customize "AddHeaders()".
procedure AddHeaders(var Message : TStringlist;
const Add_Headers: String
);
var
SeparatorIndex: integer;
s: string;
begin
s:= Message.Text;
// writetolog('***before***'#13#10+s, 7);
SeparatorIndex:= pos(#13#10#13#10, s);
Insert(Add_Headers, s, SeparatorIndex+2);
Message.Text:= s;
// writetolog('***after***'#13#10+s, 7);
end;
// The user is not expected to need to customize "StrMatch()".
// WARNING: The StrMatch function can only check the first listed newsgroup!
// Define a StrContains function if you want to match either/or newsgroups!
// function StrContains(const Str: string; const Pattern: string): boolean;
// begin
// result:= pos(Pattern, Str) > 0;
// end;
// These will return `true`:
// StrMatch('abc', 'abc') //"abc" is at start of "abc"
// StrMatch('abc', 'ab') //"ab" is at start of "abc"
// StrMatch('abc', 'a') //"a" is at start of "abc"
// These will return `false`:
// StrMatch('abc', 'abcd') //"abcd" is not at start of "abc"
// StrMatch('abc', 'bc') //"bc" is not at start of "abc"
// StrMatch('abc', 'b') //"b" is not at start of "abc"
// StrMatch('abc', 'c') //"c" is not at start of "abc"
// EXAMPLE: This StrMatch will only match if either n.s.r or a.f.n is the *first* ng in the Newsgroups header:
// if (StrMatch (newsgroup, 'news.software.readers') or StrMatch(newsgroup, 'alt.free.newsservers')) then result := 'id01'
// If defined, this StrContains will match either newsgroup or both in the outgoing Newsgroup header:
// if StrContains(newsgroup, 'news.software.readers') or StrContains(newsgroup, 'alt.free.newssservers') then result := 'id01'
function StrMatch(str: String; pattern: String):Boolean;
var
patternSize : Integer;
subStr : String;
compareRes : Integer;
begin
patternSize := Length(pattern);
subStr := Copy(str, 1, patternSize);
compareRes := CompareStr(pattern, subStr);
if (compareRes = 0) then
result := true
else
result := false;
end;
////////////////////////////////////////////////////////////////////////////
// CAVEAT: You can't use % or ; in identity names.
// WARNING: With special characters (including a period) Dialog adds doublequotes automatically!
// For example, if your user name is John Doe, the search is for John Doe
// and if your user name is John A Doe, the search is for John A Doe
// But if you use a name of John A. Doe, the search is for "John A. Doe"
// WRONG: else if (StrMatch(from, 'John A. Doe <jad@is.invalid>')) then result := 'id01'
// RIGHT: else if (StrMatch(from, '"John A. Doe" <jad@is.invalid>')) then result := 'id01'
////////////////////////////////////////////////////////////////////////////
function From2Identity(from: String): String;
begin
if (StrMatch(from, '"John A. Doe" <jad@is.invalid>')) then result := 'id01'
else if (StrMatch(from, '"J.Doe" <j.doe@nospam.net>')) then result := 'id02'
else if (StrMatch(from, 'j doe <jdoe@jdoe.com>')) then result := 'id03'
else
result := '';
end;

// The user is not expected to need to customize "StrContains()".
function StrContains(const Str: string; const Pattern: string): boolean;
begin
result:= pos(Pattern, Str) > 0;
end;

Click here to read the complete article

Re: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds

<1olzy3gcjcf7a$.dlg@b.rose.tmpbox.news.arcor.de>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=694&group=news.software.readers#694

  copy link   Newsgroups: news.software.readers
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: b.rose.t...@arcor.de (Bernd Rose)
Newsgroups: news.software.readers
Subject: Re: <dialog> 40Tude Dialog program OnBeforeSendingMessage; procedure RemoveHeaders.ds
Date: Sun, 21 Nov 2021 08:33:42 +0100
Message-ID: <1olzy3gcjcf7a$.dlg@b.rose.tmpbox.news.arcor.de>
References: <sn9rks$1t37$1@gioia.aioe.org> <snbknp$pvm$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: solani.org;
logging-data="8876"; mail-complaints-to="abuse@news.solani.org"
User-Agent: 40tude_Dialog/2.0.15.41 (31f2c8ca.175.457)
Cancel-Lock: sha1:0YSj7xyJHX//uuJFAHXvmREbeZQ=
X-User-ID: eJwNw4kRwDAIA7CVIAHjjsNT9h+h1Z38QtFhcJivr8qxS8xVQZlhQhar8Oi2DFpWCuUPjNYREUdXpg1jWKzh7ZN8B5FPfZWqGX0=
 by: Bernd Rose - Sun, 21 Nov 2021 07:33 UTC

On Sat, 20th Nov 2021 22:10:19 +0200, Rudolph Rhein wrote:

> 40tude Dialog pascal-based delphi scripts are hard to find.

Depends on your search method. With starting point of the "Links" page
of the German FAQ for 40tude Dialog:

https://www.barghahn-online.de/4td_faq/links.php

you get direct access to the latest archived version of the former
central Dialog script website from datalist.org. This is usually the
best starting point of a search for a script and the source of the
first script you posted. Skimming through these scripts should also
give you a good idea for good search terms on general search engines.

The FAQ also links to two still active websites of script authors.
Please note, that some of these newer scripts don't work standalone,
but require include files with general functions. So, be sure to
carefully read all instructions.

If you use general search engines, use the Dialog-internal function
names appropriate to your search, like "OnBeforeSendingMessage" and
accompany them with general terms like "remove" to narrow the search
down. A list of all Dialog-internal functions provides the first
script linked from the "Skripte" page of the German Dialog FAQ:

https://www.barghahn-online.de/4td_faq/scripts/AlleBefehle.ds

You also can search Usenet archives. For Narkive you use a general
search engine with a term like:

OnBeforeSendingMessage remove site:narkive.com

Google Groups can still be searched in a group-specific way. Because
there are only 3 newsgroups likely to get you relevant hits (okay,
I omit some international groups, esp. from Poland and Italy, which
have been very active), the necessary searches can be narrowed down:

https://groups.google.com/g/news.software.readers/search?q=OnBeforeSendingMessage%20remove
https://groups.google.com/g/de.comm.software.40tude-dialog/search?q=OnBeforeSendingMessage%20remove
https://groups.google.com/g/de.comm.software.newsreader/search?q=OnBeforeSendingMessage%20remove

All of the above are likely to bring up only few hits, which moreover
will intersect each other a great deal.

---------

To answer your original question:
> Any updates to this RemoveHeaders.ds script you know of?

"Updates" is the wrong term. There are several (few) approaches, which
learned from each other and emphasize different aspects. If you are
not satisfied with one of them, try to combine or extend them. And if
you need help, ask here or in dcs4-d.

Bernd

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor