From bf49fb6584bfd8c4cfae5bab4c5f46b155bcb5a7 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 9 Apr 2015 00:28:00 -0600 Subject: [PATCH] * When sending a message, allow for 512 characters of consecutive non-white space before folding the subject line. --- .gitignore | 1 + pith/pine.hlp | 3 +++ pith/send.c | 12 ++++++++++-- pith/string.c | 24 ++++++++++++++++++++++++ pith/string.h | 1 + po/Makefile.in | 14 +++++++------- 6 files changed, 46 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index e350115..e432f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ rem m4/* m4/Makefile.in +po/Makefile.in autom4te.*/* *mapi* Make* diff --git a/pith/pine.hlp b/pith/pine.hlp index 6815233..4f57b68 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -220,6 +220,9 @@ Additions include:
  • For a multipart/alternative message, the Take Address command will work on the part that is being read. + +
  • When sending a message, allow for 512 characters of consecutive non-white + space before folding the subject line. diff --git a/pith/send.c b/pith/send.c index 5495a80..c0337ae 100644 --- a/pith/send.c +++ b/pith/send.c @@ -2981,6 +2981,7 @@ pine_header_line(char *field, METAENV *header, char *text, soutr_t f, void *s, int writehdr, int localcopy) { int ret = 1; + int flags; int big = 10000; char *value, *folded = NULL, *cs; char *converted; @@ -3026,15 +3027,22 @@ pine_header_line(char *field, METAENV *header, char *text, soutr_t f, void *s, * We upped the references folding from 75 to 256 because we were * encountering longer-than-75 message ids, and to break one line * in references is to break them all. + * + * Also, some users are adding long text without spaces to the subject + * line (e.g. URLs) so we up that number too. For the moment this is + * going to 512 (a url that is about 6 lines long.) */ - if(field && !strucmp("Subject", field)) + flags = FLD_CRLF; + if(field && !strucmp("Subject", field)){ fold_by = 75; + flags |= FLD_NEXTSPC; + } else if(field && !strucmp("References", field)) fold_by = 256; else fold_by = big; - folded = fold(value, fold_by, big, actual_field, " ", FLD_CRLF); + folded = fold(value, fold_by, big, actual_field, " ", flags); if(actual_field) fs_give((void **)&actual_field); diff --git a/pith/string.c b/pith/string.c index b341356..c7ef310 100644 --- a/pith/string.c +++ b/pith/string.c @@ -1588,6 +1588,18 @@ fold(char *src, int width, int maxwidth, char *first_indent, char *indent, unsig } } + if(winner == -1 && (flags & FLD_NEXTSPC)){ + for(i = starting_point; winner == -1 && i <= strlen(next_piece) != '\0' && i < 512; i++){ + endptr = utf8_count_forw_width(next_piece, i, &got_width); + if(endptr && got_width == i && isspace((unsigned char) *endptr)) + winner = (int) i; + } + if(winner == -1){ + winner = got_width < 512 ? got_width : 512; + endptr = NULL; + } + } + if(winner == -1){ /* if no good folding spot, fold at width */ winner = starting_point; endptr = NULL; @@ -1652,6 +1664,18 @@ fold(char *src, int width, int maxwidth, char *first_indent, char *indent, unsig } } + if(winner == -1 && (flags & FLD_NEXTSPC)){ + for(i = starting_point; winner == -1 && i <= strlen(next_piece) && i < 512; i++){ + endptr = utf8_count_forw_width(next_piece, i, &got_width); + if(endptr && got_width == i && isspace((unsigned char) *endptr)) + winner = (int) i; + } + if(winner == -1){ + winner = got_width < 512 ? got_width : 512; + endptr = NULL; + } + } + if(winner == -1){ /* if no good folding spot, fold at width */ winner = starting_point; endptr = NULL; diff --git a/pith/string.h b/pith/string.h index dce84d5..5382484 100644 --- a/pith/string.h +++ b/pith/string.h @@ -40,6 +40,7 @@ #define FLD_NONE 0x00 #define FLD_CRLF 0x01 /* use CRLF end of line instead of LF */ #define FLD_PWS 0x02 /* preserve whitespace when folding */ +#define FLD_NEXTSPC 0x04 /* fold at next available space after given length */ typedef enum {FrontDots, MidDots, EndDots} WhereDots; diff --git a/po/Makefile.in b/po/Makefile.in index dec3b36..0ab3b49 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -34,12 +34,12 @@ INSTALL_DATA = ${INSTALL} -m 644 # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, -# ${SHELL} /run/media/echappa/Alpine/alpine/alpinegit/install-sh does not start with $(SHELL), so we add it. +# ${SHELL} /run/media/chappa/Alpine/alpine/alpinegit/install-sh does not start with $(SHELL), so we add it. # In automake >= 1.10, $(MKDIR_P) is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. -mkinstalldirs = $(SHELL) ${SHELL} /run/media/echappa/Alpine/alpine/alpinegit/install-sh -d -install_sh = $(SHELL) ${SHELL} /run/media/echappa/Alpine/alpine/alpinegit/install-sh +mkinstalldirs = $(SHELL) ${SHELL} /run/media/chappa/Alpine/alpine/alpinegit/install-sh -d +install_sh = $(SHELL) ${SHELL} /run/media/chappa/Alpine/alpine/alpinegit/install-sh MKDIR_P = /usr/bin/mkdir -p mkdir_p = $(MKDIR_P) @@ -51,12 +51,12 @@ MSGFMT_ = /usr/bin/msgfmt MSGFMT_no = /usr/bin/msgfmt MSGFMT_yes = /usr/bin/msgfmt MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) -XGETTEXT_ = /usr/bin/xgettext -XGETTEXT_no = /usr/bin/xgettext -XGETTEXT_yes = /usr/bin/xgettext +XGETTEXT_ = : +XGETTEXT_no = : +XGETTEXT_yes = : XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) MSGMERGE = msgmerge -MSGMERGE_UPDATE = /usr/bin/msgmerge --update +MSGMERGE_UPDATE = : --update MSGINIT = msginit MSGCONV = msgconv MSGFILTER = msgfilter -- 2.11.4.GIT