RfC 3676 defining format=flowed
===============================
-This RfC specifies quote chars to be '>' and due to space-stuffing lines
-there're no spaces withing the quote prefix of a line allowed.
-Currently, the implementation does:
+Muttng currently lacks correct dealing with quote prefixes in some
+cases, i.e. when converting from format=fixed to format=flowed. One
+problem is that $quote_regexp only specifies the complete quote sequence
+instead of just one level. Second, quoting characters seen in the wild
+like '|' or '#' are part of the default $quote_regexp but may also be
+used to mark certain things like writing about examples or the like in
+messages. Muttng does not do any guessing so that it's up to the user to
+ensure correct quoting.
-- Change all quote characters by force to '>'. This is plain wrong in
- some cases where a character from $quote_regexp (even with the default
- setting) may appear at the beginning of a line but actually doesn't
- represent a quoted line. For example, someone may quote parts of
- muttng configs with comments. However, _if_ this _is_ a quoted line
- using e.g. '#' as $indent_string, we need to change the '#' prefix to
- '>'.
-
-- Compress the complete quote, i.e. remove any spaces within the
- complete quote prefix of a line. This, too, is just plain wrong. For
- example, some people may have $indent_string set to '> ' and this gets
- quoted several times to something like '>> >>'. However this
- semanticly has a quote level of 3 as the second poster space-stuffed
- that line. IMHO it's more common that people use spaces in
- $indent_string (which the implementation removes right now) than
- people space-stuffing lines which start '>' to ' >' when composing new
- messages.
-
-- Altough the standard enforces space-stuffing as a MUST, muttng
- currently violates it. Space-stuffing is done once after initially
- editing the message. The routine only handles '^From ' and '^ ' cases,
- '^>' is ignored. (Once because an already space-stuffed line still has
- a leading space so that it would get space-stuffed everytime the user
- edits a message.)
+Altough the standard enforces space-stuffing as a MUST, muttng
+currently violates it. Space-stuffing is done _once_ after initially
+editing the message. The routine only handles '^From ' and '^ ' cases,
+'^>' is ignored. (Once because an already space-stuffed line still has
+a leading space so that it would get space-stuffed everytime the user
+edits a message.)
return (0);
}
-void rfc3676_quote_line (STATE* s, char* dst, size_t dstlen,
- const char* line) {
- char quote[SHORT_STRING];
- int offset = 0, i = 0, count = 0;
- regmatch_t pmatch[1];
-
- quote[0] = '\0';
-
- while (regexec ((regex_t *) QuoteRegexp.rx, &line[offset],
- 1, pmatch, 0) == 0)
- offset += pmatch->rm_eo;
-
- if (offset > 0) {
- /* first count number of real quoting characters;
- * read: non-spaces
- * this maybe just plain wrong, but leaving spaces
- * within quoting characters is what I consider
- * more plain wrong...
- */
- for (i = 0; i < offset; i++)
- if (line[i] != ' ')
- count++;
- /* just make sure we're inside quote althoug we
- * likely won't have more than SHORT_STRING quote levels... */
- i = (count > SHORT_STRING-1) ? SHORT_STRING-1 : count;
- memset (quote, '>', i);
- quote[i] = '\0';
- }
- debug_print (4, ("f=f: quotelevel = %d, new prefix = '%s'\n",
- i, NONULL (quote)));
- snprintf (dst, dstlen, "%s%s%s", NONULL (s->prefix), NONULL (quote),
- &line[offset]);
-}
-
void rfc3676_space_stuff (HEADER* hdr) {
#if DEBUG
int lc = 0;
/* body handler implementing RfC 3676 for format=flowed */
int rfc3676_handler (BODY * a, STATE * s);
-/*
- * this properly ensures correct quoting; correct is:
- * - no spaces within the complete quote prefix of line (sect. 4.5)
- * - change all quoting chars to '>' by force; see BUGS in srcdir
- */
-void rfc3676_quote_line (STATE* s, char* dst, size_t dstlen,
- const char* line);
-
/*
* this does the space-stuffing required as in 'MUST'
* this is only used right after editing the initial message's content