Hello Chris,

On Wednesday, July 3, 2002 at 07:57 GMT +0100, a witness saw Chris
Weaven [CW] type:

CW> Sorry, I keep moving the goalposts. After your name, it put's
CW> [JA]. This is fine, but when I reply to someone who doesn't
CW> support initials, it still comes up in the [ ], but doesn't appear
CW> down the side of their quoted text. Surely if it's shows in one
CW> place, it should be in the other and vice versa?

Well, ok.  So let's try to piece this one together without me just
giving you the answer.  From your message[1], your QuotesInit QT is:

====[QT QuotesINIT]====
%QUOTESTYLE='%-
%IF:"%-
%SETPATTREGEXP=""(?im-s)^X-Mailer\:.*(Bat!|Becky|Gnus|slrn).*$""%-
%REGEXPBLINDMATCH=""%HEADERS""%-
%SUBPATT=""1"""<>"":"=%QINCLUDE=""Initials""":"None"'
====[End]====

And you're trying to modify the behaviour of this part of your
attribution line:
%OFROMFNAME %OFROMLNAME [%QINCLUDE='Initials'] wrote

Now, why don't you create a new QT called InitSelect or something to
do the smart processing of '[JA]'.  InitSelect is going to be based on
the QuotesInit QT since it obviously does make a decision based on the
recipients mailer.

So let's analyze QuotesInit and hopefully that will make it obvious
what you need to change.

There are five crucial parts to the construction used in QuotesInit.
1. %QUOTESTYLE
2. %IF
   a) Test Condition
   b) True Action
   c) False Action

The %QUOTESTYLE macro tells TB if you what type of prefix you want for
the quotes.  You can tell it to use a default value or you can force
TB to use your string.  Your options are listed fully in the help
file.  Suffice it to say that if you want to use your own string, you
must use the construction: %QUOTESTYLE='=<your string>'.  Of course
you can use any allowed delimiter, I've used single quotes for
convenience.

Given the requirements of %QUOTESTYLE, we need to generate the string
that we're going to pass to %QUOTESTYLE.  We use the fact that TB
supports nesting of macros.  What this means is that the argument of a
macro is essentially a mini-template.  We can treat this mini-template
just like any QT[2].  For the %QUOTESTYLE's template, we're only going
to use the %IF macro.

%IF has the construction:
%IF:"string1"<>"string2":"true template":"false template"
or more symbolically
%IF : condition : true : false

The condition in this case uses a trick.  We generate string1 from a
regular expression[3].  The regexp looks for one of the supported
mailers in the X-Mailer header.  If one of them is found, the regexp
returns the name of that mailer.  The condition we look for is that
string1 is not an empty string.  That is, we look for the case where
something is returned by the regexp.  Since the regexp only returns
something if one of the accepted mailers is identified, this gives us
our condition.

The true template is executed if the original sender's mailer is one
of these clients.  This template is simply the %QINCLUDE to generate
the initials[4].  The false template is execuated if the original
sender's mailer is not identified as one of these clients.  In the
QuotesInit QT, this is just a fixed string corresponding to one of the
default strings for the %QUOTESTYLE macro.  You could make this into
an empty string for your attribution line requirement.

I hope that gives you some clues on how to modify the above to do what
you need.  If not, plaese ask.

[1] <[EMAIL PROTECTED]">mid:[EMAIL PROTECTED]>
[2] There are a few exceptions, but I won't go into them here.
[3] I will not explain the regexp here at this time.  It is a lengthy
    topic itself.
[4] Hint: This is probably where you'd want to modify the string.

-- 
Thanks for writing,
 Januk Aggarwal

I was the next door kid's imaginary friend.


______________________________________________________
Archives   : http://tbtech.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to