Article View: news.software.readers
Article #260520Re: 40-tude Dialog script syntax question
From: Sqwertz
Date: Tue, 05 Jul 2016 18:06
Date: Tue, 05 Jul 2016 18:06
71 lines
3309 bytes
3309 bytes
> On 07/05/2016 05:44 AM, Henry Jones wrote:
>> What's the syntax to get 40tude dialog to remove more than 1 header?
>>
>> This setting removes the Date header generated by the newsreader:
>> RemoveHeader='Date';
>>
>> This setting removes the Message-ID header generated by the newsreader:
>> RemoveHeader='Message-ID';
>>
>> But I couldn't get both to work at the same time even though the script
>> implies that it handles multiple headers.
>>
>> If anyone here understands how to string *multiple* headers in a script,
>> please let me know what syntax you used!
>
> [Crosspost to alt.os.linux removed]
I can't see the original post since it was crossposted and sent
from a troll server. But if it's the script I'm thinking of, the
script is entitled "Remove any SINGLE header". In which case simply
call the script twice without using the const 'RemoveHeader'.
Hmm, doesn't look like the script was designed gracefully.
You would need to add a third argument - the header string - to the
function call. Here is my UNTESTED implementation. Note that I am
Not a object pascal/Delphi programmer. Changes are noted with '**'
at the beginning of the line - remove those before compilation.
Original script is at:
http://dialog.datalist.org/scripts/RemoveAnyHeader.html
program OnBeforeSendingMessage;
const
// DO NOT set the header you want to remove here, e.g. 'User-Agent'
**// RemoveHeader='User-Agent';
// remove header from emails and/or postings
// set 'true' or 'false'
RemoveFromEmails=true;
RemoveFromNews=true;
**procedure RemoveAnyHeader(Message:TStringlist;IsEmail:boolean;RemoveHeader:string);
var i:integer;
s:string;
begin
if ((IsEmail=true) and (RemoveFromEmails=true)) or
((IsEmail=false) and (RemoveFromNews=true)) then
begin
s:=Message.text;
while (Message.Strings[i]<>'') and (pos(RemoveHeader,Message.Strings[i])=0) do
begin
i:=i+1;
if pos(RemoveHeader,Message.Strings[i])<>0 then
begin
delete(s,pos(RemoveHeader,s),length(Message.Strings[i])+2);
end;
end;
message.text:=s;
end;
end;
function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
begin
** RemoveAnyHeader(Message,IsEmail,'Date');
** RemoveAnyHeader(Message,IsEmail,'Message-ID');
result:=true;
end;
begin
end.
Technical Details
Message-ID:
<sukvoafe0s6s$.dlg@sqwertz.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.(126883).mbox.7z!not-for-mailReferences:
<nlg32v$1q44$1@gioia.aioe.org> <nlg4ol$csb$1@n102.xanadu-bbs.net>Show Full Headers
Complete Article Headers
Message-ID: <sukvoafe0s6s$.dlg@sqwertz.com> Subject: Re: 40-tude Dialog script syntax question Date: Tue, 5 Jul 2016 13:06:44 -0500 From: Sqwertz <swertz@cluemail.compost> References: <nlg32v$1q44$1@gioia.aioe.org> <nlg4ol$csb$1@n102.xanadu-bbs.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail Newsgroups: news.software.readers User-Agent: MicroPlanet-Gravity/3.0.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Organization: Me, Myself, and Inc. X-no-archive: yes Lines: 71 X-Complaints-To: abuse@blocknews.net NNTP-Posting-Date: Tue, 05 Jul 2016 18:06:29 UTC X-Received-Bytes: 3090 X-Received-Body-CRC: 4083599033