<<< Date Index >>>     <<< Thread Index >>>

Re: [Mutt] #2014: mutt quote/dequote headers too many times



#2014: mutt quote/dequote headers too many times

Comment (by TAKAHASHI Tamotsu):

 {{{
 Okay, so this won't be fixed with an easy hack.
 This seems a matter of design, i.e.
 (1) when (the timing) to de/quote rfc822 addresses and
 (2) how to handle complicated rfc822 addresses.

 Let's see what these problems are and what we can do.

 ======================
 (1) Timing
 Mutt accepts addresses from two sources:
 key (to quote) and file (to dequote).

 (1-1) From a key typing,
 (a) an address can be quoted or unquoted.
 (b) It is then processed by editor,
 (c) and then by "compose" menu.
 (d) Sometimes it is postponed.
 (e) At last it is sent.

 There are two points to quote the address.
 (e) is not processed many times, but it's too late to see
 how the address will be modified actually.
 Somewhere between (a) and (d) is processed again and again.
 Considering edit_hdr, (c) is the best point IMHO.

 So we have to invent a way not to quote already-quoted
 addresses. This will be discussed in (2).

 (1-2) From a file or a remote mailbox,
 (a) an address should be a valid rfc822 address,
   but it can be double-quoted or only backslash-quoted.
 (b) It is parsed.
 (c) Then given to main (index) mode.
 (d) At last it is shown in a pager (builtin or external).

 In this case, (d) seems the best point to dequote,
 but I'm not sure. I haven't investigated in this area.
 Anyway, we have to make sure this won't ruin the (1-1) course.

 ======================
 (2) Quoting scheme
 Currently mutt has no way to send a message with a complicated
 address. So there's little compatibility problem.

 One big problem is how to avoid over-processing.
 How can we determine whether an address is quoted or not?
 I suggest that we decide with the first character.
 i.e. If the address begins with '"', it is already quoted.
 Mutt should just pass it through.

 So we can dequote an address at (1-2-b) and quote it again
 to declare it has already been quoted.

 ======================
 (3) Implementation
 Unfortunately, (1-1) and (1-2) share a lot of functions.
 So we will have to have a hackish flag or something.
 And it may have some hard-to-find side-effects.

 ======================

 I'm going to try the above idea, but it may take a while.
 Don't hesitate to make your own patch, everyone.

 Lastly, thanks for your testing, Vincent.
 }}}

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/2014#comment:>