Article View: news.software.readers
Article #217232Re: [Dialog] I need two X-No-Archive Headers
From: MikeV06
Date: Sat, 23 Feb 2008 19:28
Date: Sat, 23 Feb 2008 19:28
290 lines
9210 bytes
9210 bytes
On Fri, 22 Feb 2008 20:34:56 GMT, Sqwertz wrote:
> See the script I just posted for an example.
>
> The OnBeforeSendingMessage() function will call two (or more)
> procedures and return True.
>
> Then again, my script doesn't work, so YMMV ;-)
Uhm, none of my calls are working?
Here is the program
program OnBeforeSendingMessage;
{$I Include_AddAnyHeader.ds}
{$I Insert_Boxquotes.ds}
function OnBeforeSendingMessage(
var Message : TStringlist;
const Servername : String;
const IsEmail : Boolean
) : Boolean;
begin
//
// if result is set to false, sending messages will *always* fail;
// use this for debugging along with the messagebox.
//
result := true;
//
// This calls the add XNA: banter procedure
AddAnyHeader ('X-No-Archive: banter', Message, IsEmail);
AddAnyHeader ('X-ScriptMadeBy: s de man', Message, IsEmail);
//
if Message.count < 500 then BoxQuote( Message );
end; // function OnBeforeSendingMessage()
BEGIN
end.
Here is one of the scripts being called
//
procedure AddAnyHeader(AddHeader:String; var Message:TStringlist;
IsEmail:Boolean);
var i: integer;
begin
If not IsEmail then begin
i := 1;
while Message[i] <> '' do
i := i+1;
Message.insert(i, AddHeader);
end;
end;
Here is the other (boxquotes use to work before this change ...)
//Program Insert_Boxquotes;
//script to automagically insert Boxquotes into a message before being sent
//you will not see the result inside the editor-window but only in the
transmitted article
//box: or box_o:
//Example
//-
//aslkdjl aksdj lkajsd lkjalsdkj lakj sadalksjd lkjasldkj lakjd
//-
const
//
// configure your settings here:
//
StartLine_close_box = 'box:';
StartLine_open_box = 'box_o:';
Separator = '-';
// --------------------------------------------------------------- //
// ---- No user maintainable parts below this line -------------- //
// --------------------------------------------------------------- //
MaxInt = 2147483647;
bq1a = ',';
bq1b = '-';
bq1c = '.';
bq2a = '|';
bq2c = '|';
bq3a = ''+#39+'';
bq3b = '-';
bq3c = ''+#39+'';
LineWidthTop = 4;
LineWidthBottom = 4;
s_no_bq = 0;
s_bq_title = 1;
s_bq_content = 2;
//
// program BoxQuote - Date: 2004/11/05
//
function StringReplaceM(
S : String;
OldPattern : String;
NewPattern : String;
replaceall : Boolean;
ignorecase : Boolean
) : String;
var
SearchStr : String;
Patt : String;
NewStr : String;
Offset : Integer;
begin
if IgnoreCase then begin
SearchStr := AnsiUpperCase( S );
Patt := AnsiUpperCase( OldPattern );
end
else begin
SearchStr := S;
Patt := OldPattern;
end;
NewStr := S;
Result := '';
while SearchStr <> '' do begin
Offset := AnsiPos(Patt, SearchStr);
if Offset = 0 then begin
result := result + NewStr;
break;
end;
result := result + Copy( NewStr, 1, Offset - 1 ) + NewPattern;
NewStr := Copy( NewStr, Offset + Length(OldPattern), MaxInt );
if not ReplaceAll then begin
Result := Result + NewStr;
break;
end;
SearchStr := Copy( SearchStr, Offset + Length(Patt), MaxInt );
end;
end; // function StringReplaceM()
function RepeatChar(
c : Char;
count : Integer
) : String;
var
i : Integer;
begin
if count < 0 then count := 0;
SetLength( result, count );
for i:=1 to count do result[i] := c;
end; // function RepeatChar()
function CountChars(
s : String;
c : Char
) : Integer;
var
i : Integer;
begin
result := 0;
for i := 1 to Length( s ) do if s[i] = c then result := result + 1;
end; // function CountChars()
procedure BoxQuote(
var Message : TStringlist
);
var
i, j, k : Integer;
state : Word;
bq_startline : Integer;
bq_title : String;
bq_content : String;
maxwidth : Integer;
sl : Tstringlist;
CloseBox : Boolean;
begin
state := s_no_bq;
i := 0;
bq_startline := -1;
while i <= message.count-1 do begin
case state of
s_no_bq: begin
if (message.strings[i] = StartLine_close_box)
or (message.strings[i] = StartLine_open_box)
then begin
if message.strings[i] = StartLine_close_box
then CloseBox := true
else CloseBox := false;
bq_startline := i;
bq_title := '';
bq_content := '';
maxwidth := 1;
state := s_bq_title;
end
end;
s_bq_title: begin
if message.strings[i] = Separator
then state := s_bq_content
else bq_title := trim( bq_title + ' ' + message.strings[i]
);
end;
s_bq_content: begin
if message.strings[i]=Separator then begin
state:=s_no_bq;
if Length( '[' + bq_title + ']' ) > maxwidth
then maxwidth := Length( '[' + bq_title + ']' ) + 6;
//
// delete the raw BoxQuote
//
for j := bq_startline to i do message.delete( bq_startline
);
//
// middle part
//
bq_content := stringreplacem( #13#10 + bq_content,
#13#10, #13#10 + bq2a + ' ',
true, false );
delete( bq_content, 1, 2 );
//
// first line
//
if bq_title <> ''
then bq_content := bq1a
+ RepeatChar( bq1b, LineWidthTop )
+ ' [' + bq_title + '] '
+ #13#10
+ bq_content
else bq_content := bq1a
+ RepeatChar( bq1b, LineWidthTop )
+ #13#10
+ bq_content;
//
// last line
//
bq_content := bq_content + #13#10 + bq3a + RepeatChar( bq3b,
LineWidthBottom );
sl := Tstringlist.create;
try
sl.text := bq_content;
//
// close the box
//
if CloseBox then begin
for j:=0 to sl.count-1 do begin
k := maxwidth - length( sl.strings[j] );
if j=0
then sl.strings[j] := sl.strings[j] +
repeatchar( bq1b,k + 3 ) + bq1c
else if j = sl.count-1
then sl.strings[j] := sl.strings[j] +
repeatchar( bq3b,k + 3 ) + bq3c
else sl.strings[j] := sl.strings[j] +
repeatchar(' ', k + 3) + bq2c;
end;
end;
message.insert( bq_startline, trim(sl.text) );
i := bq_startline;
finally
sl.free;
end;
end
else begin
if bq_content = ''
then bq_content := message.strings[i]
else bq_content := bq_content + #13#10 +
message.strings[i];
if Length( message.strings[i] ) > maxwidth
then maxwidth := length( message.strings[i] );
end;
end;
end; // case
i := i + 1;
end;
end; // procedure BoxQuote()
Argg..
Technical Details
Message-ID:
<1civm73yogp5u.dlg@mycomputer06.invalid>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!post01.iad01!news.suddenlink.net!not-for-mailReferences:
<40lhz7pt2tqo.dlg@sqwertz.com> <1td7qgn0qa5kx$.dlg@blackholespam.net> <1l5i97dcyjakx$.dlg@sqwertz.com> <1cfxfs0ud4v2i.dlg@blackholespam.net> <w197mn7o9vd6$.dlg@mycomputer06.invalid> <ik2eltzcplu6.dlg@sqwertz.com>Show Full Headers
Complete Article Headers
Message-ID: <1civm73yogp5u.dlg@mycomputer06.invalid> Subject: Re: [Dialog] I need two X-No-Archive Headers Date: Sat, 23 Feb 2008 13:28:27 -0600 From: MikeV06 <me@mycomputer06.invalid> References: <40lhz7pt2tqo.dlg@sqwertz.com> <1td7qgn0qa5kx$.dlg@blackholespam.net> <1l5i97dcyjakx$.dlg@sqwertz.com> <1cfxfs0ud4v2i.dlg@blackholespam.net> <w197mn7o9vd6$.dlg@mycomputer06.invalid> <ik2eltzcplu6.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.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!post01.iad01!news.suddenlink.net!not-for-mail Newsgroups: news.software.readers User-Agent: 40tude_Dialog/2.0.15.41 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Organization: None Archive: No X-No-Archive: Yes X-No-Archive: banter X-ScriptMadeBy: s de man Lines: 290 NNTP-Posting-Host: 74.194.81.60 X-Complaints-To: abuse@suddenlink.net