changeset: 6782:90c1b756d87d user: Kevin McCarthy <ke...@8t8.us> date: Mon Sep 05 12:22:58 2016 -0700 link: http://dev.mutt.org/hg/mutt/rev/90c1b756d87d
Autoconf: always check for getaddrinfo(). The getdnsdomainname() function introduced in 1.6.0 uses getaddrinfo(). Pull the dependency checks for libnsl, libsocket, and getaddrinfo() outside of the "need_socket" block, so they are always checked for. changeset: 6783:bb25613ce8a4 user: Kevin McCarthy <ke...@8t8.us> date: Mon Sep 05 12:35:19 2016 -0700 link: http://dev.mutt.org/hg/mutt/rev/bb25613ce8a4 Stub out getdnsdomainname() unless HAVE_GETADDRINFO. It seems unlikely there are systems without it (given that this mistake has been in since 1.6.0), but for correctness we should stub out the function for those without it. changeset: 6784:2b9689daf902 user: Kevin McCarthy <ke...@8t8.us> date: Mon Sep 05 12:44:15 2016 -0700 link: http://dev.mutt.org/hg/mutt/rev/2b9689daf902 merge stable diffs (507 lines): diff -r b082bcd5d5e2 -r 2b9689daf902 browser.c --- a/browser.c Sun Sep 04 18:50:28 2016 -0700 +++ b/browser.c Mon Sep 05 12:44:15 2016 -0700 @@ -176,11 +176,12 @@ tnow = time (NULL); t_fmt = tnow - folder->ff->mtime < 31536000 ? "%b %d %H:%M" : "%b %d %Y"; } - if (do_locales) - setlocale(LC_TIME, NONULL (Locale)); /* use environment if $locale is not set */ - else - setlocale(LC_TIME, "C"); - strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->mtime)); + + if (!do_locales) + setlocale (LC_TIME, "C"); + strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->mtime)); + if (!do_locales) + setlocale (LC_TIME, ""); mutt_format_s (dest, destlen, fmt, date); } diff -r b082bcd5d5e2 -r 2b9689daf902 configure.ac --- a/configure.ac Sun Sep 04 18:50:28 2016 -0700 +++ b/configure.ac Mon Sep 05 12:44:15 2016 -0700 @@ -588,6 +588,12 @@ dnl -- socket dependencies -- +dnl getaddrinfo is used by getdomain.c, and requires libnsl and +dnl libsocket on some platforms +AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) +AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) +AC_CHECK_FUNCS(getaddrinfo) + AC_ARG_ENABLE(pop, AS_HELP_STRING([--enable-pop],[Enable POP3 support]), [ if test x$enableval = xyes ; then AC_DEFINE(USE_POP,1,[ Define if you want support for the POP3 protocol. ]) @@ -631,9 +637,6 @@ AC_MSG_RESULT([no]) AC_DEFINE(socklen_t,int, [ Define to 'int' if <sys/socket.h> doesn't have it. ])) - AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) - AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) - AC_CHECK_FUNCS(getaddrinfo) AC_DEFINE(USE_SOCKET,1, [ Include code for socket support. Set automatically if you enable POP3 or IMAP ]) MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS account.o mutt_socket.o mutt_tunnel.o" diff -r b082bcd5d5e2 -r 2b9689daf902 crypt-gpgme.c --- a/crypt-gpgme.c Sun Sep 04 18:50:28 2016 -0700 +++ b/crypt-gpgme.c Mon Sep 05 12:44:15 2016 -0700 @@ -869,13 +869,11 @@ { char p[STRING]; - setlocale (LC_TIME, ""); #ifdef HAVE_LANGINFO_D_T_FMT strftime (p, sizeof (p), nl_langinfo (D_T_FMT), localtime (&t)); #else strftime (p, sizeof (p), "%c", localtime (&t)); #endif - setlocale (LC_TIME, "C"); state_attach_puts (p, s); } @@ -2815,9 +2813,6 @@ } *p = 0; - if (do_locales && Locale) - setlocale (LC_TIME, Locale); - { time_t tt = 0; @@ -2826,11 +2821,13 @@ tm = localtime (&tt); } - strftime (buf2, sizeof (buf2), dest, tm); - - if (do_locales) - setlocale (LC_TIME, "C"); - + + if (!do_locales) + setlocale (LC_TIME, "C"); + strftime (buf2, sizeof (buf2), dest, tm); + if (!do_locales) + setlocale (LC_TIME, ""); + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (dest, destlen, fmt, buf2); if (len > 0) @@ -3371,9 +3368,6 @@ int i; gpgme_user_id_t uid = NULL; - if (Locale) - setlocale (LC_TIME, Locale); - is_pgp = key->protocol == GPGME_PROTOCOL_OpenPGP; for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next) @@ -3613,9 +3607,6 @@ putc ('\n', fp); } } - - if (Locale) - setlocale (LC_TIME, "C"); } diff -r b082bcd5d5e2 -r 2b9689daf902 crypt.c --- a/crypt.c Sun Sep 04 18:50:28 2016 -0700 +++ b/crypt.c Mon Sep 05 12:44:15 2016 -0700 @@ -64,9 +64,7 @@ if (option (OPTCRYPTTIMESTAMP)) { t = time(NULL); - setlocale (LC_TIME, ""); strftime (p, sizeof (p), _(" (current time: %c)"), localtime (&t)); - setlocale (LC_TIME, "C"); } else *p = '\0'; diff -r b082bcd5d5e2 -r 2b9689daf902 doc/manual.xml.head --- a/doc/manual.xml.head Sun Sep 04 18:50:28 2016 -0700 +++ b/doc/manual.xml.head Mon Sep 05 12:44:15 2016 -0700 @@ -3624,8 +3624,8 @@ <para> Another typical use for this command is to change the values of the <link linkend="attribution">$attribution</link>, <link -linkend="signature">$signature</link> and <link -linkend="locale">$locale</link> variables in order to change the +linkend="attribution-locale">$attribution_locale</link>, and <link +linkend="signature">$signature</link> variables in order to change the language of the attributions and signatures based upon the recipients. </para> diff -r b082bcd5d5e2 -r 2b9689daf902 edit.c --- a/edit.c Sun Sep 04 18:50:28 2016 -0700 +++ b/edit.c Mon Sep 05 12:44:15 2016 -0700 @@ -29,6 +29,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <locale.h> #include <ctype.h> #include <sys/stat.h> #include <fcntl.h> @@ -160,7 +161,9 @@ /* add the attribution */ if (Attribution) { + setlocale (LC_TIME, NONULL (AttributionLocale)); mutt_make_string (tmp, sizeof (tmp) - 1, Attribution, Context, Context->hdrs[n]); + setlocale (LC_TIME, ""); strcat (tmp, "\n"); /* __STRCAT_CHECKED__ */ } diff -r b082bcd5d5e2 -r 2b9689daf902 getdomain.c --- a/getdomain.c Sun Sep 04 18:50:28 2016 -0700 +++ b/getdomain.c Mon Sep 05 12:44:15 2016 -0700 @@ -31,19 +31,21 @@ int getdnsdomainname (char *d, size_t len) { - /* A DNS name can actually be only 253 octets, string is 256 */ + int ret = -1; + +#ifdef HAVE_GETADDRINFO char *node; long node_len; struct addrinfo hints; struct addrinfo *h; char *p; - int ret; *d = '\0'; memset(&hints, 0, sizeof (struct addrinfo)); hints.ai_flags = AI_CANONNAME; hints.ai_family = AF_UNSPEC; + /* A DNS name can actually be only 253 octets, string is 256 */ if ((node_len = sysconf(_SC_HOST_NAME_MAX)) == -1) node_len = STRING; node = safe_malloc(node_len + 1); @@ -64,6 +66,8 @@ freeaddrinfo(h); } FREE (&node); +#endif + return ret; } diff -r b082bcd5d5e2 -r 2b9689daf902 globals.h --- a/globals.h Sun Sep 04 18:50:28 2016 -0700 +++ b/globals.h Mon Sep 05 12:44:15 2016 -0700 @@ -36,6 +36,7 @@ WHERE char *AssumedCharset; WHERE char *AttachSep; WHERE char *Attribution; +WHERE char *AttributionLocale; WHERE char *AttachCharset; WHERE char *AttachFormat; WHERE char *Charset; @@ -66,7 +67,6 @@ #endif WHERE char *Inbox; WHERE char *Ispell; -WHERE char *Locale; WHERE char *MailcapPath; WHERE char *Maildir; #if defined(USE_IMAP) || defined(USE_POP) diff -r b082bcd5d5e2 -r 2b9689daf902 hdrline.c --- a/hdrline.c Sun Sep 04 18:50:28 2016 -0700 +++ b/hdrline.c Mon Sep 05 12:44:15 2016 -0700 @@ -383,9 +383,6 @@ } *p = 0; - if (do_locales && Locale) - setlocale (LC_TIME, Locale); - if (op == '[' || op == 'D') tm = localtime (&hdr->date_sent); else if (op == '(') @@ -406,10 +403,11 @@ tm = gmtime (&T); } - strftime (buf2, sizeof (buf2), dest, tm); - - if (do_locales) - setlocale (LC_TIME, "C"); + if (!do_locales) + setlocale (LC_TIME, "C"); + strftime (buf2, sizeof (buf2), dest, tm); + if (!do_locales) + setlocale (LC_TIME, ""); mutt_format_s (dest, destlen, prefix, buf2); if (len > 0 && op != 'd' && op != 'D') /* Skip ending op */ diff -r b082bcd5d5e2 -r 2b9689daf902 init.h --- a/init.h Sun Sep 04 18:50:28 2016 -0700 +++ b/init.h Mon Sep 05 12:44:15 2016 -0700 @@ -266,6 +266,18 @@ ** in a reply. For a full listing of defined \fCprintf(3)\fP-like sequences see ** the section on $$index_format. */ + { "attribution_locale", DT_STR, R_NONE, UL &AttributionLocale, UL "" }, + /* + ** .pp + ** The locale used by \fCstrftime(3)\fP to format dates in the + ** $attribution string. Legal values are the strings your system + ** accepts for the locale environment variable \fC$$$LC_TIME\fP. + ** .pp + ** This variable is to allow the attribution date format to be + ** customized by recipient or folder using hooks. By default, Mutt + ** will use your locale environment, so there is no need to set + ** this except to override that default. + */ { "auto_tag", DT_BOOL, R_NONE, OPTAUTOTAG, 0 }, /* ** .pp @@ -599,8 +611,8 @@ ** function to process the date, see the man page for the proper syntax. ** .pp ** Unless the first character in the string is a bang (``!''), the month - ** and week day names are expanded according to the locale specified in - ** the variable $$locale. If the first character in the string is a + ** and week day names are expanded according to the locale. + ** If the first character in the string is a ** bang, the bang is discarded, and the month and week day names in the ** rest of the string are expanded in the \fIC\fP locale (that is in US ** English). @@ -1395,12 +1407,6 @@ ** from your spool mailbox to your $$mbox mailbox, or as a result of ** a ``$mbox-hook'' command. */ - { "locale", DT_STR, R_BOTH, UL &Locale, UL "C" }, - /* - ** .pp - ** The locale used by \fCstrftime(3)\fP to format dates. Legal values are - ** the strings your system accepts for the locale environment variable \fC$$$LC_TIME\fP. - */ { "mail_check", DT_NUM, R_NONE, UL &BuffyTimeout, 5 }, /* ** .pp diff -r b082bcd5d5e2 -r 2b9689daf902 main.c --- a/main.c Sun Sep 04 18:50:28 2016 -0700 +++ b/main.c Mon Sep 05 12:44:15 2016 -0700 @@ -597,15 +597,14 @@ exit(1); } + setlocale (LC_ALL, ""); + #ifdef ENABLE_NLS /* FIXME what about init.c:1439 ? */ - setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, MUTTLOCALEDIR); textdomain (PACKAGE); #endif - setlocale (LC_CTYPE, ""); - mutt_error = mutt_nocurses_error; mutt_message = mutt_nocurses_error; SRAND (time (NULL)); diff -r b082bcd5d5e2 -r 2b9689daf902 mbyte.c --- a/mbyte.c Sun Sep 04 18:50:28 2016 -0700 +++ b/mbyte.c Mon Sep 05 12:44:15 2016 -0700 @@ -530,6 +530,7 @@ if (wc == (wchar_t)0x200f || /* bidi markers: #3827 */ wc == (wchar_t)0x200e || wc == (wchar_t)0x00ad || /* soft hyphen: #3848 */ + wc == (wchar_t)0xfeff || /* zero width no-break space */ (wc >= (wchar_t)0x202a && /* misc directional markers: #3854 */ wc <= (wchar_t)0x202e)) return 1; diff -r b082bcd5d5e2 -r 2b9689daf902 mutt_ssl.c --- a/mutt_ssl.c Sun Sep 04 18:50:28 2016 -0700 +++ b/mutt_ssl.c Mon Sep 05 12:44:15 2016 -0700 @@ -1123,6 +1123,7 @@ } unset_option(OPTIGNOREMACROEVENTS); mutt_menuDestroy (&menu); + set_option (OPTNEEDREDRAW); dprint (2, (debugfile, "ssl interactive_check_cert: done=%d\n", done)); return (done == 2); } diff -r b082bcd5d5e2 -r 2b9689daf902 muttlib.c --- a/muttlib.c Sun Sep 04 18:50:28 2016 -0700 +++ b/muttlib.c Mon Sep 05 12:44:15 2016 -0700 @@ -311,6 +311,26 @@ } } +LIST *mutt_copy_list (LIST *p) +{ + LIST *t, *r=NULL, *l=NULL; + + for (; p; p = p->next) + { + t = (LIST *) safe_malloc (sizeof (LIST)); + t->data = safe_strdup (p->data); + t->next = NULL; + if (l) + { + r->next = t; + r = r->next; + } + else + l = r = t; + } + return (l); +} + HEADER *mutt_dup_header(HEADER *h) { HEADER *hnew; diff -r b082bcd5d5e2 -r 2b9689daf902 pgpkey.c --- a/pgpkey.c Sun Sep 04 18:50:28 2016 -0700 +++ b/pgpkey.c Mon Sep 05 12:44:15 2016 -0700 @@ -195,15 +195,14 @@ } *p = 0; - if (do_locales && Locale) - setlocale (LC_TIME, Locale); tm = localtime (&key->gen_time); - strftime (buf2, sizeof (buf2), dest, tm); - - if (do_locales) - setlocale (LC_TIME, "C"); + if (!do_locales) + setlocale (LC_TIME, "C"); + strftime (buf2, sizeof (buf2), dest, tm); + if (!do_locales) + setlocale (LC_TIME, ""); snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (dest, destlen, fmt, buf2); diff -r b082bcd5d5e2 -r 2b9689daf902 postpone.c --- a/postpone.c Sun Sep 04 18:50:28 2016 -0700 +++ b/postpone.c Mon Sep 05 12:44:15 2016 -0700 @@ -535,9 +535,17 @@ } - +/* args: + * fp If not NULL, file containing the template + * ctx If fp is NULL, the context containing the header with the template + * newhdr The template is read into this HEADER + * hdr The message to recall/resend + * resend Set if resending (as opposed to recalling a postponed msg). + * Resent messages enable header weeding, and also + * discard any existing Message-ID and Mail-Followup-To. + */ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, - short weed) + short resend) { MESSAGE *msg = NULL; char file[_POSIX_PATH_MAX]; @@ -560,15 +568,16 @@ fseeko (fp, hdr->offset, 0); newhdr->offset = hdr->offset; - newhdr->env = mutt_read_rfc822_header (fp, newhdr, 1, weed); + /* enable header weeding for resent messages */ + newhdr->env = mutt_read_rfc822_header (fp, newhdr, 1, resend); newhdr->content->length = hdr->content->length; mutt_parse_part (fp, newhdr->content); - /* If message_id is set, then we are resending a message and don't want - * message_id or mail_followup_to. Otherwise, we are resuming a - * postponed message, and want to keep the mail_followup_to. + /* If resending a message, don't keep message_id or mail_followup_to. + * Otherwise, we are resuming a postponed message, and want to keep those + * headers if they exist. */ - if (newhdr->env->message_id != NULL) + if (resend) { FREE (&newhdr->env->message_id); FREE (&newhdr->env->mail_followup_to); diff -r b082bcd5d5e2 -r 2b9689daf902 send.c --- a/send.c Sun Sep 04 18:50:28 2016 -0700 +++ b/send.c Mon Sep 05 12:44:15 2016 -0700 @@ -34,6 +34,7 @@ #include <ctype.h> #include <stdlib.h> +#include <locale.h> #include <unistd.h> #include <string.h> #include <errno.h> @@ -323,26 +324,6 @@ } } -LIST *mutt_copy_list (LIST *p) -{ - LIST *t, *r=NULL, *l=NULL; - - for (; p; p = p->next) - { - t = (LIST *) safe_malloc (sizeof (LIST)); - t->data = safe_strdup (p->data); - t->next = NULL; - if (l) - { - r->next = t; - r = r->next; - } - else - l = r = t; - } - return (l); -} - void mutt_forward_intro (FILE *fp, HEADER *cur) { char buffer[STRING]; @@ -401,7 +382,9 @@ char buffer[LONG_STRING]; if (Attribution) { + setlocale (LC_TIME, NONULL (AttributionLocale)); mutt_make_string (buffer, sizeof (buffer), Attribution, ctx, cur); + setlocale (LC_TIME, ""); fputs (buffer, out); fputc ('\n', out); } diff -r b082bcd5d5e2 -r 2b9689daf902 sort.h --- a/sort.h Sun Sep 04 18:50:28 2016 -0700 +++ b/sort.h Mon Sep 05 12:44:15 2016 -0700 @@ -36,9 +36,19 @@ #define SORT_FLAGGED 17 #define SORT_PATH 18 -/* dgc: Sort & SortAux are shorts, so I'm bumping these bitflags up from - * bits 4 & 5 to bits 8 & 9 to make room for more sort keys in the future. */ -#define SORT_MASK 0xff +/* Sort and sort_aux are shorts, and are a composite of a + * constant sort operation number and a set of compounded + * bitflags. + * + * Everything below SORT_MASK is a constant. There's room for + * SORT_MASK constant SORT_ values. + * + * Everything above is a bitflag. It's OK to move SORT_MASK + * down by powers of 2 if we need more, so long as we don't + * collide with the constants above. (Or we can just expand + * sort and sort_aux to uint32_t.) + */ +#define SORT_MASK ((1<<8) - 1) #define SORT_REVERSE (1<<8) #define SORT_LAST (1<<9)