]> granicus.if.org Git - neomutt/commitdiff
Gero Treuner's reply_quote patch.
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 1 Oct 1998 16:18:38 +0000 (16:18 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 1 Oct 1998 16:18:38 +0000 (16:18 +0000)
handler.c
lib.c
mutt.h

index 0875b6a2158a2e31e16ab9df82d30f69add8cad1..b6c48ca0e427647c6ed42f8ee33567ab93e966ef 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -89,8 +89,7 @@ void mutt_decode_xbit (STATE *s, BODY *b, int istext)
     else
       map = mutt_get_translation(charset, Charset);
 
-    if(s->prefix)
-      state_puts(s->prefix, s);
+    state_set_prefix(s);
     
     while ((c = fgetc(s->fpin)) != EOF && len--)
     {
@@ -108,6 +107,8 @@ void mutt_decode_xbit (STATE *s, BODY *b, int istext)
       state_maybe_utf8_putc(s, c, is_utf8, chs, map);
     }
     
+    state_reset_prefix(s);
+
     if(is_utf8)
       state_fput_utf8(s, '\0', chs);
     
@@ -145,7 +146,7 @@ void mutt_decode_quoted (STATE *s, BODY *b, int istext)
       map = mutt_get_translation(charset, Charset);
   }
   
-  if(s->prefix) state_puts(s->prefix, s);
+  state_set_prefix(s);
   
   while (len > 0)
   {
@@ -203,6 +204,8 @@ void mutt_decode_quoted (STATE *s, BODY *b, int istext)
       state_maybe_utf8_putc(s, ch, is_utf8, chs, map);
   }
   
+  state_reset_prefix(s);
+
   if(is_utf8)
     state_fput_utf8(s, '\0', chs);
 }
@@ -227,7 +230,7 @@ void mutt_decode_base64 (STATE *s, BODY *b, int istext)
   
   buf[4] = 0;
 
-  if (s->prefix && istext) state_puts (s->prefix, s);
+  if (istext) state_set_prefix(s);
 
   while (len > 0)
   {
@@ -282,6 +285,7 @@ void mutt_decode_base64 (STATE *s, BODY *b, int istext)
     else
       state_maybe_utf8_putc(s, ch, is_utf8, chs, map);
   }
+  state_reset_prefix(s);
 }
 
 /* ----------------------------------------------------------------------------
diff --git a/lib.c b/lib.c
index caa01fb74a99140ec0e1c3f31d6d61445fc45873..89c681d553730aa925e1645fa0b9a1547ba91c50 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -1221,7 +1221,15 @@ char *mutt_quote_filename(const char *f)
 
 void state_prefix_putc(char c, STATE *s)
 {
+  if (s->flags & M_PENDINGPREFIX)
+  {
+    state_reset_prefix(s);
+    if (s->prefix)
+      state_puts(s->prefix, s);
+  }
+
   state_putc(c, s);
-  if(c == '\n' && s->prefix)
-    state_puts(s->prefix, s);
+
+  if(c == '\n')
+    state_set_prefix(s);
 }
diff --git a/mutt.h b/mutt.h
index 505cf379709c2b5a7e0edfd9eff3429f101d8bf7..2cb513783e613f9d4c6984bdf493bb76b34c29d8 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -651,6 +651,10 @@ typedef struct
 
 
 
+#define M_PENDINGPREFIX (1<<2) /* prefix to write, but character must follow */
+
+#define state_set_prefix(s) ((s)->flags |= M_PENDINGPREFIX)
+#define state_reset_prefix(s) ((s)->flags &= ~M_PENDINGPREFIX)
 #define state_puts(x,y) fputs(x,(y)->fpout)
 #define state_putc(x,y) fputc(x,(y)->fpout)