@@ -1117,31 +1117,29 @@ static int get_quotelevel (const char *line)
1117
1117
** headers), the previous line quotelevel, and a flag saying if the
1118
1118
** previous line was marked as a continuing one.
1119
1119
**
1120
- ** The function updates the quotelevel to
1121
- ** that of the current parsed line. The function will update the
1122
- ** continue_prev_flow_flag to say if the current line should be joined
1123
- ** to the previous one, and, if positive, the padding offset that
1124
- ** should be applied to the current line when merging it (for skipping
1125
- ** quotes or space-stuffing).
1120
+ ** The function updates the quotelevel to that of the current parsed
1121
+ ** line. The function will update the continue_prev_flow_flag to say
1122
+ ** if the current line should be joined to the previous one, and, if
1123
+ ** positive, the padding offset that should be applied to the current
1124
+ ** line when merging it (for skipping quotes or space-stuffing).
1126
1125
**
1127
- ** If delsp is true, the function will remove the space in the soft
1126
+ ** If delsp is true, the function will remove the space in the soft
1128
1127
** line break if the line is flowed.
1129
1128
**
1130
1129
** The function returns true if the current line is flowed.
1131
1130
**
1132
1131
*/
1133
1132
static bool rfc3676_handler (char * line , bool delsp_flag , int * quotelevel ,
1134
- bool * continue_prev_flow_flag , int * padding )
1133
+ bool * continue_prev_flow_flag )
1135
1134
{
1136
1135
int new_quotelevel = 0 ;
1137
- int space_stuffing = 0 ;
1138
1136
int tmp_padding = 0 ;
1139
1137
bool sig_sep = FALSE;
1140
1138
bool flowed = FALSE;
1141
1139
1142
1140
/* rules for evaluation if the flow should stop:
1143
1141
1. new quote level is different from previous one
1144
- 2. The line ends with a signature "[(quotes)][(ss)]-- \n"
1142
+ 2. The line is a signature "[(quotes)][(ss)]-- \n"
1145
1143
3. The line is a hard break "\n"
1146
1144
4. The message body has ended
1147
1145
@@ -1162,6 +1160,7 @@ static bool rfc3676_handler (char *line, bool delsp_flag, int *quotelevel,
1162
1160
1163
1161
special case, space-stuffed or f=f? A line that has only this content:
1164
1162
" \n": this is a space-stuffed newline.
1163
+ @@ test this special case with mutt
1165
1164
*/
1166
1165
1167
1166
@@ -1176,8 +1175,7 @@ static bool rfc3676_handler (char *line, bool delsp_flag, int *quotelevel,
1176
1175
if (rfc3676_ishardlb (line )) {
1177
1176
/* Hard crlf, reset flags */
1178
1177
* quotelevel = 0 ;
1179
- * padding = 0 ;
1180
- /* *continue_prev_flow_flag = FALSE; */
1178
+ * continue_prev_flow_flag = FALSE;
1181
1179
#if DEBUG_PARSE
1182
1180
printf ("RFC3676: hard CRLF detected. Stopping ff\n" );
1183
1181
#endif
@@ -1207,7 +1205,6 @@ static bool rfc3676_handler (char *line, bool delsp_flag, int *quotelevel,
1207
1205
** skip space stuffing if any
1208
1206
*/
1209
1207
if (line [tmp_padding ] == ' ' ) {
1210
- space_stuffing = 1 ;
1211
1208
tmp_padding ++ ;
1212
1209
#if DEBUG_PARSE
1213
1210
printf ("RFC3676: space-stuffing detected; skipping space\n" );
@@ -1221,13 +1218,12 @@ static bool rfc3676_handler (char *line, bool delsp_flag, int *quotelevel,
1221
1218
/* Hard crlf, reset flags */
1222
1219
/* *continue_prev_flow_flag = FALSE; */
1223
1220
* quotelevel = new_quotelevel ;
1224
- * padding = 0 ;
1225
1221
#if DEBUG_PARSE
1226
1222
printf ("RFC3676: hard CRLF detected after quote. Stopping ff\n" );
1227
1223
#endif
1228
1224
return FALSE;
1229
1225
}
1230
-
1226
+
1231
1227
/*
1232
1228
** signature detection
1233
1229
*/
@@ -1280,12 +1276,6 @@ static bool rfc3676_handler (char *line, bool delsp_flag, int *quotelevel,
1280
1276
*/
1281
1277
* quotelevel = new_quotelevel ;
1282
1278
1283
- if (* continue_prev_flow_flag ) {
1284
- * padding = new_quotelevel + space_stuffing ;
1285
- } else {
1286
- * padding = (new_quotelevel == 0 ) ? space_stuffing : 0 ;
1287
- }
1288
-
1289
1279
#if DEBUG_PARSE
1290
1280
if (* continue_prev_flow_flag )
1291
1281
printf ("RFC3676: Continuing previous flow\n" );
@@ -3063,23 +3053,27 @@ msgid);
3063
3053
}
3064
3054
}
3065
3055
else {
3066
- int padding ; /* used for skipping padding detected by rfc3676_handler,
3067
- which seems smarter than moving all the bytes in data
3068
- before injecting it into addbody */
3069
3056
if (!isinheader && (textplain_format == FORMAT_FLOWED )) {
3057
+ /* remove both space stuffing and quotes
3058
+ * where applicable for f=f */
3059
+ bodyflags |= BODY_DEL_SSQ ;
3070
3060
flowed_line = rfc3676_handler (data , delsp_flag , & quotelevel ,
3071
- & continue_previous_flow_flag ,
3072
- & padding );
3061
+ & continue_previous_flow_flag );
3073
3062
if (continue_previous_flow_flag ) {
3074
3063
bodyflags |= BODY_CONTINUE ;
3075
3064
} else {
3076
3065
bodyflags &= ~BODY_CONTINUE ;
3066
+ if (flowed_line ) {
3067
+ bodyflags |= BODY_FORMAT_FLOWED ;
3068
+ } else {
3069
+ bodyflags &= ~BODY_FORMAT_FLOWED ;
3070
+ }
3077
3071
}
3078
3072
continue_previous_flow_flag = flowed_line ;
3079
3073
} else {
3080
- padding = 0 ;
3074
+ bodyflags &= ~ BODY_DEL_SSQ ;
3081
3075
}
3082
- bp = addbody (bp , & lp , data + padding ,
3076
+ bp = addbody (bp , & lp , data ,
3083
3077
(content == CONTENT_HTML ?
3084
3078
BODY_HTMLIZED : 0 ) | bodyflags );
3085
3079
}
0 commit comments