mhonarc-dev

Re: Determing Threads

2005-04-21 14:50:12
Earl,

I read you loud and clear on which app does the quoting.

The problem I am dealing with is that, very often, messages are quoted
and then requoted.  So, a text/plain MUA (using > quotes) will be
requoted in an html MUA.  The resultant message will be html, yet the
second MTA will not have flagged it as <blockquote>.  Am I wrong on
this?

Before I saw those filters, I began writing some code to handle this. 
It's not perfect (yet), and anyway, in keeping with the spirit of
Perl's virtues, it makes most sense to extarct the quote routing form
text/plain and run it on text/html anyway.  I'm just not sure how to
do this...

--ECC
For what it's worth, here is the recursive quoting code I wrote:
sub fix_quotes
{
    my $txt = shift;
    my @lines = split /^/m, $txt;
    my $quote_started = 0;
    my $found_quotes = 0;
    my $ret = '';
    for (my $i = 0; $i <= $#lines; $i++)
    {
        next if ($lines[$i] =~ /^\s*$/);
        if ($lines[$i] =~ /^\s*&gt;/i)
        {
            #if ($quote_started || $lines[$i + 1] =~ /^\s*&gt;/i)  # only if
2 in a row - removed, since there were many  1 liners
            {
                $lines[$i] =~ s/^\s*&gt;//i;
                if (!$quote_started)
                {
                    $quote_started = 1;
                    $found_quotes = 1;
                    $lines[$i] = '<blockquote>' . $lines[$i];
                }
            }
        } else {
            if ($quote_started)
            {
                $lines[$i] = '</blockquote>' . $lines[$i];
            }   
            $quote_started = 0;
        }
        $ret .= $lines[$i];    
    }
    
    return ($found_quotes ? bb_quotes($ret) : $ret);    # recurse
}

On 4/21/05, Earl Hood <earl(_at_)earlhood(_dot_)com> wrote:
On April 20, 2005 at 23:36, East Coast Coder wrote:

Earl - wow, didn't catch those - very nice.  If someone wanted to
apply those filters to html messages (that is, very often, even a
message coded in text/html will use >'s and not <blockquote>), what
path would you recommend?

Quoting is part of the message body itself, not something mhonarc
does.  What the text/plain filter does is detect if quoting is used,
and if so, can perform special highlighting of quoted text (similiar
to how modern MUAs operate).

Therefore, for HTML messages, any quoting will part of the message
body itself.  From my experience, HTML-aware MUAs already markup
quoted text, so mhonarc really has nothing to do.

To summarize, quoting is a function of the originating MUA and
not mhonarc.  For text/plain messages, mhonarc is able to provide
special rendering of text that is quoted.  For HTML messages, it is
up to the originating MUA to provide any quoted highlighted.

Note: If you want mhonarc to translate '>'s in HTML messages into
<blockquote>, then you need to write your own filter (see MIMEFILTERS).
Personally, I do not think it is worth the effort, but your needs
may differ.  You can use the m2h_text_html::filter as a template for
your own, or even better, create a wrapper filter to it.  See
<http://www.mhonarc.org/archive/cgi-bin/mesg.cgi?a=mhonarc-users&i=200309161616.h8GGGc008461%40gator.earlhood.com>
for more information about wrapper filters.

--ewh

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV



---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV

<Prev in Thread] Current Thread [Next in Thread>