DisplayAgentThreadsV2

From 40tude Dialog Wiki

Display Threads in Agent- and Xnews-Style

This is (I like to think) an enhanced version of Matija's Agent style script.

To make Dialog behave like Agent when displaying threads - Thread title displayed once, follow-ups with the authors name only and authors name displayed on the first message and blanks on all subsequent (this is the change from Matija's version).


To have an impression how it looks like, take a look at the screenshot below.

Display-agent-threads.png


Setup & Installation

You'll have to make the following changes in the header layout.

Header Layout changes:
Change Subject column to %subjectnamechange%
In Name (From) column change to %threadindent%%fromname%

Paste the script in Event scripts -> OnArticleListPaint, save, compile and run. The column numbers affected are in the const statement.


Warning

Please read the Painting script warning page before trying out this script.


program OnArticleListPaint;

// Version : 1.2
// Date    : 04/09/2004
//
// 1.2     Amended for 2.0.13.1 beta 36 

const
  n_subject_column=3;
  n_from_column=4;

// Is the line indented ?
// Indented lines start with a space
function IsIndented(PaintString:widestring) : boolean;
var
  c : widestring;
begin
  c := copy(PaintString, 1, 1)
  result := (c = ' ');
end;

// Subject column = %subjectnamechange%
// Strip (<from>) i.e subject (<from>)
// Will fail if subject has ' ('
function Subject(PaintString:widestring) : widestring;
var
  n:integer;
begin
//  if not IsIndented(PaintString) then 
  begin
    n:=pos(' (', PaintString);
    if n > 0 then result := copy(PaintString, 1, n)
             else result := PaintString;
  end;
end;

// From column = %threadindent%%fromname%
// Blank the column if it has a threadindent char at start
function From(PaintString:widestring) : widestring;
begin
  if IsIndented(PaintString) then result := ''
                             else result := PaintString;
end;

function OnArticleListPaint(PaintString:widestring;ColumnIndex:integer):widestring;
begin
  case ColumnIndex of
    n_subject_column : result := Subject(PaintString);
    n_from_column :    result := From(PaintString);
    else result := PaintString;
  end;
//  result := inttostr(ColumnIndex);
end;

begin
end.