From: Thomas Roessler Date: Mon, 8 Jun 1998 09:17:25 +0000 (+0000) Subject: Mutt 0.92.9i. X-Git-Tag: mutt-0-92-9i X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57c930bf79e06c485142efeb62ffb1e9d8fe3d3b;p=mutt Mutt 0.92.9i. --- diff --git a/ChangeLog b/ChangeLog index 822fafc7..e5319475 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1707,3 +1707,41 @@ Changes since 0.92.6 alias group bob joe with no commas (mailx compatibility) +Changes since 0.92.7 +-------------------- + +- [patch-0.92.7.handler.empty_cc_bcc.1] fixed bug in edit_envelope() which + caused the message to be aborted if the cc or bcc field was empty + +- buffer used to store the error message in mutt_pattern_comp() called + sizeof() on the wrong variable + +- renamed $header_format to $index_format ($hdr_format is still accepted) + +- [patch-0.92.7.vikas.postpone.1] fixed typo for binding the `postpone' + menu, and changes the menu to use $index_format for display of postponed + messages + +- mutt_error() is now a function pointer which either has the value of + mutt_curses_error() or mutt_nocurses_error() which simplifies the muttrc + parsing code + +- "source '~/bin/myscript|'" was fixed so that it works correctly + +- [patch-0.92.7.me.mh_sync.1] fixed bug where syncing mh mailboxes silently + failed + +- [patch-0.92.7.me.pattern.1] fixes bug with mismatched backtics in the + pattern language + +- mutt_default_from() no longer sets the "real name" portion of the return + address so that it can be delayed until after execution of send-hook + commands + + +PGP-related changes since 0.92.6i +--------------------------------- + +- [patch-0.92.6i.tlr.pgp_longids.1] Correct the + calculation of 64 bit "v4" key IDs. + diff --git a/Changes b/Changes index 7b012d81..2b993307 100644 --- a/Changes +++ b/Changes @@ -1,38 +1,52 @@ -Changes since 0.92.7 +Changes since 0.92.8 -------------------- -- [patch-0.92.7.handler.empty_cc_bcc.1] fixed bug in edit_envelope() which - caused the message to be aborted if the cc or bcc field was empty +- [patch-0.90.12i.jmydaes.command-complete.1] Command completion -- buffer used to store the error message in mutt_pattern_comp() called - sizeof() on the wrong variable +- [patch-0.92.8.mtsirkin.attach-viewer.1] When viewing + attachments, fall back to the attachment's file name if + no description is available. -- renamed $header_format to $index_format ($hdr_format is still accepted) +- [patch-0.92.8i.ds.attachmsg.1] Attach messages from the compose menu. -- [patch-0.92.7.vikas.postpone.1] fixed typo for binding the `postpone' - menu, and changes the menu to use $index_format for display of postponed - messages +- [patch-0.92.8i.tlr.make_string_context.1] Fix a + segmentation fault when invoking mutt -p from the + command line. -- mutt_error() is now a function pointer which either has the value of - mutt_curses_error() or mutt_nocurses_error() which simplifies the muttrc - parsing code +- [patch-0.92.8i.tlr.mh_sequences.1] Don't generate + .mh_sequences files for maildir folders. -- "source '~/bin/myscript|'" was fixed so that it works correctly +- fix a NULL pointer deference in hdrline.c -- [patch-0.92.7.me.mh_sync.1] fixed bug where syncing mh mailboxes silently - failed +- [patch-0.92.8i.jmy.hook-bugfix.1] Fix a segmentation + fault in the send-hook code. -- [patch-0.92.7.me.pattern.1] fixes bug with mismatched backtics in the - pattern language +- [patch-0.92.8i.tlr.addrbook.1] Untag all aliases before + entering the address-book menu. -- mutt_default_from() no longer sets the "real name" portion of the return - address so that it can be delayed until after execution of send-hook - commands +- Enforce a non-NULL QueryCmd in the beginning of + mutt_query_complete() and mutt_query_menu(). +- Make all query.c functions except mutt_query_complete() + and mutt_query_menu() static. -PGP-related changes since 0.92.6i +- The latest IMAP patch from Andy Sloane has been added. + +PGP related Changes since 0.92.8i --------------------------------- -- [patch-0.92.6i.tlr.pgp_longids.1] Correct the - calculation of 64 bit "v4" key IDs. +- [patch-0.92.8i.maj.MIC_alg.1] Properly initializes a + variable in the PGP part of the Compose menu. + +- [patch-0.92.8i.tlr.pgpkey_dflt.1] Avoid possible + segmentation faults when determining the default value + of the PGP key selection prompt. + +- [patch-0.92.8i.wk.opgp_5bytelength.1] Recognize + OpenPGP's public key algorithm #20 (i.e., ElGamal for + Signing and Encrypting). + +- Moved doc/pgp-Notes.txt to doc/PGP-Notes.txt, and + updated that part of the documentation. + diff --git a/OPS b/OPS index 049e8922..4b6759bc 100644 --- a/OPS +++ b/OPS @@ -7,6 +7,7 @@ OP_BROWSER_NEW_FILE "select a new file in this directory" OP_CHANGE_DIRECTORY "change directories" OP_CHECK_NEW "check mailboxes for new mail" OP_COMPOSE_ATTACH_FILE "attach a file(s) to this message" +OP_COMPOSE_ATTACH_MESSAGE "attach a message(s) to this message" OP_COMPOSE_EDIT_BCC "edit the BCC list" OP_COMPOSE_EDIT_CC "edit the CC list" OP_COMPOSE_EDIT_DESCRIPTION "edit attachment description" diff --git a/README b/README index 0b566b07..90c2a969 100644 --- a/README +++ b/README @@ -5,13 +5,14 @@ Installation instructructions are detailed in ``INSTALL''. The user manual is in doc/manual.txt. -PGP users please read doc/pgp-Notes.txt before proceeding. +PGP users please read doc/PGP-Notes.txt before proceeding. For more information, see the Mutt home page, http://www.cs.hmc.edu/~me/mutt/index.html. The primary distribution point for Mutt is -ftp://ftp.cs.hmc.edu/pub/me/mutt. See the home page for mirror sites. +ftp://ftp.cs.hmc.edu/pub/me/mutt. See the home page for +mirror sites. Michael Elkins , January 22, 1998 Thomas Roessler , February 3, 1998 diff --git a/acconfig.h b/acconfig.h index acd02bb0..d7dd17cd 100644 --- a/acconfig.h +++ b/acconfig.h @@ -34,6 +34,9 @@ /* Do you want support for the POP3 protocol? (--enable-pop) */ #undef USE_POP +/* Do you want support for the IMAP protocol? (--enable-imap) */ +#undef USE_IMAP + /* * Is mail spooled to the user's home directory? If defined, MAILPATH should * be set to the filename of the spool mailbox relative the the home diff --git a/addrbook.c b/addrbook.c index 36038e09..e7b0732d 100644 --- a/addrbook.c +++ b/addrbook.c @@ -149,7 +149,10 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases) /* count the number of aliases */ for (aliasp = aliases; aliasp; aliasp = aliasp->next) + { + aliasp->tagged = 0; menu->max++; + } menu->data = AliasTable = (ALIAS **) safe_calloc (menu->max, sizeof (ALIAS *)); diff --git a/attach.c b/attach.c index 6ee4631e..4345d093 100644 --- a/attach.c +++ b/attach.c @@ -420,6 +420,9 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag) if (a->description) strfcpy (descrip, a->description, sizeof (descrip)); + else if (a->filename) + snprintf (descrip, sizeof (descrip), "---Attachment: %s : %s", + a->filename, type); else snprintf (descrip, sizeof (descrip), "---Attachment: %s", type); } diff --git a/commands.c b/commands.c index 4de052a3..da508df9 100644 --- a/commands.c +++ b/commands.c @@ -180,7 +180,7 @@ int mutt_display_message (HEADER *cur) builtin = 1; else { - mutt_make_string (buf, sizeof (buf), PagerFmt, cur); + mutt_make_string (buf, sizeof (buf), PagerFmt, Context, cur); fputs (buf, fpout); fputs ("\n\n", fpout); } @@ -475,7 +475,7 @@ void mutt_enter_command (void) int old_sortre = option (OPTSORTRE); buffer[0] = 0; - if (mutt_get_field (":", buffer, sizeof (buffer), 0) != 0 || !buffer[0]) + if (mutt_get_field (":", buffer, sizeof (buffer), M_COMMAND) != 0 || !buffer[0]) return; err.data = errbuf; err.dsize = sizeof (errbuf); diff --git a/compose.c b/compose.c index 494cd2c4..68cbf001 100644 --- a/compose.c +++ b/compose.c @@ -23,6 +23,7 @@ #include "mime.h" #include "attach.h" #include "mapping.h" +#include "mailbox.h" #include #include @@ -149,16 +150,20 @@ static int pgp_send_menu (int bits) mutt_error("This doesn't make sense if you don't want to sign the message."); else { + /* Copy the existing MIC algorithm into place */ + strfcpy(input_micalg, PgpSignMicalg, sizeof(input_micalg)); + if(mutt_get_field("MIC algorithm: ", input_micalg, sizeof(input_micalg), 0) == 0) { if(strcasecmp(input_micalg, "pgp-md5") && strcasecmp(input_micalg, "pgp-sha1") && strcasecmp(input_micalg, "pgp-rmd160")) { - mutt_error("Unknown MIC algorithm!"); - strfcpy(input_micalg, "x-unknown", sizeof(input_micalg)); + mutt_error("Unknown MIC algorithm, valid ones are: pgp-md5, pgp-sha1, pgp-rmd160"); + } + else { + safe_free((void **) &PgpSignMicalg); + PgpSignMicalg = safe_strdup(input_micalg); } - safe_free((void **) &PgpSignMicalg); - PgpSignMicalg = safe_strdup(input_micalg); } } } @@ -370,6 +375,61 @@ static int delete_attachment (MUTTMENU *menu, short *idxlen, int x) return (0); } +static struct mapping_t AttachMsgHelp[] = { + { "Exit", OP_EXIT }, + { "Help", OP_HELP }, + { "Attach Message", OP_GENERIC_SELECT_ENTRY }, + { NULL } +}; + + +static void attach_msg_make_entry (char *s, size_t l, MUTTMENU *menu, int num) +{ + CONTEXT *tmp = Context; + + Context = (CONTEXT *) menu->data; + index_make_entry (s, l, menu, num); + Context = tmp; +} + +static HEADER *select_msg (CONTEXT *ctx) +{ + MUTTMENU *menu; + int i, done=0, r=-1; + char helpstr[SHORT_STRING]; + char title[SHORT_STRING]; + + snprintf(title, sizeof (title), "Messages to attach from folder %s", + ctx->path); + + menu = mutt_new_menu (); + menu->make_entry = attach_msg_make_entry; + menu->menu = MENU_GENERIC; + menu->max = ctx->msgcount; + menu->title = title; + menu->data = ctx; + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_GENERIC, + AttachMsgHelp); + + while (!done) + { + switch (i = mutt_menuLoop (menu)) + { + case OP_GENERIC_SELECT_ENTRY: + r = menu->current; + done = 1; + break; + + case OP_EXIT: + done = 1; + break; + } + } + + mutt_menuDestroy (&menu); + return (r > -1 ? ctx->hdrs[ctx->v2r[r]] : NULL); +} + /* return values: * * 1 message should be postponed @@ -393,6 +453,8 @@ int mutt_send_menu (HEADER *msg, /* structure for new message */ int op = 0; int loop = 1; int fccSet = 0; /* has the user edited the Fcc: field ? */ + CONTEXT *ctx = NULL; + HEADER *hdr = NULL; idx = mutt_gen_attach_list (msg->content, idx, &idxlen, &idxmax, 0, 1); @@ -548,10 +610,31 @@ int mutt_send_menu (HEADER *msg, /* structure for new message */ case OP_COMPOSE_ATTACH_FILE: + case OP_COMPOSE_ATTACH_MESSAGE: + fname[0] = 0; - if (mutt_enter_fname ("Attach file", fname, sizeof (fname), - &menu->redraw, 0) == -1) - break; + { + char* prompt; + int flag; + + if (op == OP_COMPOSE_ATTACH_FILE) + { + prompt = "Attach file"; + flag = 0; + } + else + { + prompt = "Open mailbox to attach message from"; + flag = 1; + } + + if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, + flag) == -1) + { + break; + } + } + if (!fname[0]) continue; mutt_expand_path (fname, sizeof (fname)); @@ -563,6 +646,34 @@ int mutt_send_menu (HEADER *msg, /* structure for new message */ break; } + if (op == OP_COMPOSE_ATTACH_MESSAGE) + { + menu->redraw = REDRAW_FULL; + + ctx = mx_open_mailbox (fname, 0, NULL); + if (ctx == NULL) + { + mutt_perror (fname); + break; + } + + if (!ctx->msgcount) + { + mx_close_mailbox (ctx); + safe_free ((void **) &ctx); + mutt_error ("No messages in that folder."); + break; + } + + hdr = select_msg (ctx); + if (hdr == NULL) + { + mx_close_mailbox (ctx); + safe_free ((void **) &ctx); + break; + } + } + if (idxlen == idxmax) { safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5)); @@ -570,7 +681,13 @@ int mutt_send_menu (HEADER *msg, /* structure for new message */ } idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR)); - if ((idx[idxlen]->content = mutt_make_attach (fname)) != NULL) + + if (op == OP_COMPOSE_ATTACH_FILE) + idx[idxlen]->content = mutt_make_file_attach (fname); + else + idx[idxlen]->content = mutt_make_message_attach (ctx, hdr); + + if (idx[idxlen]->content != NULL) { idx[idxlen]->level = (idxlen > 0) ? idx[idxlen-1]->level : 0; @@ -580,11 +697,12 @@ int mutt_send_menu (HEADER *msg, /* structure for new message */ menu->current = idxlen++; mutt_update_tree (idx, idxlen); menu->max = idxlen; - menu->redraw |= REDRAW_INDEX | REDRAW_STATUS; + if (op == OP_COMPOSE_ATTACH_FILE) + menu->redraw |= REDRAW_INDEX | REDRAW_STATUS; } else { - mutt_error ("Unable to attach file!"); + mutt_error ("Unable to attach!"); safe_free ((void **) &idx[idxlen]); } break; @@ -752,7 +870,7 @@ int mutt_send_menu (HEADER *msg, /* structure for new message */ } fclose (fp); - if ((idx[idxlen]->content = mutt_make_attach (fname)) == NULL) + if ((idx[idxlen]->content = mutt_make_file_attach (fname)) == NULL) { mutt_error ("What we have here is a failure to make an attachment"); continue; diff --git a/config.h.in b/config.h.in index 8b888139..efc45ee9 100644 --- a/config.h.in +++ b/config.h.in @@ -46,6 +46,9 @@ /* Do you want support for the POP3 protocol? (--enable-pop) */ #undef USE_POP +/* Do you want support for the IMAP protocol? (--enable-imap) */ +#undef USE_IMAP + /* * Is mail spooled to the user's home directory? If defined, MAILPATH should * be set to the filename of the spool mailbox relative the the home diff --git a/configure b/configure index 4fd0e178..c5f1cece 100755 --- a/configure +++ b/configure @@ -29,6 +29,8 @@ ac_help="$ac_help --enable-hidden-host Only use the domain name for local addresses" ac_help="$ac_help --enable-pop Enable POP3 support" +ac_help="$ac_help + --enable-imap Enable IMAP support" ac_help="$ac_help --enable-flock Use flock() to lock files" ac_help="$ac_help @@ -553,11 +555,11 @@ fi -VERSION=0.92.8 +VERSION=0.92.9 SUBVERSION='' echo $ac_n "checking for prefix""... $ac_c" 1>&6 -echo "configure:561: checking for prefix" >&5 +echo "configure:563: checking for prefix" >&5 if test x$prefix = xNONE; then mutt_cv_prefix=$ac_default_prefix else @@ -568,7 +570,7 @@ echo "$ac_t""$mutt_cv_prefix" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:572: checking for $ac_word" >&5 +echo "configure:574: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -597,7 +599,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:601: checking for $ac_word" >&5 +echo "configure:603: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -645,7 +647,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:649: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:651: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -655,11 +657,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -679,12 +681,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:683: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:688: checking whether we are using GNU C" >&5 +echo "configure:690: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -693,7 +695,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -708,7 +710,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:712: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:714: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -736,7 +738,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:740: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:742: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -792,7 +794,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:796: checking for a BSD compatible install" >&5 +echo "configure:798: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -845,7 +847,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "sendmail", so it can be a program name with args. set dummy sendmail; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:849: checking for $ac_word" >&5 +echo "configure:851: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SENDMAIL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -886,7 +888,7 @@ if test -f $srcdir/pgp.c; then # Extract the first word of "pgpk", so it can be a program name with args. set dummy pgpk; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:890: checking for $ac_word" >&5 +echo "configure:892: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PGPK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -931,7 +933,7 @@ EOF # Extract the first word of "pgp", so it can be a program name with args. set dummy pgp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:935: checking for $ac_word" >&5 +echo "configure:937: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PGP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -995,7 +997,7 @@ EOF # Extract the first word of "ispell", so it can be a program name with args. set dummy ispell; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:999: checking for $ac_word" >&5 +echo "configure:1001: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ISPELL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1032,7 +1034,7 @@ EOF fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1036: checking how to run the C preprocessor" >&5 +echo "configure:1038: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1047,13 +1049,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1059: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1064,13 +1066,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1096,7 +1098,7 @@ echo "$ac_t""$CPP" 1>&6 if test "${with_slang+set}" = set; then withval="$with_slang" echo $ac_n "checking if -ltermlib is required""... $ac_c" 1>&6 -echo "configure:1100: checking if -ltermlib is required" >&5 +echo "configure:1102: checking if -ltermlib is required" >&5 if eval "test \"`echo '$''{'mutt_cv_bsdish'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1104,7 +1106,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -1117,7 +1119,7 @@ main () #endif } EOF -if { (eval echo configure:1121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then mutt_cv_bsdish=yes else @@ -1134,7 +1136,7 @@ fi echo "$ac_t""$mutt_cv_bsdish" 1>&6 echo $ac_n "checking for S-Lang""... $ac_c" 1>&6 -echo "configure:1138: checking for S-Lang" >&5 +echo "configure:1140: checking for S-Lang" >&5 if test $withval = yes; then if test -d $srcdir/../slang; then mutt_cv_slang=$srcdir/../slang/src @@ -1180,16 +1182,16 @@ EOF echo $ac_n "checking if I can compile a test SLang program""... $ac_c" 1>&6 -echo "configure:1184: checking if I can compile a test SLang program" >&5 +echo "configure:1186: checking if I can compile a test SLang program" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -1217,7 +1219,7 @@ fi echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 -echo "configure:1221: checking for initscr in -lncurses" >&5 +echo "configure:1223: checking for initscr in -lncurses" >&5 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1225,7 +1227,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1259,17 +1261,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1263: checking for $ac_hdr" >&5 +echo "configure:1265: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1310,12 +1312,12 @@ fi echo $ac_n "checking for start_color""... $ac_c" 1>&6 -echo "configure:1314: checking for start_color" >&5 +echo "configure:1316: checking for start_color" >&5 if eval "test \"`echo '$''{'ac_cv_func_start_color'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_start_color=yes" else @@ -1363,12 +1365,12 @@ fi for ac_func in typeahead bkgdset curs_set meta use_default_colors do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1367: checking for $ac_func" >&5 +echo "configure:1369: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1418,12 +1420,12 @@ done for ac_func in resizeterm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1422: checking for $ac_func" >&5 +echo "configure:1424: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1475,12 +1477,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1479: checking for ANSI C header files" >&5 +echo "configure:1481: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1488,7 +1490,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1505,7 +1507,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1523,7 +1525,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1544,7 +1546,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1555,7 +1557,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1583,17 +1585,17 @@ for ac_hdr in stdarg.h sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1587: checking for $ac_hdr" >&5 +echo "configure:1589: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1597: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1621,12 +1623,12 @@ done echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1625: checking return type of signal handlers" >&5 +echo "configure:1627: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1643,7 +1645,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1663,12 +1665,12 @@ EOF echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:1667: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:1669: checking for sys_siglist declaration in signal.h or unistd.h" >&5 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1680,7 +1682,7 @@ int main() { char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:1684: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -1702,7 +1704,7 @@ fi echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1706: checking size of long" >&5 +echo "configure:1708: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1710,7 +1712,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1721,7 +1723,7 @@ main() exit(0); } EOF -if { (eval echo configure:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1742,12 +1744,12 @@ EOF echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1746: checking for pid_t" >&5 +echo "configure:1748: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1778,12 +1780,12 @@ fi for ac_func in setegid srand48 strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1782: checking for $ac_func" >&5 +echo "configure:1784: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1834,12 +1836,12 @@ done for ac_func in strcasecmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1838: checking for $ac_func" >&5 +echo "configure:1840: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1891,12 +1893,12 @@ done mutt_cv_snprintf=no echo $ac_n "checking for snprintf""... $ac_c" 1>&6 -echo "configure:1895: checking for snprintf" >&5 +echo "configure:1897: checking for snprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_snprintf=yes" else @@ -1943,12 +1945,12 @@ mutt_cv_snprintf=yes fi echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 -echo "configure:1947: checking for vsnprintf" >&5 +echo "configure:1949: checking for vsnprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vsnprintf=yes" else @@ -2001,12 +2003,12 @@ fi for ac_func in ftruncate do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2005: checking for $ac_func" >&5 +echo "configure:2007: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2051,7 +2053,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for chsize in -lx""... $ac_c" 1>&6 -echo "configure:2055: checking for chsize in -lx" >&5 +echo "configure:2057: checking for chsize in -lx" >&5 ac_lib_var=`echo x'_'chsize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2059,7 +2061,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2104,12 +2106,12 @@ done for ac_func in strftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2108: checking for $ac_func" >&5 +echo "configure:2110: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2154,7 +2156,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:2158: checking for strftime in -lintl" >&5 +echo "configure:2160: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2162,7 +2164,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2226,12 +2228,12 @@ else for ac_func in regcomp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2230: checking for $ac_func" >&5 +echo "configure:2232: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2325,7 +2327,7 @@ if test "${with_mailpath+set}" = set; then mutt_cv_mailpath=$withval else echo $ac_n "checking where new mail is stored""... $ac_c" 1>&6 -echo "configure:2329: checking where new mail is stored" >&5 +echo "configure:2331: checking where new mail is stored" >&5 if eval "test \"`echo '$''{'mutt_cv_mailpath'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2354,7 +2356,7 @@ EOF echo $ac_n "checking if $mutt_cv_mailpath is world writable""... $ac_c" 1>&6 -echo "configure:2358: checking if $mutt_cv_mailpath is world writable" >&5 +echo "configure:2360: checking if $mutt_cv_mailpath is world writable" >&5 if eval "test \"`echo '$''{'mutt_cv_worldwrite'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2362,7 +2364,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include @@ -2376,7 +2378,7 @@ int main (int argc, char **argv) exit (1); } EOF -if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then mutt_cv_worldwrite=yes else @@ -2401,7 +2403,7 @@ EOF else echo $ac_n "checking if $mutt_cv_mailpath is group writable""... $ac_c" 1>&6 -echo "configure:2405: checking if $mutt_cv_mailpath is group writable" >&5 +echo "configure:2407: checking if $mutt_cv_mailpath is group writable" >&5 if eval "test \"`echo '$''{'mutt_cv_groupwrite'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2409,7 +2411,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include @@ -2423,7 +2425,7 @@ int main (int argc, char **argv) exit (1); } EOF -if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then mutt_cv_groupwrite=yes else @@ -2459,7 +2461,7 @@ if test "${with_sharedir+set}" = set; then mutt_cv_sharedir=$withval else echo $ac_n "checking where to put architecture-independent data files""... $ac_c" 1>&6 -echo "configure:2463: checking where to put architecture-independent data files" >&5 +echo "configure:2465: checking where to put architecture-independent data files" >&5 if eval "test \"`echo '$''{'mutt_cv_sharedir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2527,7 +2529,7 @@ if test "${enable_pop+set}" = set; then EOF echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:2531: checking for socket in -lsocket" >&5 +echo "configure:2533: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2535,7 +2537,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2574,7 +2576,7 @@ else fi echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2578: checking for gethostbyname in -lnsl" >&5 +echo "configure:2580: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2582,7 +2584,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2625,6 +2627,112 @@ fi fi +# Check whether --enable-imap or --disable-imap was given. +if test "${enable_imap+set}" = set; then + enableval="$enable_imap" + cat >> confdefs.h <<\EOF +#define USE_IMAP 1 +EOF + + echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 +echo "configure:2639: checking for socket in -lsocket" >&5 +ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:2686: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + LIBOBJS="$LIBOBJS imap.o" + +fi + + # Check whether --enable-flock or --disable-flock was given. if test "${enable_flock+set}" = set; then enableval="$enable_flock" diff --git a/configure.in b/configure.in index 2af4a27b..aa620bbc 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(mutt.h) AC_CONFIG_HEADER(config.h) -VERSION=0.92.8 +VERSION=0.92.9 SUBVERSION='' AC_MSG_CHECKING(for prefix) @@ -323,6 +323,13 @@ AC_ARG_ENABLE(pop, [ --enable-pop Enable POP3 support], LIBOBJS="$LIBOBJS pop.o" ]) +AC_ARG_ENABLE(imap, [ --enable-imap Enable IMAP support], +[ AC_DEFINE(USE_IMAP) + AC_CHECK_LIB(socket, socket) + AC_CHECK_LIB(nsl, gethostbyname) + LIBOBJS="$LIBOBJS imap.o" +]) + AC_ARG_ENABLE(flock, [ --enable-flock Use flock() to lock files], [if test $enableval = yes; then AC_DEFINE(USE_FLOCK) diff --git a/copy.c b/copy.c index c05e2eb2..9dcbe98c 100644 --- a/copy.c +++ b/copy.c @@ -367,7 +367,7 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, STATE s; if (flags & M_CM_PREFIX) - _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), hdr, 0); + _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context, hdr, 0); if ((flags & M_CM_NOHEADER) == 0) { @@ -579,7 +579,8 @@ static int copy_delete_attach(HEADER *h, HEADER *p, BODY *m, FILE *fpin, { if (h) h->lines = 0; - mutt_make_string (buf, sizeof (buf), NONULL (DeleteFmt), (p) ? p : h); + mutt_make_string (buf, sizeof (buf), NONULL (DeleteFmt), NULL, + (p) ? p : h); /* Go through deleted attachment headers, weed Content-Length, * Content-Type and Content-Transfer-Encoding diff --git a/curs_main.c b/curs_main.c index 7dbadcae..cf06bcf9 100644 --- a/curs_main.c +++ b/curs_main.c @@ -114,7 +114,7 @@ void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num) } } - _mutt_make_string (s, l, NONULL (HdrFmt), h, flag); + _mutt_make_string (s, l, NONULL (HdrFmt), Context, h, flag); } int index_color (int index_no) diff --git a/doc/pgp-Notes.txt b/doc/PGP-Notes.txt similarity index 57% rename from doc/pgp-Notes.txt rename to doc/PGP-Notes.txt index fc064f89..82be1b20 100644 --- a/doc/pgp-Notes.txt +++ b/doc/PGP-Notes.txt @@ -1,8 +1,11 @@ - Some notes on Mutt's PGP integration + + + + USING PGP FROM WITHIN MUTT + - 1997-12-04, tlr - - Last updated: 1998-03-11, tlr + Thomas Roessler + Fri Jun 5 12:28:52 CEST 1998 While encryption, verification and signing of messages are @@ -14,60 +17,83 @@ numerical key IDs for a message's recipients. These key IDs are then passed to the external PGP binary on the command line. +The current document contains a short description of the +PGP related configuration options mutt permits you to set, +and some frequently asked questions and tips with respect +to using Mutt with PGP. -Recent Changes --------------- - -$pgp_pubring, $pgp_language, $pgp_secring, and $pgp are gone. -They have been replaced by the following variables: - pgp_v2_language pgp_v5_language - pgp_v2_pubring pgp_v5_pubring - pgp_v2_secring pgp_v5_secring - pgp_v2 pgp_v5 +PGP settings +------------ -For all of these variables, we use "reasonable" defaults. -This includes a fix for the outstanding "pkr/skr" problem -for people using pgp 5. - -$pgp_version has been split up into a bunch of variables: +There are quite a few aspects of mutt's PGP usage you may +want to customize. First, you can use different versions +of PGP for composing and decrypting/verifying messages, +and for handling key ring stuff. These versions are +controlled by the following set of variables: pgp_default_version pgp_send_version pgp_receive_version pgp_key_version -The latter three may be set to the value "default" (which -is the default ;-); in this case, the value of -$pgp_default_version will be used instead. +Valid values for all of these variables include "pgp5" and +"pgp2". + +The last three variables may be set to "default" (which is +the default); in this case, the value of +$pgp_default_version will be used. + + +$pgp_send_version controls the version of pgp used for +composing new messages. $pgp_receive_version is used for +decrypting messages and verifying signatures. +$pgp_key_version is the one which is used for key ring +operations (importing keys from messages, exporting keys +from your public key ring). + +Since the different PGP versions may use different key +rings and need different language settings, the following +variables can be used to configure these aspects: -$pgp_send_version is the version of pgp used for composing -new messages. $pgp_receive version is used for decrypting -messages and verifying signatures. $pgp_key_version is the -one which is used for key ring operations (extracting keys -from messages, extracting keys from your public key ring). + - Language settings: + $pgp_v2_language, $pgp_v5_language -Valid values for _all_ variables include "pgp5", "pgp3", -"pgp2"; "pgp3" and "pgp5" are equivalent. "g10" has been -removed for now: The program has changed it's name to -GNUPG; Support for that program will be included soon. -Support will be added as soon as the current state of the -code turns out to be stable. + - Public key ring: + $pgp_v2_pubring, $pgp_v5_pubring + - Secret key ring: + $pgp_v2_secring, $pgp_v5_secring + + - PGP itself: + $pgp_v2, $pgp_v5 + + Note that PGP 5 comes in several binaries (pgps, pgpk, + pgpv, pgp). Mutt assumes that these binaries reside + in the same directory; $pgp_v5 should point to the + "pgp" binary from PGP 5. + +For all of these variables, we use "reasonable" defaults +which should work for most users. + +Support for the GNU Privacy Guard (GPG) is currently +worked on. + + +The value of the variable $pgp_sign_micalg will show up in +the "micalg" parameter of MIME headers when creating RFC +2015 signatures. -A new variable named $pgp_sign_micalg has been introduced. -It contains the default message integrity check algorithm. Valid values are "pgp-md5", "pgp-sha1", and "pgp-rmd160". + If you select a signing key using the "sign as" option on the compose menu, mutt will automagically figure out the -correct value to insert here, but it does not know about -the user's default key. +correct value to put into this variable, but it does not +know about the user's default key. -So if you are using an RSA key for signing, set this -variable to "pgp-md5", if you use a PGP 5 DSS key for -signing, say "pgp-sha1" here. The value of this variable -will show up in the "micalg" parameter of MIME headers -when creating RFC 2015 signatures. +So if you are (by default) using an RSA key for signing, +set this variable to "pgp-md5", if you use a PGP 5 DSS key +for signing, say "pgp-sha1". @@ -135,7 +161,7 @@ No. Application/pgp is not really suited to a world with MIME, non-textual body parts and similar things. Anyway, if you really want to generate these old-style attachments, include the following macro in your ~/.muttrc -(line breaks for readibility, this is actually one line): +(line breaks for readability, this is actually one line): macro compose S "Fpgp +verbose=0 -fast +clearsig=on\ny^T^Uapplication/pgp; format=text; @@ -159,4 +185,3 @@ $PGPPATH and add the following line to your muttrc: For PGP 2.6, a German version called "muttde" is available as well. - diff --git a/doc/manual.sgml b/doc/manual.sgml index ef54e694..a86f2260 100644 --- a/doc/manual.sgml +++ b/doc/manual.sgml @@ -537,7 +537,7 @@ name="commands">. Each line of the file may contain one or more commands. When multiple commands are used, they must be separated by a semicolon (;). set realname='Mutt user' ; ignore x- - + The hash mark, or pound sign (``#''), is used as a ``comment'' character. You can use it to annotate your initialization file. All text after the comment character diff --git a/edit.c b/edit.c index 3f02f0bf..6d310d6f 100644 --- a/edit.c +++ b/edit.c @@ -151,7 +151,7 @@ be_include_messages (char *msg, char **buf, int *bufmax, int *buflen, /* add the attribution */ if (Attribution) { - mutt_make_string (tmp, sizeof (tmp) - 1, Attribution, Context->hdrs[n]); + mutt_make_string (tmp, sizeof (tmp) - 1, Attribution, Context, Context->hdrs[n]); strcat (tmp, "\n"); } diff --git a/enter.c b/enter.c index a7981ccc..b575db04 100644 --- a/enter.c +++ b/enter.c @@ -412,6 +412,15 @@ int mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x, mutt_alias_menu ((char *) buf, buflen, Aliases); return (1); } + else if (flags & M_COMMAND) + { + buf[curpos] = 0; + if (mutt_command_complete ((char *) buf, buflen, curpos)) + { + redraw = M_REDRAW_INIT; + continue; + } + } else if (flags & (M_FILE | M_EFILE)) { buf[curpos] = 0; diff --git a/flags.c b/flags.c index 20fc650e..846dbd6a 100644 --- a/flags.c +++ b/flags.c @@ -19,6 +19,7 @@ #include "mutt.h" #include "mutt_curses.h" #include "sort.h" +#include "mx.h" void mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf) { @@ -44,6 +45,12 @@ void mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf) { h->deleted = 0; ctx->deleted--; +/* if you undelete a message, the imap server will probably need to know. */ + if(ctx->magic==M_IMAP) + { + h->changed = 1; + ctx->changed = 1; + } } break; diff --git a/functions.h b/functions.h index f8a1af17..d694ad11 100644 --- a/functions.h +++ b/functions.h @@ -307,6 +307,7 @@ struct binding_t OpAttach[] = { struct binding_t OpCompose[] = { { "attach-file", OP_COMPOSE_ATTACH_FILE, "a" }, + { "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" }, { "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" }, { "edit-cc", OP_COMPOSE_EDIT_CC, "c" }, { "copy-file", OP_SAVE, "C" }, diff --git a/globals.h b/globals.h index 8413a7a6..d01f4666 100644 --- a/globals.h +++ b/globals.h @@ -40,6 +40,11 @@ WHERE char *Fqdn; WHERE char *HdrFmt; WHERE char *Homedir; WHERE char *Hostname; +#ifdef USE_IMAP +WHERE char *ImapUser INITVAL (NULL); +WHERE char *ImapPass INITVAL (NULL); +WHERE short ImapCheckTime; +#endif WHERE char *InReplyTo; WHERE char *Inbox; WHERE char *Ispell; diff --git a/hdrline.c b/hdrline.c index 1d43bc19..1c8c9c3d 100644 --- a/hdrline.c +++ b/hdrline.c @@ -152,6 +152,12 @@ static int user_is_recipient (ENVELOPE *hdr) * %u = user (login) name of author * %Z = status flags */ +struct hdr_format_info +{ + CONTEXT *ctx; + HEADER *hdr; +}; + static const char * hdr_format_str (char *dest, size_t destlen, @@ -163,18 +169,27 @@ hdr_format_str (char *dest, unsigned long data, format_flag flags) { - HEADER *hdr = (HEADER *) data; + struct hdr_format_info *hfi = (struct hdr_format_info *) data; + HEADER *hdr; + CONTEXT *ctx; char fmt[SHORT_STRING], buf2[SHORT_STRING], ch, *p; int do_locales, i; int optional = (flags & M_FORMAT_OPTIONAL); size_t len; + hdr = hfi->hdr; + ctx = hfi->ctx; + dest[0] = 0; switch (op) { case 'a': - snprintf (fmt, sizeof (fmt), "%%%ss", prefix); - snprintf (dest, destlen, fmt, hdr->env->from->mailbox); + if(hdr->env->from && hdr->env->from->mailbox) + { + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); + snprintf (dest, destlen, fmt, hdr->env->from->mailbox); + } + dest[0] = '\0'; break; case 'B': @@ -184,11 +199,16 @@ hdr_format_str (char *dest, break; case 'b': - if ((p = strrchr (Context->path, '/'))) - strncpy (dest, p + 1, destlen); - else - strncpy (dest, Context->path, destlen); - break; + if(ctx) + { + if ((p = strrchr (ctx->path, '/'))) + strfcpy (dest, p + 1, destlen); + else + strfcpy (dest, ctx->path, destlen); + break; + } + else + strfcpy(dest, "(null)", destlen); case 'c': mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length); @@ -340,8 +360,13 @@ hdr_format_str (char *dest, break; case 'm': - snprintf (fmt, sizeof (fmt), "%%%sd", prefix); - snprintf (dest, destlen, fmt, Context->msgcount); + if(ctx) + { + snprintf (fmt, sizeof (fmt), "%%%sd", prefix); + snprintf (dest, destlen, fmt, ctx->msgcount); + } + else + strfcpy(dest, "(null)", destlen); break; case 'n': @@ -384,7 +409,7 @@ hdr_format_str (char *dest, ch = '!'; else if (hdr->replied) ch = 'r'; - else if (hdr->read && (Context->msgnotreadyet != hdr->msgno)) + else if (hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno)) ch = '-'; else if (hdr->old) ch = 'O'; @@ -452,7 +477,7 @@ hdr_format_str (char *dest, snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (buf2, sizeof (buf2), "%c%c%c", - (hdr->read && (Context->msgnotreadyet != hdr->msgno)) + (hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno)) ? (hdr->replied ? 'r' : ' ') : (hdr->old ? 'O' : 'N'), hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch), hdr->tagged ? '*' : @@ -475,7 +500,12 @@ hdr_format_str (char *dest, } void -_mutt_make_string (char *dest, size_t destlen, const char *s, HEADER *hdr, format_flag flags) +_mutt_make_string (char *dest, size_t destlen, const char *s, CONTEXT *ctx, HEADER *hdr, format_flag flags) { - mutt_FormatString (dest, destlen, s, hdr_format_str, (unsigned long) hdr, flags); + struct hdr_format_info hfi; + + hfi.hdr = hdr; + hfi.ctx = ctx; + + mutt_FormatString (dest, destlen, s, hdr_format_str, (unsigned long) &hfi, flags); } diff --git a/headers.c b/headers.c index b718eaf1..c9bc49b2 100644 --- a/headers.c +++ b/headers.c @@ -189,7 +189,7 @@ void mutt_edit_headers (const char *editor, else strfcpy (path, p, sizeof (path)); mutt_expand_path (path, sizeof (path)); - if ((body = mutt_make_attach (path))) + if ((body = mutt_make_file_attach (path))) { body->description = safe_strdup (q); for (parts = msg->content; parts->next; parts = parts->next) ; diff --git a/hook.c b/hook.c index b50af1fc..be7e516e 100644 --- a/hook.c +++ b/hook.c @@ -142,7 +142,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK)) { - if ((pat = mutt_pattern_comp (pattern.data, (data & M_SENDHOOK) ? M_FULL_MSG : 0, err)) == NULL) + if ((pat = mutt_pattern_comp (pattern.data, (data & M_SAVEHOOK) ? M_FULL_MSG : 0, err)) == NULL) goto error; } else @@ -249,7 +249,7 @@ mutt_addr_hook (char *path, size_t pathlen, int type, CONTEXT *ctx, HEADER *hdr) if (hook->type & type) if ((mutt_pattern_exec (hook->pattern, 0, ctx, hdr) > 0) ^ hook->rx.not) { - mutt_make_string (path, pathlen, hook->command, hdr); + mutt_make_string (path, pathlen, hook->command, ctx, hdr); return 0; } diff --git a/imap.c b/imap.c index 022d72d1..619482c7 100644 --- a/imap.c +++ b/imap.c @@ -20,6 +20,7 @@ #include "mutt_curses.h" #include "mx.h" #include "mailbox.h" +#include "globals.h" #include #include @@ -27,6 +28,8 @@ #include #include #include +#include +#include /* Minimal support for IMAP 4rev1 */ @@ -41,6 +44,7 @@ enum { IMAP_FATAL = 1, IMAP_NEW_MAIL, + IMAP_EXPUNGE, IMAP_BYE }; @@ -59,8 +63,23 @@ typedef struct IMAP_CACHE cache[IMAP_CACHE_LEN]; } IMAP_DATA; -static char ImapUser[SHORT_STRING] = { 0 }; -static char ImapPass[SHORT_STRING] = { 0 }; +/* simple read buffering to speed things up. */ +static int imap_readchar (int fd, char *c) +{ + static char inbuf[LONG_STRING]; + static int bufpos=0, available=0; + + if (bufpos>=available) + { + available = read (fd, inbuf, sizeof(inbuf)); + bufpos = 0; + if (available <= 0) + return available; /* returns 0 for EOF or -1 for other error */ + } + *c = inbuf[bufpos]; + bufpos++; + return 1; +} static int imap_read_line (char *buf, size_t buflen, int fd) { @@ -69,7 +88,7 @@ static int imap_read_line (char *buf, size_t buflen, int fd) for (i = 0; i < buflen; i++) { - if (read (fd, &ch, 1) != 1) + if (imap_readchar (fd, &ch) != 1) return (-1); if (ch == '\n') break; @@ -178,6 +197,9 @@ static int imap_parse_fetch (HEADER *h, char *s) dprint (1, (debugfile, "imap_parse_fetch(): bogus FLAGS entry: %s\n", s)); return (-1); /* parse error */ } + /* we're about to get a new set of headers, so clear the old ones. */ + h->deleted=0; h->flagged=0; + h->replied=0; h->read=0; s++; state = 1; } @@ -208,6 +230,7 @@ static int imap_parse_fetch (HEADER *h, char *s) while (isdigit (*s)) *ptmp++ = *s++; *ptmp = 0; + h->content->length = atoi (tmp); } else if (*s == ')') s++; /* end of request */ @@ -294,6 +317,7 @@ static int imap_handle_untagged (CONTEXT *ctx, char *s) { char *pn; int count; + int n, ind; s = imap_next_word (s); @@ -307,21 +331,33 @@ static int imap_handle_untagged (CONTEXT *ctx, char *s) /* new mail arrived */ count = atoi (pn); - if (count <= ctx->msgcount) - { - /* something is wrong because the server reported fewer messages - * than we previously saw - */ - mutt_error ("Fatal error. Message count is out of sync!"); - ((IMAP_DATA *) ctx->data)->status = IMAP_FATAL; - mx_fastclose_mailbox (ctx); - return (-1); - } - else - { - ((IMAP_DATA *) ctx->data)->status = IMAP_NEW_MAIL; - ((IMAP_DATA *) ctx->data)->newMailCount = count; - } + if (((IMAP_DATA *) ctx->data)->status != IMAP_EXPUNGE) { + if (count <= ctx->msgcount) + { + /* something is wrong because the server reported fewer messages + * than we previously saw + */ + mutt_error ("Fatal error. Message count is out of sync!"); + ((IMAP_DATA *) ctx->data)->status = IMAP_FATAL; + mx_fastclose_mailbox (ctx); + return (-1); + } + else + { + ((IMAP_DATA *) ctx->data)->status = IMAP_NEW_MAIL; + ((IMAP_DATA *) ctx->data)->newMailCount = count; + } + } + } + else if (strncasecmp ("EXPUNGE", s, 7) == 0) + { + /* a message was removed; reindex remaining messages */ + /* (which amounts to decrementing indices of messages */ + /* with an index greater than the deleted one. */ + ind = atoi (pn) - 1; + for (n = 0; n < ctx->msgcount; n++) + if (ctx->hdrs[n]->index > ind) + ctx->hdrs[n]->index--; } } else if (strncasecmp ("BYE", s, 3) == 0) @@ -512,41 +548,50 @@ int imap_open_mailbox (CONTEXT *ctx) char buf[LONG_STRING]; char bufout[LONG_STRING]; char host[SHORT_STRING]; + char user[SHORT_STRING]; + char pass[SHORT_STRING]; char mailbox[_POSIX_PATH_MAX]; char seq[16]; int count = 0; int n; char *pc; - pc = ctx->path; - if (*pc != '{') + if (ctx->path[0] != '{') return (-1); - pc++; - n = 0; - while (*pc && *pc != '}') + for(n = 0, pc = ctx->path + 1; *pc && *pc != '}' && n < sizeof(host) - 1; + n++, pc++) host[n++] = *pc++; + if(*pc != '}') + return -1; host[n] = 0; - if (!*pc) - return (-1); pc++; strfcpy (mailbox, pc, sizeof (mailbox)); - if (!ImapUser[0]) - strfcpy (ImapUser, Username, sizeof (ImapUser)); - if (mutt_get_field ("IMAP Username: ", ImapUser, sizeof (ImapUser), 0) != 0 || - !ImapUser[0]) + if (!ImapUser) { - ImapUser[0] = 0; - return (-1); + strfcpy (user, Username, sizeof (user)); + if (mutt_get_field ("IMAP Username: ", user, sizeof (user), 0) != 0 || + !user[0]) + { + user[0] = 0; + return (-1); + } } + else + strfcpy (user, ImapUser, sizeof (user)); - snprintf (buf, sizeof (buf), "Password for %s@%s: ", ImapUser, host); - ImapPass[0] = 0; - if (mutt_get_field (buf, ImapPass, sizeof (ImapPass), M_PASS) != 0 || - !ImapPass[0]) + if (!ImapPass) { - return (-1); + pass[0]=0; + snprintf (buf, sizeof (buf), "Password for %s@%s: ", user, host); + if (mutt_get_field (buf, pass, sizeof (pass), M_PASS) != 0 || + !pass[0]) + { + return (-1); + } } + else + strfcpy (pass, ImapPass, sizeof (pass)); memset (&sin, 0, sizeof (sin)); sin.sin_port = htons (IMAP_PORT); @@ -591,12 +636,20 @@ int imap_open_mailbox (CONTEXT *ctx) mutt_message ("Logging in..."); imap_make_sequence (seq, sizeof (seq), ctx); - snprintf (buf, sizeof (buf), "%s LOGIN %s %s\r\n", seq, ImapUser, ImapPass); + snprintf (buf, sizeof (buf), "%s LOGIN %s %s\r\n", seq, user, pass); if (imap_exec (buf, sizeof (buf), ctx, seq, buf) != 0) { + /* Most likely an invalid login; clear username and password for re-entry. */ + FREE (&ImapUser); + FREE (&ImapPass); imap_error ("imap_open_mailbox()", buf); return (-1); } + /* If they have a successful login, we may as well cache the user/password. */ + if (!ImapUser) + ImapUser = safe_strdup (user); + if (!ImapPass) + ImapPass = safe_strdup (pass); mutt_message ("Selecting %s...", mailbox); imap_make_sequence (seq, sizeof (seq), ctx); @@ -630,12 +683,14 @@ int imap_open_mailbox (CONTEXT *ctx) } while (strncmp (seq, buf, strlen (seq)) != 0); - mutt_message ("Fetching message headers..."); ctx->hdrmax = count; ctx->hdrs = safe_malloc (count * sizeof (HEADER *)); ctx->v2r = safe_malloc (count * sizeof (int)); for (ctx->msgcount = 0; ctx->msgcount < count; ) { + snprintf (buf, sizeof (buf), "Fetching message headers... [%d/%d]", + ctx->msgcount + 1, count); + mutt_message (buf); ctx->hdrs[ctx->msgcount] = mutt_new_header (); /* `count' can get modified if new mail arrives while fetching the @@ -775,52 +830,6 @@ int imap_close_connection (CONTEXT *ctx) return 0; } -static int make_delete_list (char *list, size_t listlen, CONTEXT *ctx) -{ - int first = -1, last = -1; - int n; - char tmp[LONG_STRING]; - - *list = 0; - for (n=0; nmsgcount; n++) - { - if (ctx->hdrs[n]->deleted) - { - if (first < 0) - { - first = n; - last = n; - } - else if (last != n - 1) - { - if (first != last) - snprintf (tmp, sizeof (tmp), "%d:%d", first + 1, last + 1); - else - snprintf (tmp, sizeof (tmp), "%d", first + 1); - if (list[0]) - strcat (list, ","); - strcat (list, tmp); - first = last = n; - } - else - last = n; - } - } - - if (first >= 0) - { - if (first != last) - snprintf (tmp, sizeof (tmp), "%d:%d", first + 1, last + 1); - else - snprintf (tmp, sizeof (tmp), "%d", first + 1); - if (list[0]) - strcat (list, ","); - strcat (list, tmp); - } - - return 0; -} - int imap_sync_mailbox (CONTEXT *ctx) { char seq[8]; @@ -829,21 +838,28 @@ int imap_sync_mailbox (CONTEXT *ctx) int n; /* save status changes */ - mutt_message ("Saving message status flags..."); for (n = 0; n < ctx->msgcount; n++) { - if (!ctx->hdrs[n]->deleted && ctx->hdrs[n]->changed) + snprintf (tmp, sizeof (tmp), "Saving message status flags... [%d/%d]", n+1, + ctx->msgcount); + mutt_message (tmp); + if (ctx->hdrs[n]->deleted || ctx->hdrs[n]->changed) { + *tmp = 0; if (ctx->hdrs[n]->read) strcat (tmp, "\\Seen "); if (ctx->hdrs[n]->flagged) strcat (tmp, "\\Flagged "); if (ctx->hdrs[n]->replied) - strcat (tmp, "\\Answered"); + strcat (tmp, "\\Answered "); + if (ctx->hdrs[n]->deleted) + strcat (tmp, "\\Deleted"); mutt_remove_trailing_ws (tmp); + if (!*tmp) continue; /* imapd doesn't like empty flags. */ imap_make_sequence (seq, sizeof (seq), ctx); - snprintf (buf, sizeof (buf), "%s STORE %d FLAGS.SILENT (%s)\r\n", seq, tmp); + snprintf (buf, sizeof (buf), "%s STORE %d FLAGS.SILENT (%s)\r\n", seq, + ctx->hdrs[n]->index + 1, tmp); if (imap_exec (buf, sizeof (buf), ctx, seq, buf) != 0) { imap_error ("imap_sync_mailbox()", buf); @@ -852,16 +868,18 @@ int imap_sync_mailbox (CONTEXT *ctx) } } - mutt_message ("Marking messages as deleted..."); - make_delete_list (tmp, sizeof (tmp), ctx); + mutt_message ("Expunging messages from server..."); + ((IMAP_DATA *) ctx->data)->status = IMAP_EXPUNGE; imap_make_sequence (seq, sizeof (seq), ctx); - snprintf (buf, sizeof (buf), "%s STORE %s +FLAGS.SILENT (\\Deleted)\r\n", seq, tmp); + snprintf (buf, sizeof (buf), "%s EXPUNGE\r\n", seq); if (imap_exec (buf, sizeof (buf), ctx, seq, buf) != 0) { imap_error ("imap_sync_mailbox()", buf); return (-1); } - + ((IMAP_DATA *) ctx->data)->status = 0; + /* WARNING: Messages need to be reindexed at this point after the expunge, or */ + /* mutt will become -very- confused unless it's quitting. */ return 0; } @@ -904,8 +922,16 @@ int imap_check_mailbox (CONTEXT *ctx, int *index_hint) { char seq[8]; char buf[LONG_STRING]; + static time_t checktime=0; int msgcount = ctx->msgcount; + if (ImapCheckTime) + { + time_t k=time(NULL); + if (checktime && (k-checktime < ImapCheckTime)) return 0; + checktime=k; + } + imap_make_sequence (seq, sizeof (seq), ctx); snprintf (buf, sizeof (buf), "%s NOOP\r\n", seq); if (imap_exec (buf, sizeof (buf), ctx, seq, buf) != 0) diff --git a/init.c b/init.c index ddcb531e..accc95d8 100644 --- a/init.c +++ b/init.c @@ -1120,6 +1120,79 @@ finish: return (r); } +/* helper function for completion. Changes the dest buffer if + necessary/possible to aid completion. + dest == completion result gets here. + src == candidate for completion. + try == user entered data for completion. + len == length of dest buffer. +*/ +static void candidate (char *dest, char *try, char *src, int len) +{ + int l; + + if (strstr (src, try) == src) + { + if (dest[0] == 0) + { + strncpy (dest, src, len); + strncat (dest, " ", len); + } + else + { + for (l = 0; src[l] && src[l] == dest[l]; l++); + dest[l] = 0; + } + } +} + +int mutt_command_complete (char *buffer, size_t len, int pos) +{ + char cmd[STRING]; + char completed[STRING] = { 0 }; + char *pt; + int num; + + if (buffer[0] == 0) + return 0; + strncpy (cmd, buffer, pos); + pt = cmd; + pt[pos] = 0; + while (!isspace (*pt)) + pt++; + *pt = 0; + + pt = buffer + pos; + while ((pt > buffer) && !isspace (*pt)) + pt--; + if (pt == buffer) /* complete cmd */ + { + for (num = 0; Commands[num].name; num++) + candidate (completed, cmd, Commands[num].name, sizeof (completed)); + + if (completed[0] == 0) + return 0; + strncpy (buffer, completed, len); + } + else if (!strncasecmp (cmd, "set", 3) + || !strncasecmp (cmd, "unset", 5) + || !strncasecmp (cmd, "toggle", 6)) + { /* complete variables */ + pt++; + if (*pt == 0) + return 0; + strncpy (cmd, pt, sizeof (cmd)); + for (num = 0; MuttVars[num].option; num++) + candidate (completed, cmd, MuttVars[num].option, sizeof (completed)); + if (completed[0] == 0) + return 0; + strncpy (pt, completed, buffer + len - pt); + } + else + return 0; + return 1; +} + char *mutt_getnamebyvalue (int val, const struct mapping_t *map) { int i; diff --git a/init.h b/init.h index 40515718..5f5e9df6 100644 --- a/init.h +++ b/init.h @@ -116,6 +116,11 @@ struct option_t MuttVars[] = { { "help", DT_BOOL, R_BOTH, OPTHELP, 1 }, { "history", DT_NUM, R_NONE, UL &HistSize, 10 }, { "hostname", DT_STR, R_NONE, UL &Fqdn, 0 }, +#ifdef USE_IMAP + { "imap_user", DT_STR, R_NONE, UL &ImapUser, UL 0 }, + { "imap_pass", DT_STR, R_NONE, UL &ImapPass, UL 0 }, + { "imap_checkinterval", DT_NUM, R_NONE, UL &ImapCheckTime, 0 }, +#endif { "in_reply_to", DT_STR, R_NONE, UL &InReplyTo, UL "%i; from %n on %{!%a, %b %d, %Y at %I:%M:%S%p %Z}" }, { "include", DT_QUAD, R_NONE, OPT_INCLUDE, M_ASKYES }, { "indent_string", DT_STR, R_NONE, UL &Prefix, UL "> " }, diff --git a/main.c b/main.c index 29848c2d..a8369e16 100644 --- a/main.c +++ b/main.c @@ -162,8 +162,13 @@ static void show_version (void) "-USE_FLOCK" #endif ); - puts ( +#ifdef USE_IMAP + "+USE_IMAP " +#else + "-USE_IMAP " +#endif + #ifdef USE_POP "+USE_POP " #else @@ -202,11 +207,12 @@ static void show_version (void) #ifdef BUFFY_SIZE - "+BUFFY_SIZE " + "+BUFFY_SIZE" #else - "-BUFFY_SIZE " + "-BUFFY_SIZE" #endif - + ); + puts ( #ifdef EXACT_ADDRESS "+" #else @@ -561,11 +567,11 @@ int main (int argc, char **argv) { if (a) { - a->next = mutt_make_attach (t->data); + a->next = mutt_make_file_attach (t->data); a = a->next; } else - msg->content = a = mutt_make_attach (t->data); + msg->content = a = mutt_make_file_attach (t->data); if (!a) { if (!option (OPTNOCURSES)) diff --git a/mh.c b/mh.c index b4f088ad..ce724f3e 100644 --- a/mh.c +++ b/mh.c @@ -643,20 +643,23 @@ int mh_sync_mailbox (CONTEXT * ctx) } } - snprintf (path, sizeof (path), "%s/%s", ctx->path, ".mh_sequences"); - mh_sequences = fopen (path, "w"); - if (mh_sequences == NULL) + if(ctx->magic == M_MH) { - mutt_message ("fopen %s failed", path); - } - else - { - fprintf (mh_sequences, "unseen: "); - for (i = 0; i < ctx->msgcount; i++) - if ((ctx->hdrs[i]->read == 0) && !(ctx->hdrs[i]->deleted)) - fprintf (mh_sequences, "%s ", ctx->hdrs[i]->path); - fprintf (mh_sequences, "\n"); - fclose (mh_sequences); + snprintf (path, sizeof (path), "%s/%s", ctx->path, ".mh_sequences"); + mh_sequences = fopen (path, "w"); + if (mh_sequences == NULL) + { + mutt_message ("fopen %s failed", path); + } + else + { + fprintf (mh_sequences, "unseen: "); + for (i = 0; i < ctx->msgcount; i++) + if ((ctx->hdrs[i]->read == 0) && !(ctx->hdrs[i]->deleted)) + fprintf (mh_sequences, "%s ", ctx->hdrs[i]->path); + fprintf (mh_sequences, "\n"); + fclose (mh_sequences); + } } return (rc); diff --git a/mutt.h b/mutt.h index 34b8bd55..4620764d 100644 --- a/mutt.h +++ b/mutt.h @@ -59,12 +59,13 @@ #define CH_TXTPLAIN (1<<11) /* generate text/plain MIME headers */ /* flags for mutt_enter_string() */ -#define M_ALIAS 1 /* do alias "completion" by calling up the alias-menu */ -#define M_FILE (1<<1) /* do file completion */ -#define M_EFILE (1<<2) /* do file completion, plus incoming folders */ -#define M_CMD (1<<3) /* do completion on previous word */ -#define M_PASS (1<<4) /* password mode (no echo) */ -#define M_CLEAR (1<<5) /* clear input if printable character is pressed */ +#define M_ALIAS 1 /* do alias "completion" by calling up the alias-menu */ +#define M_FILE (1<<1) /* do file completion */ +#define M_EFILE (1<<2) /* do file completion, plus incoming folders */ +#define M_CMD (1<<3) /* do completion on previous word */ +#define M_PASS (1<<4) /* password mode (no echo) */ +#define M_CLEAR (1<<5) /* clear input if printable character is pressed */ +#define M_COMMAND (1<<6) /* do command completion */ /* flags for mutt_get_token() */ #define M_TOKEN_EQUAL 1 /* treat '=' as a special */ diff --git a/mx.c b/mx.c index 604e7f38..a1b93c53 100644 --- a/mx.c +++ b/mx.c @@ -29,8 +29,9 @@ #include "pgp.h" #endif - - +#ifdef USE_IMAP +#include "imap.h" +#endif #ifdef BUFFY_SIZE #include "buffy.h" diff --git a/pager.c b/pager.c index 63f9a260..02fd2c79 100644 --- a/pager.c +++ b/pager.c @@ -1464,7 +1464,7 @@ mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra) { _mutt_make_string (buffer, COLS-9 < sizeof (buffer) ? COLS-9 : sizeof (buffer), - NONULL (PagerFmt), extra->hdr, M_FORMAT_MAKEPRINT); + NONULL (PagerFmt), Context, extra->hdr, M_FORMAT_MAKEPRINT); } printw ("%-*.*s -- (", COLS-10, COLS-10, IsHeader (extra) ? buffer : banner); if (last_pos < sb.st_size - 1) diff --git a/pgpkey.c b/pgpkey.c index 23120a2d..9b6de3d3 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -299,9 +299,9 @@ char *pgp_ask_for_key (const char *ringfile, KEYINFO *udb, char *tag, char *what { for (l = id_defaults; l; l = l->next) - if (!strcasecmp (whatfor, l->what)) + if (!strcasecmp (whatfor, NONULL(l->what))) { - strcpy (resp, l->dflt); + strcpy (resp, NONULL(l->dflt)); break; } } diff --git a/pgppubring.c b/pgppubring.c index 322b32a3..8e24be28 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -81,6 +81,7 @@ static const char *pkalgbytype(unsigned char type) case 3: return "RSA"; case 16: return "ElG"; case 17: return "DSA"; + case 20: return "ElG"; default: return "unk"; } } @@ -139,6 +140,7 @@ static short canencrypt(unsigned char type) case 1: case 2: case 16: + case 20: return 1; default: return 0; @@ -152,6 +154,7 @@ static short cansign(unsigned char type) case 1: case 3: case 17: + case 20: return 1; default: return 0; @@ -256,12 +259,28 @@ static unsigned char *pgp_read_packet(FILE *fp, size_t *len) partial = 0; material -= 2; } - else + else if(b < 255) { material = 1 << (b & 0x1f); partial = 1; material -= 1; } + else /* b == 255 */ + { + unsigned char buf[4]; + if( fread( buf, 4, 1, fp ) < 1) + { + mutt_perror("fread"); + goto bail; + } + /*assert( sizeof(material) >= 4 );*/ + material = buf[0] << 24; + material |= buf[1] << 16; + material |= buf[2] << 8; + material |= buf[3]; + partial = 0; + material -= 5; + } if(read_material(material, &used, fp) == -1) goto bail; @@ -474,7 +493,7 @@ static KEYINFO *pgp_parse_pgp3_key(unsigned char *buff, size_t l) if (alg == 17) skip_bignum(buff, l, j, &j, 3); - else if(alg == 16) + else if(alg == 16 || alg == 20 ) skip_bignum(buff, l, j, &j, 2); len = (buff[j] << 8) + buff[j+1]; diff --git a/postpone.c b/postpone.c index 805a3c68..185ccbaf 100644 --- a/postpone.c +++ b/postpone.c @@ -94,7 +94,7 @@ static void post_entry (char *s, size_t slen, MUTTMENU *menu, int entry) { CONTEXT *ctx = (CONTEXT *) menu->data; - mutt_make_string (s, slen, NONULL (HdrFmt), ctx->hdrs[entry]); + mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry]); } static HEADER *select_msg (void) @@ -270,7 +270,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur) safe_free ((void **) &PostContext); return (-1); } - hdr->content = mutt_make_attach (file); + hdr->content = mutt_make_file_attach (file); hdr->content->use_disp = 0; /* no content-disposition */ hdr->content->unlink = 1; /* delete when we are done */ } diff --git a/protos.h b/protos.h index 678db40b..f8b85baf 100644 --- a/protos.h +++ b/protos.h @@ -28,8 +28,9 @@ #define MoreArgs(p) (*p->dptr && *p->dptr != ';' && *p->dptr != '#') -#define mutt_make_string(A,B,C,D) _mutt_make_string(A,B,C,D,0) -void _mutt_make_string (char *, size_t, const char *, HEADER *, format_flag); +#define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0) +void _mutt_make_string (char *, size_t, const char *, CONTEXT *, + HEADER *, format_flag); int mutt_extract_token (BUFFER *, BUFFER *, int); @@ -68,7 +69,8 @@ ADDRESS *mutt_expand_aliases (ADDRESS *); ADDRESS *mutt_parse_adrlist (ADDRESS *, const char *); BODY *mutt_dup_body (BODY *); -BODY *mutt_make_attach (const char *); +BODY *mutt_make_file_attach (const char *); +BODY *mutt_make_message_attach (CONTEXT *, HEADER *); BODY *mutt_make_multipart (BODY *); BODY *mutt_new_body (void); BODY *mutt_parse_multipart (FILE *, const char *, long, int); @@ -179,6 +181,7 @@ int mutt_check_menu (const char *); int mutt_check_mime_type (const char *); int mutt_check_month (const char *); int mutt_check_overwrite (const char *, const char *, char *, size_t, int); +int mutt_command_complete (char *, size_t, int); int mutt_complete (char *); int mutt_compose_attachment (BODY *a); int mutt_copy_bytes (FILE *, FILE *, size_t); diff --git a/query.c b/query.c index f9d75e97..b8cfe09b 100644 --- a/query.c +++ b/query.c @@ -142,7 +142,7 @@ static QUERY *run_query (char *s, int quiet) return first; } -int query_search (MUTTMENU *m, regex_t *re, int n) +static int query_search (MUTTMENU *m, regex_t *re, int n) { ENTRY *table = (ENTRY *) m->data; @@ -152,7 +152,7 @@ int query_search (MUTTMENU *m, regex_t *re, int n) /* This is the callback routine from mutt_menuLoop() which is used to generate * a menu entry for the requested item number. */ -void query_entry (char *s, size_t slen, MUTTMENU *m, int num) +static void query_entry (char *s, size_t slen, MUTTMENU *m, int num) { ENTRY *table = (ENTRY *) m->data; char buf[SHORT_STRING] = ""; @@ -177,7 +177,7 @@ void query_entry (char *s, size_t slen, MUTTMENU *m, int num) table[num].data->other); } -int query_tag (MUTTMENU *menu, int n) +static int query_tag (MUTTMENU *menu, int n) { return (((ENTRY *) menu->data)[n].tagged = !((ENTRY *) menu->data)[n].tagged); } @@ -186,6 +186,12 @@ int mutt_query_complete (char *buf, size_t buflen) { QUERY *results = NULL; + if (!QueryCmd) + { + mutt_error ("Query command not defined."); + return 0; + } + results = run_query (buf, 1); if (results) { @@ -205,6 +211,12 @@ int mutt_query_complete (char *buf, size_t buflen) void mutt_query_menu (char *buf, size_t buflen) { + if (!QueryCmd) + { + mutt_error ("Query command not defined."); + return; + } + if (buf == NULL) { char buffer[STRING] = ""; @@ -238,11 +250,6 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) if (results == NULL) { - if (!QueryCmd) - { - mutt_error ("Query command not defined."); - return; - } /* Prompt for Query */ if (mutt_get_field ("Query: ", buf, buflen, 0) == 0 && buf[0]) { diff --git a/recvattach.c b/recvattach.c index 2ee69560..c4212342 100644 --- a/recvattach.c +++ b/recvattach.c @@ -145,7 +145,7 @@ void attach_entry (char *b, size_t blen, MUTTMENU *menu, int num) s[0] = 0; if (m->type == TYPEMESSAGE && (!strcasecmp ("rfc822", m->subtype) || !strcasecmp ("news", m->subtype)) && MsgFmt[0]) - _mutt_make_string (s, sizeof (s), MsgFmt, m->hdr, + _mutt_make_string (s, sizeof (s), MsgFmt, NULL, m->hdr, M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT); mutt_pretty_size (size, sizeof (size), m->length); diff --git a/reldate.h b/reldate.h index 84aeef0d..09fcf307 100644 --- a/reldate.h +++ b/reldate.h @@ -1 +1 @@ -const char *ReleaseDate = "1998-05-14"; +const char *ReleaseDate = "1998-06-06"; diff --git a/send.c b/send.c index 5cfa8471..30b97ce7 100644 --- a/send.c +++ b/send.c @@ -375,7 +375,7 @@ static int include_reply (CONTEXT *ctx, HEADER *cur, FILE *out) if (Attribution) { - mutt_make_string (buffer, sizeof (buffer), Attribution, cur); + mutt_make_string (buffer, sizeof (buffer), Attribution, ctx, cur); fputs (buffer, out); fputc ('\n', out); } @@ -385,45 +385,13 @@ static int include_reply (CONTEXT *ctx, HEADER *cur, FILE *out) mutt_copy_message (out, ctx, cur, flags, CH_DECODE); if (PostIndentString) { - mutt_make_string (buffer, sizeof (buffer), PostIndentString, cur); + mutt_make_string (buffer, sizeof (buffer), PostIndentString, ctx, cur); fputs (buffer, out); fputc ('\n', out); } return 0; } -static BODY *make_forward (CONTEXT *ctx, HEADER *hdr) -{ - char buffer[LONG_STRING]; - BODY *body; - FILE *fpout; - - mutt_mktemp (buffer); - if ((fpout = safe_fopen (buffer, "w")) == NULL) - return NULL; - - body = mutt_new_body (); - body->type = TYPEMESSAGE; - body->subtype = safe_strdup ("rfc822"); - body->filename = safe_strdup (buffer); - body->unlink = 1; - body->use_disp = 0; - - /* this MUST come after setting ->filename because we reuse buffer[] */ - strfcpy (buffer, "Forwarded message from ", sizeof (buffer)); - rfc822_write_address (buffer + 23, sizeof (buffer) - 23, hdr->env->from); - body->description = safe_strdup (buffer); - - mutt_parse_mime_message (ctx, hdr); - mutt_copy_message (fpout, ctx, hdr, - option (OPTMIMEFORWDECODE) ? M_CM_DECODE : 0, - CH_XMIT | (option (OPTMIMEFORWDECODE) ? (CH_MIME | CH_TXTPLAIN ) : 0)); - - fclose (fpout); - mutt_update_encoding (body); - return (body); -} - static int default_to (ADDRESS **to, ENVELOPE *env, int group) { char prompt[STRING]; @@ -584,7 +552,7 @@ envelope_defaults (ENVELOPE *env, CONTEXT *ctx, HEADER *cur, int flags) if (InReplyTo) { strfcpy (buffer, "In-Reply-To: ", sizeof (buffer)); - mutt_make_string (buffer + 13, sizeof (buffer) - 13, InReplyTo, cur); + mutt_make_string (buffer + 13, sizeof (buffer) - 13, InReplyTo, ctx, cur); tmp = env->userhdrs; while (tmp && tmp->next) tmp = tmp->next; @@ -613,7 +581,7 @@ envelope_defaults (ENVELOPE *env, CONTEXT *ctx, HEADER *cur, int flags) else if (flags & SENDFORWARD) { /* set the default subject for the message. */ - mutt_make_string (buffer, sizeof (buffer), ForwFmt, cur); + mutt_make_string (buffer, sizeof (buffer), ForwFmt, ctx, cur); env->subject = safe_strdup (buffer); } @@ -669,7 +637,7 @@ generate_body (FILE *tempfp, /* stream for outgoing message */ if (cur) { - tmp = make_forward (ctx, cur); + tmp = mutt_make_message_attach (ctx, cur); if (last) last->next = tmp; else @@ -681,7 +649,7 @@ generate_body (FILE *tempfp, /* stream for outgoing message */ { if (ctx->hdrs[ctx->v2r[i]]->tagged) { - tmp = make_forward (ctx, ctx->hdrs[ctx->v2r[i]]); + tmp = mutt_make_message_attach (ctx, ctx->hdrs[ctx->v2r[i]]); if (last) { last->next = tmp; diff --git a/sendlib.c b/sendlib.c index b6eaac64..a9bbeff4 100644 --- a/sendlib.c +++ b/sendlib.c @@ -849,7 +849,39 @@ void mutt_update_encoding (BODY *a) safe_free ((void **) &info); } -BODY *mutt_make_attach (const char *path) +BODY *mutt_make_message_attach (CONTEXT *ctx, HEADER *hdr) +{ + char buffer[LONG_STRING]; + BODY *body; + FILE *fpout; + + mutt_mktemp (buffer); + if ((fpout = safe_fopen (buffer, "w")) == NULL) + return NULL; + + body = mutt_new_body (); + body->type = TYPEMESSAGE; + body->subtype = safe_strdup ("rfc822"); + body->filename = safe_strdup (buffer); + body->unlink = 1; + body->use_disp = 0; + + /* this MUST come after setting ->filename because we reuse buffer[] */ + strfcpy (buffer, "Forwarded message from ", sizeof (buffer)); + rfc822_write_address (buffer + 23, sizeof (buffer) - 23, hdr->env->from); + body->description = safe_strdup (buffer); + + mutt_parse_mime_message (ctx, hdr); + mutt_copy_message (fpout, ctx, hdr, + option (OPTMIMEFORWDECODE) ? M_CM_DECODE : 0, + CH_XMIT | (option (OPTMIMEFORWDECODE) ? (CH_MIME | CH_TXTPLAIN ) : 0)); + + fclose (fpout); + mutt_update_encoding (body); + return (body); +} + +BODY *mutt_make_file_attach (const char *path) { BODY *att; CONTENT *info;