]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-vvv.quote.patch
- fix format string warnings
[packages/mutt.git] / mutt-vvv.quote.patch
1 diff -udprP mutt-1.5.19.orig/globals.h mutt-1.5.19/globals.h
2 --- mutt-1.5.19.orig/globals.h  2009-01-04 01:27:10.000000000 +0200
3 +++ mutt-1.5.19/globals.h       2009-01-06 19:40:35.000000000 +0200
4 @@ -24,6 +24,8 @@ WHERE CONTEXT *Context;
5  WHERE char Errorbuf[STRING];
6  WHERE char AttachmentMarker[STRING];
7  
8 +WHERE char Quotebuf[SHORT_STRING];
9 +
10  #if defined(DL_STANDALONE) && defined(USE_DOTLOCK)
11  WHERE char *MuttDotlock;
12  #endif
13 diff -udprP mutt-1.5.19.orig/handler.c mutt-1.5.19/handler.c
14 --- mutt-1.5.19.orig/handler.c  2009-01-05 21:20:53.000000000 +0200
15 +++ mutt-1.5.19/handler.c       2009-01-06 19:40:35.000000000 +0200
16 @@ -90,6 +90,8 @@ static void mutt_convert_to_state(iconv_
17        if (ob != bufo)
18         state_prefix_put (bufo, ob - bufo, s);
19      }
20 +    if (Quotebuf[0] != '\0')
21 +      state_prefix_putc ('\n', s);
22      return;
23    }
24  
25 @@ -1473,6 +1475,8 @@ void mutt_decode_attachment (BODY *b, ST
26    int istext = mutt_is_text_part (b);
27    iconv_t cd = (iconv_t)(-1);
28  
29 +  Quotebuf[0] = '\0';
30 +
31    if (istext && s->flags & M_CHARCONV)
32    {
33      char *charset = mutt_get_parameter ("charset", b->parameter);
34 @@ -1542,7 +1546,7 @@ int mutt_body_handler (BODY *b, STATE *s
35         */
36        if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
37         handler = crypt_pgp_application_pgp_handler;
38 -      else if (ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0)
39 +      else if (ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0 && !s->prefix)
40         handler = rfc3676_handler;
41        else
42         plaintext = 1;
43 diff -udprP mutt-1.5.19.orig/init.h mutt-1.5.19/init.h
44 --- mutt-1.5.19.orig/init.h     2009-01-05 21:20:53.000000000 +0200
45 +++ mutt-1.5.19/init.h  2009-01-06 19:40:35.000000000 +0200
46 @@ -2451,6 +2451,19 @@ struct option_t MuttVars[] = {
47    ** have no effect, and if it is set to \fIask-yes\fP or \fIask-no\fP, you are
48    ** prompted for confirmation when you try to quit.
49    */
50 +  { "quote_empty",     DT_BOOL, R_NONE, OPTQUOTEEMPTY, 1 },
51 +  /*
52 +  ** .pp
53 +  ** Controls whether or not empty lines will be quoted using
54 +  ** ``$indent_string''.
55 +  */
56 +  { "quote_quoted",    DT_BOOL, R_NONE, OPTQUOTEQUOTED, 0 },
57 +  /*
58 +  ** .pp
59 +  ** Controls how quoted lines will be quoted. If set, one quote
60 +  ** character will be added to the end of existing prefix.  Otherwise,
61 +  ** quoted lines will be prepended by ``$indent_string''.
62 +  */
63    { "quote_regexp",    DT_RX,   R_PAGER, UL &QuoteRegexp, UL "^([ \t]*[|>:}#])+" },
64    /*
65    ** .pp
66 diff -udprP mutt-1.5.19.orig/mutt.h mutt-1.5.19/mutt.h
67 --- mutt-1.5.19.orig/mutt.h     2008-09-26 01:00:03.000000000 +0300
68 +++ mutt-1.5.19/mutt.h  2009-01-06 19:40:35.000000000 +0200
69 @@ -398,6 +398,8 @@ enum
70    OPTPRINTDECODE,
71    OPTPRINTSPLIT,
72    OPTPROMPTAFTER,
73 +  OPTQUOTEEMPTY,
74 +  OPTQUOTEQUOTED,
75    OPTREADONLY,
76    OPTREPLYSELF,
77    OPTRESOLVE,
78 diff -udprP mutt-1.5.19.orig/muttlib.c mutt-1.5.19/muttlib.c
79 --- mutt-1.5.19.orig/muttlib.c  2009-01-05 21:20:53.000000000 +0200
80 +++ mutt-1.5.19/muttlib.c       2009-01-06 19:40:35.000000000 +0200
81 @@ -1497,15 +1497,45 @@ void state_prefix_putc (char c, STATE *s
82  {
83    if (s->flags & M_PENDINGPREFIX)
84    {
85 -    state_reset_prefix (s);
86 -    if (s->prefix)
87 -      state_puts (s->prefix, s);
88 -  }
89 +    int i;
90  
91 -  state_putc (c, s);
92 +    i = strlen (Quotebuf);
93 +    Quotebuf[i++] = c;
94 +    Quotebuf[i] = '\0';
95 +    if (i == sizeof (Quotebuf) - 1 || c == '\n')
96 +    {
97 +      char buf[2 * SHORT_STRING];
98 +      int j = 0, offset = 0;
99 +      regmatch_t pmatch[1];
100 +
101 +      state_reset_prefix (s);
102 +      while (regexec ((regex_t *) QuoteRegexp.rx, &Quotebuf[offset], 1, pmatch, 0) == 0)
103 +       offset += pmatch->rm_eo;
104 +
105 +      if (!option (OPTQUOTEEMPTY) && Quotebuf[0] == '\n')
106 +       strcpy (buf, Quotebuf);
107 +      else if (option (OPTQUOTEQUOTED) && offset)
108 +      {
109 +       for (i = 0; i < offset; i++)
110 +         if (Quotebuf[i] != ' ')
111 +           j = i;
112 +       strncpy (buf, Quotebuf, j + 1);
113 +       strcpy (buf + j + 1, Quotebuf + j);
114 +      }
115 +      else
116 +       snprintf (buf, sizeof (buf), "%s%s", NONULL(s->prefix), Quotebuf);
117 +
118 +      state_puts (buf, s);
119 +    }
120 +  }
121 +  else
122 +    state_putc (c, s);
123  
124    if (c == '\n')
125 +  {
126      state_set_prefix (s);
127 +    Quotebuf[0] = '\0';
128 +  }
129  }
130  
131  int state_printf (STATE *s, const char *fmt, ...)
132 diff -udprP mutt-1.5.19.orig/PATCHES mutt-1.5.19/PATCHES
133 --- mutt-1.5.19.orig/PATCHES    2008-03-19 22:07:06.000000000 +0200
134 +++ mutt-1.5.19/PATCHES 2009-01-06 19:40:35.000000000 +0200
135 @@ -0,0 +1 @@
136 +vvv.quote
This page took 0.044052 seconds and 3 git commands to generate.