ScriptFup2Warning

From 40tude Dialog Wiki

A nice little event script (OnBeforeSendingMessage) made by Lars Biskupek which will add a automated Crosspost/Fup2-warning above the signature to outgoing messages.


Example
This is how it looks like, if you crosspost a article to de.comm.software.40tude-dialog and alabama.test, with set Fup2 de.comm.software.40tude-dialog.

X'Post: de.comm.software.40tude-dialog,alabama.test
F'up2 : de.comm.software.40tude-dialog
-- 
This is a signature.

program OnBeforeSendingMessage;

// ** Introduction for XPost/Fup2-Message
// ** change message as you want to
const
  MessageXPost = 'X'+#39+'Posted to:';
  MessageFup2  = 'F'+#39+'up2:';

// ** Begin of code
Procedure XPost_and_FUp2_Information (var Message: TStringlist;
Servername: string; IsEmail: boolean);
var
  FUP2,
  XPost,
  Header: boolean;
  i,
  SigLine: integer;
  s,
  Fup2Group,
  XPostGroups: string;
begin
  if IsEmail=true then exit;
  FUP2:=false;
  XPost:=false;
  Header:=true;
  SigLine:=0;
  for i:=0 to Message.count-1 do
    begin;
    s:= message.strings[i];
    if s='' then header:=false;
    if header=true then
      begin;
      if Pos('Followup-To:',s)>0 then
        begin;
        FUP2:=true;
        Fup2Group:=copy(s,13,length(s)-12);
//      WriteToLog(MessageFup2+Fup2Group,1);
        end;
      if Pos('Newsgroups:',s)>0 then
        if Pos(',',s)>0 then
          begin;
          XPost:=true;
          XPostGroups:=copy(s,12,length(s)-11);
//        WriteToLog(MessageXPost+XPostGroups,1);
          end;
      end
    else
      if s='-- ' then
        SigLine:=i;
//  WriteToLog('Analysierte Zeile: '+s,1);
    end;
  if FUP2=true then
    if Sigline=0 then
      Message.Add(MessageFup2+Fup2Group)
    else
      Message.Insert(Sigline,MessageFup2+Fup2Group);
  if XPost=true then
    if Sigline=0 then
      Message.Add(MessageXPost+XPostGroups)
    else
      Message.Insert(Sigline,MessageXPost+XPostGroups);
  if (FUP2=true) or (XPost=true) then
    if Sigline=0 then
      Message.Add('')
    else
      Message.Insert(SigLine,'');
end;

function OnBeforeSendingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean):boolean;
begin;
  result:=true;
  XPost_and_FUp2_Information (Message, Servername, IsEmail);
end;

begin
end.

J. Cifer