updated on Wed Jan 25 12:16:47 UTC 2012
[aur-mirror.git] / mutt-great-dane / patch-1.5.21.vvv.quote.2
blob7703684af401417d7a95f337ec3e2411f7e88e30
1 diff -udprP mutt-1.5.21.orig/handler.c mutt-1.5.21/handler.c
2 --- mutt-1.5.21.orig/handler.c  2009-08-25 22:08:52.000000000 +0300
3 +++ mutt-1.5.21/handler.c       2010-09-16 11:06:34.000000000 +0300
4 @@ -1504,7 +1504,31 @@ static int text_plain_handler (BODY *b, 
5         buf[--l] = 0;
6      }
7      if (s->prefix)
8 -      state_puts (s->prefix, s);
9 +    {
10 +      int i;
11 +      char qbuf[2 * LONG_STRING];
12 +      int j = 0, offset = 0;
13 +      regmatch_t pmatch[1];
15 +      while (regexec ((regex_t *) QuoteRegexp.rx, &buf[offset], 1, pmatch, 0) == 0)
16 +       offset += pmatch->rm_eo;
18 +      if (!option (OPTQUOTEEMPTY) && !*buf)
19 +       strcpy (qbuf, buf);
20 +      else if (option (OPTQUOTEQUOTED) && offset)
21 +      {
22 +       for (i = 0; i < offset; i++)
23 +         if (buf[i] != ' ')
24 +           j = i;
25 +       strncpy (qbuf, buf, j + 1);
26 +       strcpy (qbuf + j + 1, buf + j);
27 +      }
28 +      else
29 +       snprintf (qbuf, sizeof (qbuf), "%s%s", NONULL(s->prefix), buf);
31 +      state_puts (qbuf, s);
32 +    }
33 +    else
34      state_puts (buf, s);
35      state_putc ('\n', s);
36    }
37 @@ -1550,7 +1574,7 @@ int mutt_body_handler (BODY *b, STATE *s
38         */
39        if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
40         handler = crypt_pgp_application_pgp_handler;
41 -      else if (ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0)
42 +      else if (ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0 && !s->prefix)
43         handler = rfc3676_handler;
44        else
45         handler = text_plain_handler;
46 diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
47 --- mutt-1.5.21.orig/init.h     2010-09-15 18:39:31.000000000 +0300
48 +++ mutt-1.5.21/init.h  2010-09-16 11:06:34.000000000 +0300
49 @@ -2214,6 +2214,19 @@ struct option_t MuttVars[] = {
50    ** have no effect, and if it is set to \fIask-yes\fP or \fIask-no\fP, you are
51    ** prompted for confirmation when you try to quit.
52    */
53 +  { "quote_empty",     DT_BOOL, R_NONE, OPTQUOTEEMPTY, 1 },
54 +  /*
55 +  ** .pp
56 +  ** Controls whether or not empty lines will be quoted using
57 +  ** ``$indent_string''.
58 +  */
59 +  { "quote_quoted",    DT_BOOL, R_NONE, OPTQUOTEQUOTED, 0 },
60 +  /*
61 +  ** .pp
62 +  ** Controls how quoted lines will be quoted. If set, one quote
63 +  ** character will be added to the end of existing prefix.  Otherwise,
64 +  ** quoted lines will be prepended by ``$indent_string''.
65 +  */
66    { "quote_regexp",    DT_RX,   R_PAGER, UL &QuoteRegexp, UL "^([ \t]*[|>:}#])+" },
67    /*
68    ** .pp
69 diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
70 --- mutt-1.5.21.orig/mutt.h     2010-09-13 20:19:55.000000000 +0300
71 +++ mutt-1.5.21/mutt.h  2010-09-16 11:06:34.000000000 +0300
72 @@ -408,6 +408,8 @@ enum
73    OPTPRINTDECODE,
74    OPTPRINTSPLIT,
75    OPTPROMPTAFTER,
76 +  OPTQUOTEEMPTY,
77 +  OPTQUOTEQUOTED,
78    OPTREADONLY,
79    OPTREPLYSELF,
80    OPTRESOLVE,
81 diff -udprP mutt-1.5.21.orig/PATCHES mutt-1.5.21/PATCHES
82 --- mutt-1.5.21.orig/PATCHES    2008-03-19 22:07:06.000000000 +0200
83 +++ mutt-1.5.21/PATCHES 2010-09-16 11:06:34.000000000 +0300
84 @@ -0,0 +1 @@
85 +vvv.quote