🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #260511

40-tude Dialog script syntax question

#260511
From: Henry Jones
Date: Tue, 05 Jul 2016 10:44
63 lines
2585 bytes
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!

program OnBeforeSendingMessage;

const
// set the header you want to remove here, e.g. 'User-Agent'

// It always worked if I only put a single header here:
RemoveHeader='Date';   

// I could never get multiple headers to work! 
// RemoveHeader='User-Agent:,X-Scoring:,X-Hamster-Info:,Date:';
// RemoveHeader='Date:,Message-ID:,User-Agent:';


// remove header from emails and/or postings
// set 'true' or 'false'
// RemoveFromEmails=true;
   RemoveFromEmails=false;
   RemoveFromNews=true;

procedure RemoveAnyHeader(Message:TStringlist;IsEmail:boolean);
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);
  result:=true;
end;

begin
end.
Technical Details
Message-ID: <nlg32v$1q44$1@gioia.aioe.org>
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

Show Full Headers
Complete Article Headers
Message-ID: <nlg32v$1q44$1@gioia.aioe.org>
Subject: 40-tude Dialog script syntax question
Date: Tue, 05 Jul 2016 10:44:47 +0000
From: Henry Jones <henry@example.com>
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,alt.os.linux
Organization: Aioe.org NNTP Server
Lines: 64
NNTP-Posting-Host: S96GfeoHvLyFfLfM16efQg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
X-Notice: Filtered by postfilter v. 0.8.2
X-Received-Bytes: 2397
X-Received-Body-CRC: 4185739405