X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=handler.c;h=a39bc0c9e5cc9f80e1c7edcbb6fde48d34fd17e5;hp=4ba746c82e43c04195b0fabe4f9794dbf73ee94a;hb=17c3e8818f544a89c845331886c322049c7d2fa6;hpb=841a368ddea400022328f35dd8c7a3eb6f543892 diff --git a/handler.c b/handler.c index 4ba746c..a39bc0c 100644 --- a/handler.c +++ b/handler.c @@ -19,6 +19,9 @@ #include #include "mutt.h" +#include "ascii.h" +#include "recvattach.h" +#include "handler.h" #include "mutt_curses.h" #include "rfc1524.h" #include "keymap.h" @@ -895,7 +898,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) int bytes = a->length; char buf[LONG_STRING]; char *curline = strdup (""); - char *t; + char *t = NULL; unsigned int curline_len = 1; unsigned int quotelevel = 0, newql = 0; int first_line = 1; @@ -906,8 +909,9 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) newql = get_quote_level (buf); - if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) { - *t = '\0'; + if (bytes == 0 || ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r')))) { + if (t) + *t = '\0'; if (str_len (curline) > 0 && curline[str_len (curline) - 1] == ' ' && newql == quotelevel && strcmp (curline + quotelevel, "-- ") != 0) { @@ -938,19 +942,6 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) quotelevel = newql; } } - else if (bytes == 0) { - /* in case there's no line end it's likely the last line - * so append to current (if any) */ - if (buf[newql] == ' ') - curline[str_len (curline) - 1] = '\0'; - curline = realloc (curline, curline_len + str_len (buf)); - if (curline_len == 1) - *curline = '\0'; - curline_len += str_len (buf); - str_ncat (curline, curline_len, buf + newql, - str_len (buf + newql)); - break; - } } if (curline) { print_flowed_line (curline, s, quotelevel);