--- mutt-1.5.21.orig/debian/control +++ mutt-1.5.21/debian/control @@ -0,0 +1,62 @@ +Source: mutt +Section: mail +Priority: standard +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Antonio Radici +Uploaders: Christoph Berg +Build-Depends: automake, debhelper (>> 7), docbook-xml, docbook-xsl, + w3m, gawk, gettext, libgnutls-dev, + libgpgme11-dev, libidn11-dev, libkrb5-dev, libncurses5-dev, libncursesw5-dev, + libsasl2-dev, pkg-config, quilt, xsltproc, zlib1g-dev, + libgdbm-dev +Standards-Version: 3.9.1 +Vcs-Git: git://git.debian.org/git/pkg-mutt/mutt.git +Vcs-Browser: http://git.debian.org/?p=pkg-mutt/mutt.git +Homepage: http://www.mutt.org/ + +Package: mutt +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: default-mta | mail-transport-agent, locales, mime-support, libsasl2-modules +Suggests: urlview, aspell | ispell, gnupg, mixmaster, openssl, ca-certificates +Provides: mail-reader, imap-client +Conflicts: mutt-utf8 +Replaces: mutt-utf8 +Description: text-based mailreader supporting MIME, GPG, PGP and threading + Mutt is a sophisticated text-based Mail User Agent. Some highlights: + . + * MIME support (including RFC1522 encoding/decoding of 8-bit message + headers and UTF-8 support). + * PGP/MIME support (RFC 2015). + * Advanced IMAP client supporting SSL encryption and SASL authentication. + * POP3 support. + * ESMTP support. + * Message threading (both strict and non-strict). + * Keybindings are configurable, default keybindings are much like ELM; + Mush and PINE-like ones are provided as examples. + * Handles MMDF, MH and Maildir in addition to regular mbox format. + * Messages may be (indefinitely) postponed. + * Colour support. + * Highly configurable through easy but powerful rc file. + +Package: mutt-patched +Architecture: any +Priority: extra +Depends: ${shlibs:Depends}, ${misc:Depends}, mutt (= ${binary:Version}) +Description: the Mutt Mail User Agent with extra patches + Mutt is a sophisticated text-based Mail User Agent. + . + This package adds the "sidebar" patch that lists mailboxes with new mail + in a separate column on screen. + +Package: mutt-dbg +Architecture: any +Section: debug +Priority: extra +Depends: ${shlibs:Depends}, ${misc:Depends}, mutt (= ${binary:Version}) +Description: debugging symbols for mutt + Mutt is a sophisticated text-based Mail User Agent. + . + This package contains the debugging symbols for mutt and mutt-patched; this + is supposed to be used when there is a core file which should be analyzed + using gdb. --- mutt-1.5.21.orig/debian/mutt.doc-base +++ mutt-1.5.21/debian/mutt.doc-base @@ -0,0 +1,14 @@ +Document: mutt +Title: The Mutt E-Mail Client Manual +Author: Various +Abstract: The documentation for Mutt, a sophisticated text oriented mail + user agent ("mail reader"). +Section: Network/Communication + +Format: text +Files: /usr/share/doc/mutt/manual.txt.gz + +Format: HTML +Index: /usr/share/doc/mutt/html/manual.html +Files: /usr/share/doc/mutt/html/* + --- mutt-1.5.21.orig/debian/compat +++ mutt-1.5.21/debian/compat @@ -0,0 +1 @@ +7 --- mutt-1.5.21.orig/debian/mutt.mime +++ mutt-1.5.21/debian/mutt.mime @@ -0,0 +1 @@ +message/rfc822; mutt -Rf '%s'; edit=mutt -f '%s'; needsterminal --- mutt-1.5.21.orig/debian/rules +++ mutt-1.5.21/debian/rules @@ -0,0 +1,216 @@ +#!/usr/bin/make -f + +include /usr/share/quilt/quilt.make +QUILT = QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null + +###################### user serviceable parts ###################### + +### +# build a separate mutt-patched package? +BUILD_PATCHED := yes +### +# header cache backend +# HCACHE_DB := bdb +HCACHE_DB := gdbm +# HCACHE_DB := qdbm +# HCACHE_DB := tokyocabinet +### +# GPGME backend +GPGME := --enable-gpgme +### + +###################### variables ###################### + +ifneq ($(BUILD_PATCHED),yes) +export DH_OPTIONS := -Nmutt-patched +endif + +# Configure arguments + +ifeq ($(HCACHE_DB),bdb) + hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet +endif +ifeq ($(HCACHE_DB),gdbm) + hcache_db := --without-qdbm --without-bdb --without-tokyocabinet +endif +ifeq ($(HCACHE_DB),qdbm) + hcache_db := --without-gdbm --without-bdb --without-tokyocabinet +endif +ifeq ($(HCACHE_DB),tokyocabinet) + hcache_db := --without-gdbm --without-bdb --without-qdbm + ifeq ($(shell dpkg --print-architecture),hurd-i386) + hcache_db := --without-bdb --without-qdbm + endif +endif + +confflags = --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --with-sharedir=/usr/share/mutt \ + --with-docdir=/usr/share/doc \ + --with-mailpath=/var/mail \ + \ + --disable-dependency-tracking \ + \ + --enable-compressed \ + --enable-debug \ + --enable-fcntl \ + --enable-hcache \ + $(GPGME) \ + --enable-imap \ + --enable-smtp \ + --enable-inodesort \ + --enable-pop \ + \ + --with-curses \ + --with-gnutls \ + --with-gss \ + --with-idn \ + --with-mixmaster \ + --with-sasl \ + \ + $(hcache_db) + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +confflags += --build $(DEB_BUILD_GNU_TYPE) +# Only specify --host when cross-compiling +ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --host $(DEB_HOST_GNU_TYPE) +endif + +# CFLAGS +CFLAGS = -Wall -g +CPPFLAGS = -I/usr/include/qdbm +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +# Directory to make the build on +objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE) + +###################### main ###################### + +$(objdir)-patched/build-stamp: $(QUILT_STAMPFN) + dh_testdir + dh_clean + -mkdir $(objdir)-patched + +ifeq ($(BUILD_PATCHED),yes) + ###################### building mutt-patched ###################### + $(QUILT) applied > PATCHES + autoreconf --install --include=m4 + cd $(objdir)-patched && \ + env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ + ../configure $(confflags) + + echo '#include "config-debian.h"' >> $(objdir)-patched/config.h + + # we should just "make mutt" here, but that doesn't work yet + cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)" +endif + + touch $@ + +build build-arch: $(objdir)/build-stamp +$(objdir)/build-stamp: $(objdir)-patched/build-stamp + ###################### building mutt ###################### + $(QUILT) pop mutt.org + $(QUILT) applied > PATCHES + + autoreconf --install --include=m4 + -mkdir $(objdir) + cd $(objdir) && \ + env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ + ../configure $(confflags) + + echo '#include "config-debian.h"' >>$(objdir)/config.h + + cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)" + + touch $@ + +install: build + ###################### install ###################### + dh_testdir + dh_testroot + dh_prep + cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + + cd debian/tmp/usr/share/doc && \ + rm -rf samples/iconv samples/ca-bundle.crt && \ + mv NEWS NEWS.old && \ + cp $(CURDIR)/UPDATING NEWS + + chmod +x debian/extra/lib/* + chmod +x debian/header.awk + debian/header.awk debian/patches/features/* \ + debian/patches/mutt-patched/* > debian/tmp/README.Patches + + ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \ + cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc + + ( echo "# GnuPG configuration"; \ + grep '^set' contrib/gpg.rc; \ + echo ) > debian/tmp/gpg.rc + + dh_install + + # prepare files for update-alternatives + mv debian/mutt/usr/bin/mutt debian/mutt/usr/bin/mutt-org +ifeq ($(BUILD_PATCHED),yes) + install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched +endif + + # reportbug driver + dh_installdirs + install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt + install debian/bug/script $(CURDIR)/debian/mutt/usr/share/bug/mutt + +binary binary-arch: install + ###################### binary ###################### + dh_installman + dh_installmenu + dh_installmime + dh_installdocs + dh_installexamples + dh_installchangelogs ChangeLog + -dh_lintian + + dh_strip --dbg-package=mutt-dbg + rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \ + $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched + + dh_link + dh_compress --exclude usr/share/doc/mutt/README.Patches + dh_fixperms --exclude usr/bin/mutt_dotlock + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +build-indep binary-indep: + @echo "Nothing to do." + +clean: unpatch + ###################### clean ###################### + dh_testdir + dh_testroot + + # please dpkg-source + rm -f po/*.gmo + echo -n > PATCHES + + # remove build trees + rm -rf $(objdir) $(objdir)-patched + + # remove autotool-generated files so they don't show up in the diff.gz + rm -f configure config.h.in + rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in + + dh_clean + +.PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch --- mutt-1.5.21.orig/debian/mutt.menu +++ mutt-1.5.21/debian/mutt.menu @@ -0,0 +1,5 @@ +?package(mutt): title="Mutt" \ + section="Applications/Network/Communication" hints="Mail" \ + needs="text" \ + icon="/usr/share/pixmaps/mutt.xpm" \ + command="/usr/bin/mutt" --- mutt-1.5.21.orig/debian/copyright +++ mutt-1.5.21/debian/copyright @@ -0,0 +1,89 @@ +This is Debian's prepackaged version of Mutt, a powerful text-mode mail +user agent. + +The current maintainers for this package are: + Adeodato Simó + Christoph Berg + +Previous maintainers were: + Stephen Pitts + J.H.M. Dassen + Marco d'Itri + +Original source has been downloaded from ftp://ftp.mutt.org/mutt/: + + URL: + +The following copyright notices apply to most of the program. Some +modules are under different licenses, or in the public domain. + +Please note that this is by no means an exhaustive list of all the +persons who have been contributing to this program. Please see the +manual for a (probably still non complete) list of the persons who +have been helpful with the development of this program. + +Copyright (C) 1996-2007 Michael R. Elkins +Copyright (C) 1996-2002 Brandon Long +Copyright (C) 1997-2008 Thomas Roessler +Copyright (C) 1998-2005 Werner Koch +Copyright (C) 1999-2009 Brendan Cully +Copyright (C) 1999-2002 Tommi Komulainen +Copyright (C) 2000-2004 Edmund Grimley Evans +Copyright (C) 2006-2008 Rocco Rutte + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Contributors: + Copyright (C) 2001 Marco d'Itri + Copyright (C) 2001-2002 Oliver Ehli + Copyright (C) 2004 Brian Fundakowski Feldman + Copyright (C) 2004 g10 Code GmbH + Copyright (C) 2004 Thomas Glanzmann + Copyright (C) 2003 Bjoern Jacke + Copyright (C) 2000 Manoj Kasichainula + Copyright (C) 2001-2004 Andrew McDonald + Copyright (C) 2001 Mike Schiraldi + Copyright (C) 2000-2003 Vsevolod Volkov + Copyright (C) 2004 Tobias Werth + Copyright (C) 2005 Andreas Krennmair + Copyright (C) 2005 Peter J. Holzer + +intl subdirectory: + Copyright (C) 1995-2001 Free Software Foundation, Inc. + Contributed by Ulrich Drepper, 1995. + +On Debian systems, the complete text of the GNU General Public License +can be found in `/usr/share/common-licenses/GPL'. + +md5c.c: + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + These notices must be retained in any copies of any part of this + documentation and/or software. + +The list of authors of the applied patches to this version of mutt can +be found in `/usr/share/doc/mutt/README.Patches'. --- mutt-1.5.21.orig/debian/mutt.examples +++ mutt-1.5.21/debian/mutt.examples @@ -0,0 +1,3 @@ +debian/extra/samples/* +debian/tmp/etc/Muttrc +debian/tmp/usr/share/doc/samples/* --- mutt-1.5.21.orig/debian/NEWS +++ mutt-1.5.21/debian/NEWS @@ -0,0 +1,72 @@ +mutt (1.5.21-2) experimental; urgency=low + mailto-mutt has been replaced by a wrapper as per #576313, because mutt is now + able to handle the mailto: urls; additionally it will also do some checks on + attachments and it will allow us to be as close to upstream as possible + + -- Antonio Radici Sat, 01 Jan 2011 12:56:29 +0000 + +mutt (1.5.20-6) unstable; urgency=low + The behavior of the write_bcc option has changed, now write_bcc is only + used to decide if an Fcc message should have its Bcc header written; + if the message is sent outside using SMTP the Bcc header will never be + written, see the description of debian-specific/467432-write_bcc.patch + for details + + -- Antonio Radici Tue, 19 Jan 2010 21:57:48 +0000 + +mutt (1.5.20-1) unstable; urgency=low + + As result of http://bugs.mutt.org/3097 getopt() is now used in a way that + behaves consistently on all POSIX systems, unfortunately this has broken + the way attachments are added from the command line. + Now "--" is mandatory *before* any address if a file is attached from CLI, + the mutt manpage correctly documents this behavior. + + -- Antonio Radici Sun, 14 Jun 2009 20:53:18 +0100 + +mutt (1.5.17-2) unstable; urgency=low + + There is now a "mutt-patched" package that will contain some more + experimental patches. For now that is the "sidebar" patch. See + README.Patches for details. + + -- Christoph Berg Tue, 01 Jan 2008 20:03:16 +0100 + +mutt (1.5.16-2) unstable; urgency=low + + User-visible changes in this version: + * The gpgme crypt backend is not yet stable enough, disabled again. + * The imap_home_namespace variable was removed upstream. + + -- Christoph Berg Thu, 28 Jun 2007 20:58:49 +0200 + +mutt (1.5.14+cvs20070301-1) experimental; urgency=low + + We no longer unset write_bcc in /etc/Muttrc. If your MTA does not strip Bcc: + headers, edit /etc/Muttrc. (exim4 and postfix strip them, exim(3) does not.) + We also no longer unset use_from and use_domain. Mutt will use the contents + of /etc/mailname to determine the domain part of the From: header. + + This release adds ESMTP support to mutt. To use, set smtp_url to your + smarthost, e.g. smtps://mail.company.com/. + + The gpgme crypt backend is now enabled. + + -- Christoph Berg Thu, 1 Mar 2007 23:56:58 +0100 + +mutt (1.5.6-1) unstable; urgency=low + + In this release the alternates, lists, and subscribe configuration + variables have been turned into regular expression lists. + Additionaly, alternates is now an option, not a variable. + This means that you should change: + + set alternates="foo|bar" + + into + + alternates "foo|bar" + + in your .muttrc file. See muttrc(5) for details. + + -- Artur R. Czechowski Sun, 4 Apr 2004 14:04:03 +0200 --- mutt-1.5.21.orig/debian/README.source +++ mutt-1.5.21/debian/README.source @@ -0,0 +1,57 @@ +This package uses quilt to manage all modifications to the upstream +source. Changes are stored in the source package as diffs in +debian/patches and applied during the build. + +To configure quilt to use debian/patches instead of patches, you want +either to export QUILT_PATCHES=debian/patches in your environment +or use this snippet in your ~/.quiltrc: + + for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do + if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then + export QUILT_PATCHES=debian/patches + fi + done + +To get the fully patched source after unpacking the source package, cd to +the root level of the source package and run: + + quilt push -a + +The last patch listed in debian/patches/series will become the current +patch. + +To add a new set of changes, first run quilt push -a, and then run: + + quilt new + +where is a descriptive name for the patch, used as the filename in +debian/patches. Then, for every file that will be modified by this patch, +run: + + quilt add + +before editing those files. You must tell quilt with quilt add what files +will be part of the patch before making changes or quilt will not work +properly. After editing the files, run: + + quilt refresh + +to save the results as a patch. + +Alternately, if you already have an external patch and you just want to +add it to the build system, run quilt push -a and then: + + quilt import -P /path/to/patch + quilt push -a + +(add -p 0 to quilt import if needed). as above is the filename to +use in debian/patches. The last quilt push -a will apply the patch to +make sure it works properly. + +To remove an existing patch from the list of patches that will be applied, +run: + + quilt delete + +You may need to run quilt pop -a to unapply patches first before running +this command. --- mutt-1.5.21.orig/debian/mutt-patched.prerm +++ mutt-1.5.21/debian/mutt-patched.prerm @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + remove|deconfigure) + update-alternatives --remove mutt /usr/bin/mutt-patched + ;; +esac + +#DEBHELPER# + +exit 0 --- mutt-1.5.21.orig/debian/mutt.docs +++ mutt-1.5.21/debian/mutt.docs @@ -0,0 +1,10 @@ +debian/extra/README.SMIME +debian/tmp/README.Patches +debian/tmp/usr/share/doc/NEWS +debian/tmp/usr/share/doc/NEWS.old +debian/tmp/usr/share/doc/TODO +debian/tmp/usr/share/doc/README +debian/tmp/usr/share/doc/README.SSL +debian/tmp/usr/share/doc/README.SECURITY +debian/tmp/usr/share/doc/PGP-Notes.txt +debian/tmp/usr/share/doc/manual.txt --- mutt-1.5.21.orig/debian/changelog +++ mutt-1.5.21/debian/changelog @@ -0,0 +1,1878 @@ +mutt (1.5.21-2ubuntu3~ppa1~lucid1) lucid; urgency=low + + * backport to lucid.(No change rebuild) + + -- Fumihito YOSHIDA Tue, 10 May 2011 19:35:09 +0900 + +mutt (1.5.21-2ubuntu3) natty; urgency=low + + * Update ubuntu/lp-693244-autoview to blacklist text/html and move patch to + above mutt.org in the series. + + -- Loïc Minier Sat, 29 Jan 2011 01:21:06 +0100 + +mutt (1.5.21-2ubuntu2) natty; urgency=low + + * New patch, ubuntu/lp-693244-autoview, revert changeset 5248:4b5326d8d2ee + to fix implicit_autoview; LP: #693244. + + -- Loïc Minier Sat, 29 Jan 2011 00:49:31 +0100 + +mutt (1.5.21-2ubuntu1) natty; urgency=low + + * Merge with Debian experimental (LP: #697529), remaining changes: + + Drop libtokyocabinet-dev (universe) from Build-Depends, use always + libgdbm-dev and also use gdbm for the header cache backend. (lp: #607448) + + -- أحمد المحمودي (Ahmed El-Mahmoudy) Wed, 05 Jan 2011 09:03:40 +0200 + +mutt (1.5.21-2) experimental; urgency=low + + [ Christoph Berg ] + * debian/patches: features/imap_fast_trash: Support purging of messages. + + [ Antonio Radici ] + * debian/patches: + + upstream/578087-header-strchr.patch: prevent from segfaulting on malformed + messages (Closes: 578087, 578583) + + upstream/603288-split-fetches.patch: split FETCH's into smaller chunks, + workaround for Exchange 2010 (Closes: 603288) + + upstream/537061-dont-recode-saved-attachments.patch: as the patch says, + see the patch for more info (Closes: 537061) + + upstream/608706-fix-spelling-errors.patch: to fix some spelling errors + (Closes: 608706) + + debian-specific/566076-build_doc_adjustments.patch: use w3m to build the + manual (Closes: 566076) + * debian/extra/lib/mailto-mutt: replaced by a wrapper, added the reason to + NEWS.Debian (Closes: 576313) + * debian/extra/rc/compressed-folders.rc: added support for xz-compressed + folders (Closes: 578099) + * debian/*.lintian-overrides: ignore 'binary without manpage' errors due to + the diversions to mutt-org/mutt-patched + + -- Antonio Radici Sun, 02 Jan 2011 21:05:25 +0000 + +mutt (1.5.21-1ubuntu1) natty; urgency=low + + * Merge with Debian experimental (LP: #691512), remaining changes: + + debian/control, debian/patches/debian-specific/build_doc_adjustments.diff: + Use w3m (main) instead of elinks (universe) for generating documentation. + + Drop libtokyocabinet-dev (universe) from Build-Depends, use always + libgdbm-dev and also use gdbm for the header cache backend. (lp: #607448) + + -- أحمد المحمودي (Ahmed El-Mahmoudy) Fri, 17 Dec 2010 14:28:28 +0200 + +mutt (1.5.21-1) experimental; urgency=low + + * New upstream version (Closes: 597487) + * debian/patches: + + refreshed all patches + + removed patches applied upstream + * debian/control: + + Standards-Version bumped to 3.9.1, no change required + + -- Antonio Radici Sun, 03 Oct 2010 22:48:50 +0100 + +mutt (1.5.20-10) experimental; urgency=low + + * debian/patches: features/imap_fast_trash: Make "move to trash folder" use + IMAP COPY, by Paul Miller (jettero). + + -- Christoph Berg Wed, 25 Aug 2010 11:11:43 +0200 + +mutt (1.5.20-9ubuntu2) maverick; urgency=low + + * Drop libtokyocabinet-dev (universe) from Build-Depends, use always + libgdbm-dev and also use gdbm for the header cache backend. (lp: #607448) + + -- Michael Bienia Mon, 19 Jul 2010 22:42:16 +0200 + +mutt (1.5.20-9ubuntu1) maverick; urgency=low + + * Merge with Debian (LP: #588736). Remaining changes: + + debian/control, debian/patches/debian-specific/build_doc_adjustments.diff: + Use w3m (main) instead of elinks (universe) for generating documentation. + + -- أحمد المحمودي (Ahmed El-Mahmoudy) Tue, 22 Jun 2010 17:48:54 +0300 + +mutt (1.5.20-9) unstable; urgency=low + + * hurd-i386 fixes: + + Use libgdbm-dev for this arch until libtokyocabinet-dev is available. + + #define PATH_MAX _POSIX_PATH_MAX. (Fixed in upstream hg, though + differently.) + * /usr/bin/mutt is an alternative now, instead of a diversion in + mutt-patched. + + -- Christoph Berg Sat, 12 Jun 2010 10:33:03 +0200 + +mutt (1.5.20-8) unstable; urgency=low + + * debian/control: + + Flip Maintainer and Uploaders. I'm pretty inactive these days. + + Nuke DM-Upload-Allowed. + * Explicitely use source format 1.0 due to the quilt magic we are using to + built mutt-patched. + * Switch to tokyocabinet (Closes: #530670) + * Instead of trying to maintain the PATCHES file, put "quilt applied" output + there. + * debian/patches: + + Update upstream/228671-pipe-mime.patch: Fix segfaults with ssh tunnels. + Thanks Nikolaus Schulz (Closes: #569279) + + Update upstream/528233-readonly-open.patch: Only chmod saved + attachments, not existing files. (Closes: #572203) + + Add upstream/573823-imap_internal_date: Set internaldate of messages + appended to IMAP mailboxes (Closes: #573823) + + Add upstream/542344-dont_fold_From_: Do not wrap From_ header + (Closes: #542344) + + Update: features/compressed-folders: Remove redundant comment in + /etc/Muttrc. (Closes: #578096) + + -- Christoph Berg Tue, 01 Jun 2010 23:22:26 +0200 + +mutt (1.5.20-7ubuntu1) lucid; urgency=low + + * Merge with Debian testing (lp: #526096). Remaining changes: + + debian/control, debian/patches/debian-specific/build_doc_adjustments.diff: + Use w3m (main) instead of elinks (universe) for generating documentation. + + -- Michael Bienia Mon, 22 Feb 2010 23:56:44 +0100 + +mutt (1.5.20-7) unstable; urgency=low + + * debian/NEWS: backported a note about the new behavior with attachments + on the command line (Closes: 539276) + * debian/patches: + + upstream/548494-swedish-intl.patch: fixes to Swedish translation + (Closes: 548494) + + upstream/553238-german-intl.patch: small fix to the German translation + (Closes: 553238) + + upstream/553321-ansi-escape-segfault.patch: prevent mutt from segfaulting + with large ASCII escape sequences (Closes: 553321) + + upstream/557395-muttrc-crypto.patch: small fix to the muttrc man + (Closes: 557395) + + upstream/545316-header-color.patch: do not store the color in header cache + (Closes: 545316) + + upstream/568295-references.patch: preserve the References header if the + In-Reply-To is not initially present (Closes: 568295) + + upstream/547980-smime_keys-chaining.patch: support certificate chaining in + smime_keys (Closes: 547980, 549006) + + upstream/528233-readonly-open.patch: open attachments in read-only + (Closes: 528233) + + upstream/228671-pipe-mime.patch: don't mess up the terminal while piping + attachments (Closes: 228671) + + upstream/383769-score-match.patch: match full name with ~f, same as + mutt-ng (Closes: 383769) + + upstream/547739-manual-typos.patch: typos in manual.txt (Closes: 547739) + + upstream/311296-rand-mktemp.patch: more random file creation in /tmp, see + CVE CAN-2005-2351 (Closes: 311296) + + debian-specific/Muttrc: set time_inc to be 250ms (Closes: 537746) + * debian/control: + + bumping Standards-Version to 3.8.4, nothing to be done + + adding ${misc:Depends} to make lintian happy + * debian/rules: adding a commented rule to enable tokyocabinet if we want + + -- Antonio Radici Mon, 08 Feb 2010 00:27:55 +0000 + +mutt (1.5.20-6) unstable; urgency=low + + * debian/patches: + + debian-specific/467432-write_bcc.patch: do not write Bcc headers + even if write_bcc is set (Closes: 467432, 546884, 467432) + + -- Antonio Radici Tue, 19 Jan 2010 21:57:48 +0000 + +mutt (1.5.20-5ubuntu1) lucid; urgency=low + + * debian/control, debian/patches/debian-specific/build_doc_adjustments.diff: + use w3m instead of elinks for generating documentation. + + -- Mathias Gug Wed, 20 Jan 2010 18:17:56 -0500 + +mutt (1.5.20-5) unstable; urgency=low + + * debian/patches: + + upstream/533370-pgp-inline.patch: fixing the patch from 1.5.20-3, now + pgp.c is correctly included (Closes: 533370, 558813) + + upstream/537694-segv-imap-headers.patch: fixing a segfault when the IMAP + server sends additional headers and mutt segfaults (Closes: 537694) + + upstream/393926-internal-viewer.patch: revert the patch and add the + auto_view of text/x-diff (Closes: 546760, 549158) + + upstream/548577-gpgme-1.2.patch: do not fail to open pgp signed message + with libgpgme >= 1.2 (Closes: 548577) + + -- Antonio Radici Wed, 02 Dec 2009 22:38:00 +0000 + +mutt (1.5.20-4) unstable; urgency=low + + * Backing out the broken mutt-patched/sidebar-newonly patch + (Closes: 546591, 546592) + + -- Antonio Radici Mon, 14 Sep 2009 18:49:29 +0100 + +mutt (1.5.20-3) unstable; urgency=low + + [ Adeodato Simó ] + * Remove myself from Uploaders. + + [ Antonio Radici ] + * debian/patches: + + features/ifdef: fixed a typo (Closes: 539974) + + features/compressed-folders: removed any reference to DefaultMagic + (Closes: 541360) + + debian-specific/Muttrc: correctly state that exim4 does not strip Bcc: + headers (Closes: 474194) + + upstream/544180-italian-yesorno.patch: fixing a problem in the italian + translation of a multichoice string (Closes: 544180) + + upstream/543467-thread-segfault.patch: patch to prevent mutt from + segfaulting when Ctrl+R is hit on malformed messages (Closes: 543467) + + upstream/393926-internal-viewer.patch: display any text/* part with the + internal viewer (Closes: 393926) + + upstream/538128-mh-folder-access.patch: MH dirs are now correctly + parsed (Closes: 538128) + + upstream/537818-emptycharset.patch: handling empty charsets without + segfaulting (Closes: 537818) + + upstream/535096-pop-port.patch: allow a user to specify a port for a pop + connection, as it was before 1.5.20 (Closes: 535096) + + upstream/542910-search-segfault.patch: fixes a bug in search which caused + a segfault (Closes: 542910) + + upstream/533370-pgp-inline.patch: inline pgp messages now displayed + correctly even if pgp_auto_decode is set (Closes: 533370) + + upstream/533520-signature-highlight.patch: fixed a problem in signature + hightlighting if text_flowed was set to 'yes' (Closes: 533520) + + upstream/542817-smimekeys-tmpdir.patch: smime_keys.pl will skip tmpdir + if it contains '=' (Closes: 542817) + + upstream/544794-smtp-batch.patch: mutt won't ask for a password if + smtp_user and smtp_pass are set in .muttrc (Closes: 544794) + + mutt-patched/sidebar-newonly: integrating Steve Kemp's patch to optionally + select folders with new mails only (Closes: 532510) + * debian/control: + + Standards-Version bumped to 3.8.3 + * debian/extra/lib/mailto-mutt: patch from madduck@ to correctly handle the + way mutt is parsing the command line now (Closes: 545876) + + [ Christoph Berg ] + * Recommend default-mta instead of exim4 (Closes: 533442) + * Remove redudant hard-coded libgpgme11 from Recommends. + + -- Antonio Radici Sun, 13 Sep 2009 18:34:48 +0100 + +mutt (1.5.20-2) unstable; urgency=low + + [ Antonio Radici ] + * debian/patches/series: + + upstream/533209-mutt_perror.patch: better error reporting if a mailbox + cannot be opened (Closes: 533209) + + upstream/533459-unmailboxes.patch: fixes a segfault with the unmailboxes + command (Closes: 533459) + + upstream/533439-mbox-time.patch: do not corrupt the atime/mtime of + mboxes when opened (Closes: 533439) + + upstream/531430-imapuser.patch: ask the user for the right information + while logging in on IMAP servers (Closes: 531430) + + upstream/534543-imap-port.patch: correctly parse the port in an IMAP + url (Closes: 534543) + + added the right copyright misc/smime_keys-manpage.patch + + mutt-patched/sidebar: refreshed + + mutt-patched/sidebar-{dotted,sorted} added (Closes: 523774) + * debian/control: + + Debian policy bumped to 3.8.2 + * debian/mutt.install and debian/extra/lib/mailto-mutt: + + added the firefox mailto handler (Closes: 406850) + + [ Christoph Berg ] + * Remove maildir-mtime patch, upstream has a different implementation + (though with different results; Closes: 533471) + * Use elinks-lite (with an alternative Build-Dependency on elinks) for + rendering the manual. Thanks to Ahmed El-Mahmoudy for the suggestion. + (Closes: 533445) + + -- Christoph Berg Sat, 20 Jun 2009 15:00:50 +0200 + +mutt (1.5.20-1) unstable; urgency=low + + * New upstream release, includes the following features: + + Bounced messages contains From: headers (Closes: 93268) + + Attachments displayed based on Content-Disposition (Closes: 199709) + + fcc to a mailbox does not raise the 'new' flag (Closes: 209390) + + '!' supported as suffix in gpg keys (Closes: 277945) + + failed attachment saving shows an error message (Closes: 292350) + + inline signed messages sent honouring $send_charset (Closes: 307819) + + support for and in the pager (Closes: 436007) + + fcc_attach is a quad option (Closes: 478861) + + Content-Description header not included in reply (Closes: 500766) + + imap_sync_mailbox fix for a segfault (Closes: 516364) + + better threading support with particular Message-ID's (Closes: 520735) + + no crash on IMAP folder refresh (Closes: 528465) + + undisclosed-recipients not passed in the envelope (Closes: 529090) + * debian/patches/series: + + commented all references to upstream/*, they should be included in 1.5.20 + + removed debian-specific/529838-gnutls-autoconf.patch, ditto + + removed misc/manpage-typos.patch, ditto + + modified misc/hyphen-as-minus.patch, a big part was integrated upstream + + features/trash-folder: do not reupload messages to $trash if IMAP is used + (Closes: #448241) + + added misc/hg.pmdef.debugtime, see upstream #3263 + * debian/control: added DM-Upload-Allowed: yes + + -- Antonio Radici Sun, 14 Jun 2009 20:53:18 +0100 + +mutt (1.5.19-4) unstable; urgency=low + + * debian/rules: + + disable tokyocabinet as backend so it won't be used (Closes: 530670) + + enable gpgme support (Closes: 263443) + * debian/control: + + added pkg-config to Build-Depends + + add libgpgme11-dev to Build-Depends and libgpgme11 to Depends + * patches/debian-specific/529838-gnutls-autoconf.patch: + + pkg-config to detect gnutls rather than libgnutls-config (Closes: 529838) + * patches/upstream/530661-mandatory-doubledash.patch + + document the mandatory usage of -- with the -a option (Closes: 530661) + * patches/features/sensible_browser_position + + mutt does not segfault when the last mailbox is removed (Closes: 439387) + * patches/upstream/375530-index-weirdness.patch + + fix index weirdness if mailbox is emptied (Closes: 375530) + * patches/upstream/493719-segfault-imap-close.patch + + IMAP: only close socket when not already disconnected (Closes: 493719) + * patches/upstream/514960-certificate-insecure-algorithm.patch + + allow certs generated with insecure algorithms if they are in cache + (Closes: 514960) + * patches/misc/manpage-typos.patch + + fixes some typos in the manpage (Closes: 428017) + * patches/upstream/524420-segfault-reconnect-sasl.patch + + sasl, mutt segfaults on reconnect to IMAPS server (Closes: 524420) + * patches/upstream/350957-postponed-to-bcc.patch + + display bcc for postponed message if there is no To (Closes: 350957) + * patches/upstream/502628-attach_charset-doc.patch + + doc update: clarify what attach_charset does (Closes: 502628) + * patches/upstream/504530-stunnel-account_hook-doc.patch + + doc update: mention account-hook in the docs for $tunnel (Closes: 504530) + * patches/upstream/530887-dovecot-imap.patch + + fixes two problems with subdirs on dovecot (Closes: 530671, 530887) + + -- Antonio Radici Tue, 26 May 2009 23:42:51 +0100 + +mutt (1.5.19-3) unstable; urgency=low + + * debian/control: + + Xs- removed from VCS headers + + removed a duplicate "priority" in the binary package + + Section: debug for mutt-dbg + + debhelper dependency updated to support dh_lintian + + Standards-Version bumped to 3.8.1 + + widened mutt-dbg extended description + * debian/compat: bumped to 7 + * debian/patches + + added a small description to all patches missing it + + the following patches were refreshed against upstream/1.5.19: + * features/{ifdef,maildir-mtime,xtitles,trash-folder,purge-message} + * features-old/patch-1.5.4.vk.pgp_verbose_mime + * debian-specific/{Md.etc_mailname_gethostbyname.diff + debian/specific/{correct_docdir_in_manpage.diff,assumed_charset-compat} + * mutt-patched/* + + mutt-patched/sidebar: added the new sidebar patch for 1.5.19 + + misc/hyphen-as-minus: sub hyphen with minus in the mutt manpages + to make lintian happy + + misc/smime_keys-manpage.patch: add a missing manpage (Closes: 528672) + * debian/rules + + re-enabled building of mutt-patched for 1.5.19 + + replacing the deprecated "dh_clean -k" with dh_prep + * debian/mutt-patched.lintian-overrides: mutt can be w/out manpage + * debian/mutt.lintian-overrides: excluding arch-dep-package-has-big-usr-share + because there are many locales + * debian/mutt.preinst: added "set -e" to abort if there are errors + * debian/clean: remove aclocal.m4 it will not appear in the .diff.gz + + -- Antonio Radici Sun, 24 May 2009 17:24:18 +0100 + +mutt (1.5.19-2) experimental; urgency=low + + * Recommends: libsasl2-modules. Technically, we depend on libsasl2-2 which + already recommends this package, but not having it installed just confuses + too many users. + * Use upstream's smime.rc file, hereby fixing S/MIME encryption. + (Closes: #315319) + * Grab two patches from upstream that should also go into lenny: + + Always sort inode list for accessing header cache. (Closes: #508988) + + Delete partially downloaded files in message cache. (Closes: #500016) + * Add Antonio Radici to Uploaders. Thanks for the BTS triaging! + + -- Christoph Berg Thu, 05 Feb 2009 23:26:41 +0100 + +mutt (1.5.19-1) experimental; urgency=low + + * New upstream version. + + Header weeding changed in default config; now we ignore * and unignore + from: subject to cc date x-mailer x-url user-agent. (Mutt: #286) + + $move now defaults to "no" instead of "ask-no". + * Upstream dropped changelog.old, so do we. + * Temporarily disable building mutt-patched until an updated sidebar patch + is available. + + -- Christoph Berg Thu, 15 Jan 2009 23:47:29 +0100 + +mutt (1.5.18-4) unstable; urgency=low + + * In order to evade a conflict with the sidebar patch, move the set_xterm_* + prototypes from pager.c to mutt_menu.h. No functional change. + * Introduce two new patches that revert the conflicting part of the + maildir-mtime patch before applying the sidebar patch, and afterwards + re-apply the relevant bits. This mitigates the chance of bugs being + introduced when manually resolving conflicts with new versions of the + sidebar patch. This fixes new mail detection in the mutt-patched package. + (Closes: #484537, #484538) + + -- Christoph Berg Sun, 03 Aug 2008 00:51:58 +0200 + +mutt (1.5.18-3) unstable; urgency=low + + * Pull patch from upstream to fix multipart decoding. (Closes: #489283) + * Add example sidebar config, thanks Stefano Zacchiroli. (Closes: #460452) + * (Finally) compile with native Kerberos GSSAPI support. (Closes: #469483) + * Add a switch in debian/rules to make building mutt-patched configurable. + + -- Christoph Berg Sun, 20 Jul 2008 01:35:03 +0200 + +mutt (1.5.18-2) unstable; urgency=low + + * Updated sidebar patch, does not display (NULL) anymore. (Closes: #483151) + * Install reportbug script to inform us about the status of installed + mutt packages. + * Use dh_lintian (prefix with '-' so we do not need to bump the DH level). + * Register mutt as message/rfc822 application in /etc/mailcap. + (Closes: #474539) + * Refresh some patches to get rid of -p0 in series file. + * Bump Standards-Version; add debian/README.source. + * Switch Maintainer and Uploader as suggested by Dato. + + -- Christoph Berg Thu, 12 Jun 2008 23:53:46 +0200 + +mutt (1.5.18-1) unstable; urgency=low + + * New upstream version. + + Query menu format is configurable. (Closes: #66096, Mutt: #170) + + Quote attachment filenames starting with '='. + (Closes: #351890, Mutt: #1719) + + Mention that References: and Date: cannot be changed in editor. + (Closes: #191850, Mutt: #1234). + * Refreshing patches from upstream: + + compressed-folders. + + sidebar. (Closes: #470657) + * Update doc-base section. + + -- Christoph Berg Sat, 24 May 2008 19:36:44 +0200 + +mutt (1.5.17+20080114-1) unstable; urgency=low + + * New upstream snapshot (hg 130aa0517251), and this time build a proper + orig.tar.gz tarball. + + Fixes message corruption/duplication. (Closes: #459739) + + -- Christoph Berg Mon, 14 Jan 2008 23:26:14 +0100 + +mutt (1.5.17-2) unstable; urgency=low + + * Build a mutt-patched package to apply the sidebar patch. Thanks to Dato + who had the right idea for the necessary debian/rules magic during the + recent debian-qa meeting in Extremadura. (Closes: #277637) + * Build a mutt-dbg package, and bump DH level to 5. + * Grab current hg tip from upstream (68a9c3e74f9a). + + Fixes "mailto:" URL parsing. + (Closes: #426148, #426158, #446016, Mutt: #2968, #2980) + + 'set folder= =' won't segfault. (Closes: #448728) + + Improve DSN docs. (Closes: #436228) + * Bump Standards-Version, add Homepage field. + + -- Christoph Berg Tue, 01 Jan 2008 20:00:33 +0100 + +mutt (1.5.17-1) unstable; urgency=low + + [ Adeodato Simó ] + * Move the packaging back to Bazaar, adjust X-VCS-* accordingly. + + [ Christoph Berg ] + * Mention libsasl2-modules-gssapi-mit in README.Debian. (Closes: #433425) + * Call autoreconf at build time, drop the autotools-update patch. + * Update menu file, add lintian override file. + * Refresh patches. + + * New upstream version: + + fix segfaults with single byte 8-bit characters in index_format. + (Closes: #420598, Mutt: #2882) + + properly render subject headers with encoded linefeeds. + (Closes: #264014, Mutt: #1810) + + only calls gnutls_error_is_fatal when gnutls_record_recv returns a + negative value. (Closes: #439775, Mutt: #2954) + + Large file support for mutt_pretty_size(). + (Closes: #352478, #416555, Mutt: #2191) + + Do not consider empty pipes for filtering in format strings. + (Closes: #447340) + + -- Christoph Berg Sat, 03 Nov 2007 23:00:04 +0100 + +mutt (1.5.16-3) unstable; urgency=medium + + * Fix the maildir-mtime patch change in 1.5.14+cvs20070403-1 that broke + new mail message count in IMAP folders. (Closes: #421468, #428734, #433275) + + -- Adeodato Simó Thu, 19 Jul 2007 23:41:02 +0200 + +mutt (1.5.16-2) unstable; urgency=low + + * Finally a new unstable version :) + * Disable gpgme backend again, it needs two "optional" libs we do not want + to pull into "standard" now, and it is still somewhat buggy. + Reopens: #263443. + * Use gdbm instead of bdb for the cache files. + * Enable sensible_browser_position patch. + + -- Christoph Berg Thu, 28 Jun 2007 21:58:47 +0200 + +mutt (1.5.16-1) experimental; urgency=low + + * New upstream version. + * compressed-folders: grab updated patch, thanks Roland. + + -- Christoph Berg Thu, 14 Jun 2007 10:54:56 +0200 + +mutt (1.5.15+20070608-1) experimental; urgency=low + + * Muttrc.head: Temporarily set pipe_decode in the \cb urlview macro. + Closes: #423640. + * Apply patch by pywatson@gmail.com to strdup strings when sorting. + Mutt: #2515, Closes: #196545. + + -- Christoph Berg Fri, 08 Jun 2007 11:19:08 +0200 + +mutt (1.5.15+20070515-1) experimental; urgency=low + + * New snapshot. + + Removed hardcoded pager progress indicator and add %P format code to + $pager_status which contains the same information. + Mutt: #2087, Closes: #259145. + * $smime_verify_opaque_command: fallback to -noverify. + Mutt: #2428, Closes: #420014. + + -- Christoph Berg Thu, 17 May 2007 14:15:48 +0200 + +mutt (1.5.15+20070412-1) experimental; urgency=low + + * New snapshot: + + Avoid altering the argument to mutt_complete() when completion fails. + Mutt: #2871, Closes: #367405 + + Allow reply-hook to use ~h when replying from the index. + Mutt: #2866, Closes: #362919 + + Exit with a nonzero value if sending a message in batch mode fails. + Mutt: #2709, Closes: #273137 + + Make mutt more posixly-correct. Mutt: #1615, Closes: #204904 + + -- Christoph Berg Thu, 12 Apr 2007 17:04:05 +0000 + +mutt (1.5.14+cvs20070403-1) experimental; urgency=low + + * set ssl_ca_certificates_file="/etc/ssl/certs/ca-certificates.crt". + * Use /etc/ssl/certs/ca-certificates.crt as smime_ca_location if there is + none in ~/.smime/ (Closes: #255653). + * New snapshot: + + Make mutt_edit_file display error if editor return is non-zero + (Closes: #209244). + + Use ~/.muttrc as the default alias_file if no user muttrc exists + (Closes: #226500). + + Reset list.name before each list response in folder browser + (Mutt: #2444, Closes: #377783). + + Fix segfault when trying to read header cache if cwd does not exist + (Mutt: #2714, Closes: #387560). + + Make message cache write to temporary location until file is complete + (Closes: #394383). + + Use RECENT for first mailbox check if header cache check fails + (Closes: #372512). + * Patches: + + maildir-mtime: refreshed. + + -- Christoph Berg Tue, 3 Apr 2007 20:54:35 +0200 + +mutt (1.5.14+cvs20070321-1) experimental; urgency=low + + * Move source package to http://hg.debian.org/hg/pkg-mutt/debian-mutt. + * debian/control: Add XS-Vcs fields. + * New snapshot: + + More space for the "help" string (Closes: #415277). + + --buffy-size is a config option, $check_mbox_size (Closes: #379472). + * Patches: + + gpg.rc: upstream ships without absolute paths, our patch is much simpler + now. + + compressed-folders: refreshed. + * Mention /etc/Muttrc defaults in documentation (Closes: #388667). + * debian-ldap-query: Support middle names (Closes: #415653). + + -- Christoph Berg Wed, 21 Mar 2007 21:54:08 +0100 + +mutt (1.5.14+cvs20070315-1) experimental; urgency=low + + * New upstream snapshot (now from mercurial). + + send_charset supports charset-hook'd charsets (Closes: #152444). + + Regex for color patterns can be > 256 chars long (Closes: #229801). + + Reduces massive strcat use (Closes: #290701). + + Uses realpath of folders in the cache (Closes: #298121). + + Wraps help correctly on utf-8 terminals (Closes: #328921). + + Fixes typos in muttrc.5 (Closes: #366413). + + Requery IMAP capabilities after login (Closes: #384076). + + Various mutt.1 updates (Closes: #332803, #355912, #366413, #394256). + + The key binding documentation is now auto-generated, thereby documenting + some missing functions (Closes: #413144). + + Previously fixed: IMAP hangs (Closes: #413715). + * Split up Muttrc into separate files in /etc/Muttrc.d/. + * charset.rc: iconv-hooks for some commonly misused charsets + (Closes: #402027). + * Add compatibility alias file_charset for attach_charset (got renamed when + the assumed-charset patch went upstream). + * Patches: + + compressed-folders: synced with upstream. + + compressed-folders.ranty-fix: removed, went upstream. + * Packaging: + + Use quilt.make. + + Move patchlist sorting into patchlist.sh. + + -- Christoph Berg Thu, 15 Mar 2007 14:11:31 +0100 + +mutt (1.5.14+cvs20070301-1) experimental; urgency=low + + * New upstream snapshot. Hilights: + + Now features ESMTP support, yay! + + PKA support via gpgme. + + Ability to save history. + * Enable gpgme backend (Closes: #263443). + * Move mail-transport-agent from Depends to Recommends (Closes: #356297). + * /etc/Muttrc: + + Do not unset write_bcc (Closes: #304718). + + Do not unset use_from and use_domain (Closes: #283311, #398699). + + Add quotes for compressed folder hooks (Closes: #238034), + + mime_lookup application/octet-stream. + * Patches: + + assumed-charset: removed, applied upstream. + + xtitles: Removed a comment on the default of xterm_set_titles (mentioned + in #366413). + * colors.angdraug: Fix spelling (Closes: #295241). + * gpg.rc: add full path for pgpewrap (Closes: #396207). + * Update copyright holders. + + -- Christoph Berg Thu, 1 Mar 2007 22:48:53 +0100 + +mutt (1.5.13+cvs20070215-1) experimental; urgency=low + + * Update to a CVS snapshot: + Closes: #47284: newlines/spaces are removed from custom multiple header + lines + Closes: #397858: /usr/bin/mutt_dotlock: off-by-one error in mutt_dotlock.c + Closes: #400831: logic error in mutt-1.5.13/account.c + Closes: #404916: sort-mailbox by spam tag score sorting strangeness + Closes: #410678: crash when IMAP server skips messages during a FETCH + without a cast. + + * Patches: + + Reshuffle patches to move autotools-needing/updating to front. + + compressed-folders: refreshed. + + autotools-update: updated. + + tempfile-race, thread_pattern_in_UPDATING: removed, included upstream. + + New patches: + + ifdef: test for presence of features, patch by Cedric Duval. + + trash-folder, purge-message: trash folder support, also by Cedric Duval + (Closes: #263204). + + Patches shipped but not applied by default: + + chdir: change working directory. + + indexcolor: color index colums. + + w3mface: display X-Face headers using w3mimgdisplay. + + * Create /etc/Muttrc.d/ (Closes: #391961). + * Make sure reldate.h is found while building the docs. + + -- Christoph Berg Fri, 16 Feb 2007 02:04:35 +0100 + +mutt (1.5.13-2) experimental; urgency=low + + * Adding myself as uploader, thanks Dato. + * debian/rules: + + Actually support DEB_BUILD_OPTIONS=noopt. + + Do not touch stamp-h.in, touch PATCHES in clean. + * Patches: + + Moved xtitles to features/ and fixed a segfault (Closes: #365683). + + -- Christoph Berg Mon, 12 Feb 2007 18:37:44 +0100 + +mutt (1.5.13-1.1etch1) stable; urgency=low + + * Stable update. + * Grab patch from upstream: + Add imap_close_connection to fully reset IMAP state (Closes: #413715). + * Add myself to Uploaders, thanks Dato. + + -- Christoph Berg Tue, 15 May 2007 09:59:24 +0200 + +mutt (1.5.13-1.1) unstable; urgency=high + + * Non-maintainer upload. + * Add upstream patch to fix insecure temp file generation + (Closes: #396104, CVE-2006-5297, CVE-2006-5298). + + -- Christoph Berg Tue, 12 Dec 2006 14:49:24 +0100 + +mutt (1.5.13-1) unstable; urgency=low + + * New upstream release, with a new pattern to match full threads (see + NEWS.gz). + + -- Adeodato Simó Wed, 16 Aug 2006 15:22:53 +0200 + +mutt (1.5.12-1) unstable; urgency=low + + * New upstream release. Ship upstream's UPDATING file as NEWS.gz in + /usr/share/doc/mutt. + + -- Adeodato Simó Sat, 15 Jul 2006 02:49:50 +0200 + +mutt (1.5.11+cvs20060403-2) unstable; urgency=high + + * Fix CVE-2006-3242, stack-based buffer overflow when processing an overly + long namespace from the IMAP server. (Closes: #375828) + + -- Adeodato Simó Fri, 7 Jul 2006 15:01:28 +0200 + +mutt (1.5.11+cvs20060403-1) unstable; urgency=low + + * Update to CVS 2006-04-03, which finally: + + fixes segfault when changing to an IMAP folder and the mailbox name + is implicitly INBOX. (Closes: #351337, #353550) + + -- Adeodato Simó Tue, 4 Apr 2006 06:10:12 +0200 + +mutt (1.5.11+cvs20060330-1) unstable; urgency=low + + * Update to CVS 2006-03-30, which fixes the following bugs: + + IMAP cache works again with Courier. (Closes: #351220) + + does not segfault if external query command output contains spaces. + (Closes: #351258) + + does not segfault when replying from the view-attachments menu when a + reply-hook is in use. (Closes: #352357) + + default save location for attachments which specify a path in their name + is not `dirname $attachment` anymore, but $CWD. (Closes: #301236) + + * Switch to libdb4.4. (Closes: #355433) + + -- Adeodato Simó Mon, 3 Apr 2006 02:41:15 +0200 + +mutt (1.5.11+cvs20060126-2) unstable; urgency=medium + + * Make imap_idle default to off, since it does not work with dovecot from + stable, which a lot of people use; upstream will make this change before + 1.5.12. (Closes: #351263, #354902) + + * Ignore DKIM-Signature by default in /etc/Muttrc. (Closes: #354907) + + -- Adeodato Simó Thu, 2 Mar 2006 22:42:34 +0100 + +mutt (1.5.11+cvs20060126-1) unstable; urgency=low + + * Update to CVS 2006-01-26; since this includes a huge diff between + ChangeLog and ChangeLog.old (moved entries), prepare a new tarball. + Some worth-mentioning changes: + + + Mutt can now expand its own variables as it does with envvars; for + example, it's now possible to put something like this into a hook: + set sendmail="mysmtp -f $from". + + + Support for user-defined variables starting with my_; environment + variables take precedence, and expansion does not occur in shell-escape. + + + Pattern group support, as explained (only!) in: + + + + Loooots of improvments in the IMAP code, including sync speed-ups + (through pipelining), hcache stuff (eg. $imap_cachedir), and things + like $imap_idle and support for the "old" flag in IMAP folders. + + * Rework the package build system to fit personal preference: + + debhelperize debian/rules a bit more. + + drop dbs in favor of quilt; reorganize patches a bit. + + (NOTE: quilt means that dropping patches into debian/patches is + no longer enough to get them applied; they must be listed in the + debian/patches/series file.) + + * Adjustments to debian/control: + + use '*' for the bulleted list, instead of 'o'. + + build-depend on gawk instead of mawk, to have "nextfile". + + drop conflicts and replaces on packages that are not in woody. + + * Updated debian/copyright. + + * Added debian/watch. + + -- Adeodato Simó Thu, 2 Feb 2006 05:12:18 +0100 + +mutt (1.5.11-5) unstable; urgency=medium + + * Unbreak Mutt in Turkish locales (tr_TR): include patch from CVS to use the + proper strcmp function in several places. Upstream bug #2144, reported in + both BTS by Recai Oktas. (Closes: #343655) + + * Apply patch from Nik A. Melchior to fix formatting problem in muttrc(5). + (Closes: #343030) + + -- Adeodato Simó Fri, 23 Dec 2005 23:18:44 +0100 + +mutt (1.5.11-4) unstable; urgency=low + + * Update to CVS 2005-11-24 to fix the following bug (yay): + + + does not fail to open messages that contain base64-encoded inline PGP + bits (signature, encrypted hunk, or a key). (Closes: #340116) + + Also, do not report success to decrypt an inline PGP message when + decryption actually failed. + + * Again, update my e-mail address in debian/control, yada yada. + + -- Adeodato Simó Fri, 25 Nov 2005 02:50:20 +0100 + +mutt (1.5.11-3) unstable; urgency=low + + * Update to CVS 2005-11-01, with the following worth-of-mentioning goodies + (among others): + + + full read/write >2 GB mbox support. + + attachment counting patch merged upstream (%X in index_format); check + the "Attachment Searching and Counting" section in the manual for more + information. + + And the following bugs are fixed as well: + + + S/MIME keys can be selected from the menu. (Closes: #318470) + + clarified description of pop_checkinterval. (Closes: #320642) + + * Update my e-mail address in debian/control. + + -- Adeodato Simó Fri, 11 Nov 2005 02:16:11 +0100 + +mutt (1.5.11-2) unstable; urgency=low (but fixes critical bug not in testing) + + * The fix for coping with mboxes bigger than 2 GB introduced a bug affecting + at least powerpc (but not i386) which made mutt write Content-Length: 0 in + mboxes due to a un-updated %ld format specifier. This caused for mail to + be lost in the next mbox write. + + Apply a patch quickly provided by upstream (thanks, Brendan Cully!) that + makes mutt use the right format specifier. (Closes: #330474) + + * Update the compressed folders to the 1.5.11, which includes documentation + in XML format. + + -- Adeodato Simó Fri, 30 Sep 2005 01:15:28 +0200 + +mutt (1.5.11-1) unstable; urgency=low + + * New upstream release, fixing the following bugs: + + + ~h can match folded headers. (Closes: #319654) + + implements progress indication when uploading messages to an imap + folder. (Closes: #228713) + + limit pattern is properly displayed when zero messages matched. + (Closes: #242398) + + A further CVS pull (2005-09-24) fixes the following bugs: + + + can open mboxes bigger than 2 GB. (Closes: #296940) + + does not require GPG_TTY to be set in order to accept using the GnuPG + agent: it'll set the variable itself if not present. (Closes: #316388) + + does not segfault when replying to a message if content_type is unset. + (Closes: #329306) + + does not segfault with IMAP folder completion. (Closes: #329442) + + Packaging changes needed: + + + Upstream documentation now comes in XML, so changed Build-Dependency on + linuxdoc-tools-text and groff to xsltproc, docbook-xml, docbook-xsl and + links. Added patch debian/patches/doc_build_adjustments.diff to force + the use of links instead of lynx for generating the text version of the + manual, and to not ignore errors from links and xsltproc. + + + Changed --with-sasl2 to its new name --with-sasl in debian/rules; + removed extra hunk on debian/patches/patch-1.5.4.Md.sasl2-1arc. + + + Rediffed 080_Md.Muttrc, removed patch.asp.fix-bug-266493.1 (applied + upstream). + + + Temporarily removed documentation from the compressed-folders patch, + until upstream reacts to the move to XML. + + * Build against libgnutls12 (build-depend on libgnutls-dev instead of + libgnutls11-dev). (Closes: #323279) + + * Remove spurious dash in argument to -encrypt in smime_encrypt_command. + (Closes: #315319) + + -- Adeodato Simó Sun, 25 Sep 2005 23:11:59 +0200 + +mutt (1.5.10-1) unstable; urgency=low + + * New upstream release, fixing the following bugs: + + does not store gpg passphrase when signing or decrypting has failed, + since that probably means it was wrong. (Closes: #132548) + + does not fail to delete attachments in unencrypted mails. (Closes: + #302500) + + * New functionality overview or otherwise noticeable news: + + $imap_check_subscribed variable to add the list of subscribed folders to + the buffy list. + + $braille_friendly variable to make Mutt more usable for blind users. + + $imap_login variable in case the login name on the IMAP server is + different to the name of the account ($imap_user). + + -D command line option to dump current configuration, after all + initialization files have been read. + + $imap_force_ssl gone. + + an empty limit is now interpreted as a request to cancel the current + limit. + + * Patches: + + 080_Md.paths_mutt.man: adjusted; upstream build system puts now the + right paths in mutt.1 using @bindir@. Install mutt.1 instead of mutt.man + in debian/rules. + + 080_Md.Muttrc: don't set menu_move_off in /etc/Muttrc since the + compile-time default is now what we want (pre-1.5.7 compatible). + + edit-threads, current-shortcut, incomplete-mbyte: removed, integrated + upstream. + + maildir-mtime: s/if/ifdef/ to get it to apply. + + compressed-folders: updated to 1.5.10. + + * Upstream now builds "complete" documentation, i.e., for all features + whether enabled or not. Disable that for Debian. [patch.docs-match-config.h] + + * Build-Depend on autotools-dev and use updated config.{guess,sub} at build + time to fix FTBFS on GNU/kFreeBSD. (Closes: #302735) + + * Update Standards-Version to 3.6.2 (no changes required). + + * Set myself as the maintainer, and remove Marco from Uploaders as agreed + with him. + + -- Adeodato Simó Mon, 15 Aug 2005 15:51:55 +0200 + +mutt (1.5.9-2sarge2) stable-security; urgency=high + + * Fix buffer overflow in IMAP parsing code + + -- Moritz Muehlenhoff Wed, 28 Jun 2006 17:12:05 +0000 + +mutt (1.5.9-2sarge1) stable; urgency=low + + * For attachments marked for deletion after the message is sent, don't + remove them if the message is finally cancelled, or if the attachments + are dropped from the message prior to sending. (Closes: #332972) + + -- Adeodato Simó Tue, 31 Jan 2006 01:23:28 +0100 + +mutt (1.5.9-2) unstable; urgency=high + + * Added a missing Build-Depend on mawk. (Closes: #310039) + * Updated the Swedish translation. + + -- Adeodato Simó Sun, 22 May 2005 17:29:25 +0200 + +mutt (1.5.9-1) unstable; urgency=medium + + * New upstream release, though the previous upload already included most of + it because of the CVS pull. Do another one now (2005-04-03), including the + following bits from 1.5.10: + + several translation updates (de, id, nl, pl, ru). + + a patch by Daniel Jacobowitz to synchronise message flags before moving + messages. (Closes: #163616) + + * Also, the header cache patch is now fully integrated upstream, so drop it. + + * Don't set pipe_default in debian/patches/080_Md.Muttrc, and stick to + upstream's default (unset). (Closes: #300830) + + * Updated the compressed folders patch to version 1.5.9. + + * Updated patch 080_Md.Muttrc to restore the old behaviour of the index. + + -- Adeodato Simó Sun, 03 Apr 2005 20:08:39 +0200 + +mutt (1.5.8-1) unstable; urgency=low + + * New upstream release, with a CVS pull to get all the translation updates + that happen right after a release. New features worth mentioning: + + the PGP auto decode patch by Derek Martin has been accepted upstream, + so inline PGP messages are automatically verified/decrypted now if + $pgp_auto_decode is set. (Closes: #269699) + + IDN decoding can be disabled by unseting $use_idn (set by default). + + new hook 'send2-hook', which gets executed each time there is a change + in a message being composed. This permits, for example, to match against + recipients added manually after writing the mail, which wasn't possible + with 'send-hook' alone. + + Christoph Berg's menu_context patch is also included. Check the + $menu_context and $menu_move_off variables. + + * This version also includes the following fixes: + + message flags are not lost after editing a message. (Closes: #275060) + + IMAP folder paths ending with the delimiter are trimmed so that they + don't fail to open with some servers, e.g. Courier. (Closes: #277665) + + the correct charset is used when signing a forwarded message. + (Closes: #295528) + + correctly forget the S/MIME passphrase. (Closes: #300516) + + * Explicitly pass --enable-inodesort to ./configure, since upstream has + disabled it by default in this version. + + * Updated the compressed folders patch to version 1.5.8. + + * Dropped the adjust_line and adjust_edited_file patches from + extra-patches/mutt-ja-compat, incorporated upstream. Renamed + mutt-ja-compat to assumed-charset, since that's the only patch that + remains. + + * Lots of patches in the Debian package have been applied upstream, drop + them (16 in total). Worth mentioning is the gnutls patch. The + maildir_inode_sort patch has been adopted too, with the static functions + no longer being nested, which closes: #287744 (FTBFS with gcc-4.0). + + * Implemented a conf.d style directory for mutt: other packages or local + admins may now drop configuration snippets in /etc/Muttrc.d/*.rc and have + them sourced at the end of the default Muttrc. (Closes: #285574) + + * Updated the header cache patch to version 28. The size of this patch has + been drastically reduced, since the generic code and the IMAP support has + been incorporated upstream. + + * Updated the compressed folders patch to version 1.5.8. + + * Use mixmaster-filter by default. (Closes: #299060) + + -- Adeodato Simó Fri, 25 Mar 2005 21:55:52 +0100 + +mutt (1.5.6-20040907+3) unstable; urgency=high + + * Upload targeted at sarge to include some must-have fixes. + + * Include small patch to fix imap-related segfaults in ia64, due to a buffer + length being declared as int instead of size_t in the gnutls patch. Thanks + to David Mosberger for spotting the problem. (Closes: #234783, #285001) + [New file: upstream/extra-patches/gnutls.59.size_t-fix] + + * Include (finally!) a patch that really prevents decrypt-save from deleting + the message if the supplied password was wrong. (Closes: #275188) + [New file: upstream/patches/decrypt-save_non-empty-output] + + * Updated the header-cache patch to version 25, which includes a fix to make + it possible for hcache to talk to broken Lotus IMAP servers. (Closes: #282451) + [Modified file: upstream/extra-patches/header-cache] + + * The mutt BTS has been closed due to excessive spam in their debbugs + installation. Included the patch that substitutes flea and flea.1 by a + note that states so. + [New file: upstream/patches/empty-muttbug, + removed file: debian/patches/080_Md.muttbug] + + * Removed /usr/share/bug/mutt/presubj, now useless. + + * Added Domainkey-Signature to the list of ignored headers. + [Modified file: debian/patches/080_Md.Muttrc] + + -- Adeodato Simó Fri, 28 Jan 2005 19:02:58 +0100 + +mutt (1.5.6-20040907+2) unstable; urgency=medium + + * A "Let's procrastinate some important stuff and fix a bunch of mutt bugs + instead" release. + + * Include small patch to fix the Swedish translation, which was making + impossible to turn off pgp signing and/or encrypting. (Closes: #281265) + [New file: upstream/patches/i18n-sv-fix.diff] + + * Make the default Muttrc work out the box for people using gnupg-agent. + Wrote and applied a one-line patch to make the %?p? conditional escape + work correctly, patch forwarded upstream. (Closes: #277646) + [New file: debian/patches/patch.asp.%p-escape-agent-compatible.1] + + * Relocate the definition of the USE_GNUTLS macro, so that it gets passed to + the documentation build process too. Otherwise, options that end up in the + manual wouldn't match those that are really compiled in. (Closes: #278124) + [Modified files: debian/rules, upstream/extra-patches/gnutls.debian] + + * Honour /etc/alternatives/pager in the muttbug script. (Closes: #275448) + [Modified file: debian/patches/080_Md.muttbug] + + * Include patch by Nicolas François to + fix typo in muttrc.5. (Closes: #272579) + [New file: debian/patches/patch.nf.fix-bug-272579.1] + + * Updated the (formerly unmaintained) current-shortcut patch with a new + version by Christoph Berg . Now the actual used Fcc will be + shown instead of '^' when you folder-hook . 'set record="^"'. + [Modified file: upstream/extra-patches/current-shortcut] + + * Updated the header-cache patch to version 24. + + -- Adeodato Simó Wed, 17 Nov 2004 15:17:14 +0100 + +mutt (1.5.6-20040907+1) unstable; urgency=low + + * Updated to CVS snapshot 20040907 (includes updated ja translation). + + * The maildir-mtime patch is now NOT enabled by default, you need to set the + maildir_mtime variable in your ~/.muttrc. This variable has been necessary + since people with large maildirs over NFS experienced a large performance + impact with the mtime patch enabled. (Closes: #253261) + + * Updated the header cache patch to version 21. This fixes a file descriptor + leak which could cause problems for people who keep their mutt open for a + long time. Also includes support for per-folder cache: setting $header_cache + to a directory will enable it, and you should experience some performance + gains. + + * Included the current shortcut patch. It's completely unintrusive and + allows you to specify ^ as a shortcut for the current folder (e.g., in a + Fcc). (Closes: #253104) + + * Updated the autotools stuff. Include in it also stuff from patches, so + that --enable-foo options can be used in debian/rules. Put files directly + in extra/autotools and cp from there in debian/rules instead of using a + patch file (which was too big due to automake1.4/autoconf2.13 => 1.8/2.50 + migration). + + * debian/rules: + + use --enable-compresed --enable-hcache --without-gdbm in configure. + + copy autotools files from extra/autotools when unpacking, and emulate + the 000_Md.config.h.in patch. + + * debian/patches/: + + removed 000_Md.config.h.in, no longer needed since config.h.in is now + overwritten from extra/autotools. + + added patch.asp.fix-bug-266493.1, which makes mutt not wait for a + keypress to handle SIGWINCH in certain situations. (Closes: #123943, + #266493) + + -- Adeodato Simó Tue, 21 Sep 2004 01:39:22 +0200 + +mutt (1.5.6-20040818+1) unstable; urgency=low + + * The post-Sarge era officially begins for mutt. This mostly means + that patch inclusion policy will untighten a bit. + + * Added the maildir/imap header caching patch by Thomas Glanzmann, see: + . For a quick + start, read documentation for the $header_cache variable. + (Closes: #242762, #255475) + + * Added the maildir-mtime patch by Dale Woolridge, see + . This patch should make happy + users that use maildir and have $sort_browser=reverse-date. + (Closes: #253261) + + * Reorganized patches location: + + patches not written by the mutt maintainers are now in the + upstream/extra-patches directory. + + each patch in that directory now contains a preamble listing: + - the patch author + - the patch home page + - last time patch was updated + - exact URL to the patch file + - applied changes, if any + + all preambles are available in the doc/README.Patches file, and + debian/copyright now points to this file too. + + * Other changes in upstream/extra-patches/: + + updated the edit-threads patch. + + updated the compressed-folders patch. + + * Updated to CVS snapshot 20040818: + + various memory leaks spotted and fixed. + + several translations updated: pl, sv, fr, id, nl, de, ca, cs. + The Czech translation addresses a bad chosen shorcut in the crypt menu, + and thus closes: #140639. Updated German translation closes: #265120. + + fix some UI flaws in the new PGP and S/MIME menus which could easily + make the user send in clear mail which was meant to be signed and/or + encrypted (the (e)ncrypt, (s)ign and (b)oth commands were toggles). + Also renamed the (f)orget action to (c)lear for newbie's benefit; accept + the (f) key for long time users' benefit. + + make mutt not hang if STARTTLS fails to complete the SSL handshake. + + try all methods in $imap_authenticators when one of them fails; + previously mutt would give up upon the first of them failing. + + * debian/: + + scripts/vars: add upstream/extra-patches to SRC_PATCH_DIR. + + control: Build-Depend on libdb4.2-dev for the header-cache patch. + + rules: call scripts/patch-preamble to create the README.Patches file. + + copyright: add pointer to README.Patches, where patch authors are listed. + + * debian/patches/: + + updated 000_VERSION to reflect new snapshot date. + + removed obsolete #defines from 000_Md.config.h.in. Added #include + "debian-config.h" there, which is used by upstream/extra-patches/*.debian. + + removed patch.asp.fix-bug-260578.1, included upstream. + + * debian/rules: sort the PATCHES file, which is printed by `mutt -v`. + + -- Adeodato Simó Sat, 21 Aug 2004 20:53:39 +0200 + +mutt (1.5.6-20040803+1) unstable; urgency=low + + * Updated to CVS snapshot 20040803: + + fixes the code that closed #213412. + * debian/control: + + Rebuilt against gnutls11. (Closes: #263067, #263625) + + List myself in Uploaders field. + * debian/patches/: + + updated 000_VERSION to reflect new snapshot date. + + removed patch-1.5.6.tt.compat.1.asp.fix.1, which was not meant to be + included in the last upload. (Closes: #261951) + + update the gnutls patch to include TLS support for POP3 as well. Patch + provided by Alexander Neumann . (Closes: #260638) + + -- Adeodato Simó Thu, 5 Aug 2004 18:13:33 +0200 + +mutt (1.5.6-20040722+1) unstable; urgency=high + + * Updated to CVS snapshot 20040722: + + bugfixes: + - does not segfault when chdir'ing to a directory without read + permission. (Closes: #237426) + - does not segfault when applying check-traditional-pgp to multiple + messages. (Closes: #257277) + - uses the right From address when composing a new message from the + pager and $reverse_name is set. (Closes: #249870) + - initial IMAP header download does not take quadratic time on the + number of messages. (Closes: #213412) + + new functionality: + - support for spam-scoring filters (see §3.24 of the fine manual). + - $include_onlyfirst: controls whether or not Mutt includes only the + first attachment of the message you are replying. + - $hide_thread_subject: when unset, mutt will show the subject for all + messages in a thread. + - uses List-Post header when doing list-reply. (Initial RFC 2369 support, + closes: #49048) + * debian/patches/: + + updated 000_VERSION to reflect new snapshot date. + + updated the following patches to apply cleanly: + - 001_patch-1.5.4.rr.compressed.1 [Makefile.in] + - 002_patch-1.5.5.1.admcd.gnutls.59 [globals.h] + - patch-1.5.3.cd.edit_threads.9.2-1arc [mutt.h] + + updated patch-1.5.6.tt.compat.1 (does not close #259145). + + removed patch-1.5.3.Md.gpg-agent, issue fixed upstream. + + added patch-1.5.6.helmersson.incomplete-mbyte.2 by Anders Helmersson + to avoid passing incomplete multibyte sequences to regexec(), which can + cause segfaults due to libc6 Bug#261135. (Closes: #254314, #260623) + [Yes, this is a sequel, not a dejà-vu.] + + added patch.asp.fix-bug-{210679,254294,258621,260578}.1, which fix + several minor issues unaddressed by upstream for some time. All patches + submitted upstream. (Closes: #210679, #254294, #258621, #260578). + * debian/rules: + + be robust to any locale by exporting LC_ALL=C. (Closes: #253048) + + touch some autotools files to prevent having them to be built again. + * Using "urgency=high" at maintainer's discretion + + -- Adeodato Simó Wed, 21 Jul 2004 19:31:55 +0200 + +mutt (1.5.6-20040523+2) unstable; urgency=low + + * Renamed patch-1.5.5.1.tt.compat-fix to patch-1.5.5.1.tt.compat.2-fix. + (Closes: #253048) + + -- Marco d'Itri Mon, 7 Jun 2004 00:45:40 +0200 + +mutt (1.5.6-20040523+1) unstable; urgency=low + + * This release is based on the work of Adeodato Simó . + * Updated to CVS snapshot 20040523: + + now mutt includes better support for inline/traditional signing and + encrypting. See http://www.woolridge.ca/mutt/pgp-menu-traditional.html + for details. (Closes: #190204) + + sourcing output of a command works again. (Closes: #247007) + + corrected .PP usage in flea.1 and mbox.5. (Closes: #237827) + + do not eat chars on rfc822-valid From:address lines (i.e., when there + is no space between the colon and address; fixes the already archived + #226759). + * debian/patches/: + + added 000_VERSION: reflect CVS snapshot date. + + removed 081_nbrown.auth_imap_plain: included upstream. + + added patch-1.5.5.1.tt.compat-fix: introduces a fix for the compat + patch which prevents mutt from segfaulting when there is binary junk + in headers. (Closes: #233315, #247366, #249588) + + removed patch-1.5.4.Md.gpg_by_keyid-1arc: no longer needed. + (Closes: #250108, #248994) + + added 004_ranty.fix-compressed: written some time ago by Manuel Estrada + to prevent mutt from deleting a message if saving to a compressed folder + fails. In memoriam. (Closes: #210429) + + added patch-1.5.6.asp.pgp_getkeys: set pgp_getkeys_command in Muttrc. + Currently commented out because of #172960. (Closes: #237691) + + 080_Md.Muttrc: make colors respect terminal scheme. (Closes: #86393) + * debian/rules: pass --enable-debug to configure. (Closes: #198073) + + -- Marco d'Itri Sun, 6 Jun 2004 01:17:14 +0200 + +mutt (1.5.6-1) unstable; urgency=low + + * New upstream release. Old configuration files may become incompatible, + see NEWS.Debian.gz for details. + * Added debian/NEWS. + * debian/patches/: + - updated patch-1.5.4.Md.gpg_by_keyid-1arc - pgp_export_command uses %r + instead %k. (Closes: #223960) + - updated 002_patch-1.5.5.1.admcd.gnutls.59 - mutt can save server's + certificate. (Closes: #228607, #234623, #236886) + - removed 000_VERSION (not needed in this release). + - removed 004_patch-1.5.5.1.Md.libgnutls10 - included in + 002_patch-1.5.5.1.admcd.gnutls.59. + - added 081_nbrown.auth_imap_plain - mutt can authenthicate itself to imap + server via sasl2 using PLAIN method, thanks to Neil Brown. + (Closes: #206078, #214758) + - removed patch-1.5.4.helmersson.incomplete_multibyte because it's broken. + (Closes: #244549) + - removed 003_patch-1.4.admcd.gnutlsdlopen.53, now the mutt binary will + be linked with libgnutls. (Closes: #228279, #228323, #230287) + - updated patch-1.3.27.bse.xtitles.1 with patch-1.5.5.1.nt.xtitles.3.ab.1. + * Update the default MTA: Depend on exim4 | mail-transport-agent. + (Closes: #228560) + * This release is the work of Artur R. Czechowski. + + -- Marco d'Itri Sun, 2 May 2004 18:02:10 +0200 + +mutt (1.5.5.1-20040112+1) unstable; urgency=medium + + * Build-Depend on libidn11-dev instead of libidn9-dev + and libgnutls10-dev instead of libgnutls7-dev. (Closes: #226910, #227426) + * Updated to CVS snapshot 20040112: + + fixed manual (Closes: #226936) + + fixed pgp_retainable_sigs (Closes: #226424) + * New patch patch-1.4.1.tt.compat.1-ter, a part of mutt-ja which allows + configuring a default character set to be used for non-MIME messages. + (Closes: #222191) + * Added a note about temporary files to README.Debian. + (Closes: #141143, #222125) + * New patch 100_arc.smime_descripitive_messages which adds some + error messages to smime_keys.pl. (Closes: #226696) + * Conflicts/Replaces mutt-utf8. + * New patch 004_patch-1.5.5.1.Md.libgnutls10. + * This release is the work of Artur R. Czechowski. + + -- Marco d'Itri Sat, 17 Jan 2004 17:50:16 +0100 + +mutt (1.5.5.1-20040105+1) unstable; urgency=low + + * New upstream release: + + fixed infinite loop during attachment saving. (Closes: #219314, #224654) + * Updated to CVS snapshot 20040105: + + fixed a lot of crashes/coredumps. + (Closes: #141214, #141468, #192341, #197322, #219499, #223663) + + honor Reply-To while generating Mail-Followup-To headers. + (Closes: #182526) + + improved colouring of thread tree. (Closes: #219594) + + fixed retrieving mail via preauth imap over ssh. (Closes: #209025) + * debian/rules: added extra-clean target to delete *.orig and *.rej files + when debian/sys-build.mk make-diff is called. + * Modified patches to apply without conflicts: + + 001_patch-1.5.4.rr.compressed.1 + + 003_patch-1.4.admcd.gnutlsbuild.53 + * Suggests libgnutls7 instead libgnutls5 (Closes: #217716), updated + README.Debian. + * Added README.SMIME. (Closes: #222903) + * smime_keys moved to /usr/bin. (Closes: #222905) + * Suggests ca-certificates and openssl. + * Killed mutt-utf8. + * This release is the work of Artur R. Czechowski. + + -- Marco d'Itri Tue, 6 Jan 2004 15:38:58 +0100 + +mutt (1.5.4+20031024-1) unstable; urgency=medium + + * New CVS snapshot. (Closes: #133021, #207242, #208430, #213007, #213917) + * Fix FTBFS bug in debian/control. (Closes: #216508) + * Compiled with libgnutls7. (Closes: #209722) + * New patch patch-1.5.4.fw.maildir_inode_sort. (Closes: #212664) + * New patch patch-1.5.4.helmersson.incomplete_multibyte. + (Closes: #187991, #188605) + * New patch patch-1.5.4.Md.gpg_by_keyid. (Closes: #210668) + * Removed README.NFS, as it talks about 2.0 and 2.2 kernels. + * Removed reference to $AGENT_SOCKET from README.Debian. (Closes: #215412) + + -- Marco d'Itri Fri, 24 Oct 2003 15:06:01 +0200 + +mutt (1.5.4+20030913-1) unstable; urgency=medium + + * New CVS snapshot. (Closes: #210354, #210423) + * Added patch-1.5.3.vk.pgp_verbose_mime. (Closes: #201306) + + -- Marco d'Itri Sat, 13 Sep 2003 15:59:49 +0200 + +mutt (1.5.4+20030817-1) unstable; urgency=medium + + * New CVS snapshot, packaged with the great help of arturcz@hell.pl + (co-maintainer). (Closes: #138966) + * Switched to libsasl2. (Closes: #201210) + * Removed hcache patch. + (Closes: #189999, #194843, #196832, #196978, #197182, #199052) + * Updated gnutls patch to 002_patch-1.5.4.admcd.gnutls.56. (Closes: #196117) + * Removed libdb4.0-dev from Build-Depends (Closes: #204015) + * /etc/Muttrc: call gpg without a path. (Closes: #193756) + * locales upgraded to Recommended status. + * Added an icon. (Closes: #188726) + * Make pgp_import_command nonverbose. (Closes: #195310) + + -- Marco d'Itri Sun, 17 Aug 2003 15:56:55 +0200 + +mutt (1.5.4-1) unstable; urgency=high + + * New upstream release. (Closes: #142266, #148858, #169740, #178563) + * Fixes remotely exploitable buffer overflow in the IMAP code. + (Core Security Technologies Advisory CORE-2003-03-04-02.) + * Removed again BUFFY_SIZE support, too many people complained. + Added a note to README.Debian. + * Provides: imap-client. (Closes: #183351) + * Always include the whole certificates chain in S/MIME mail to comply + with RFC 2315 spirit. (Closes: #182477) + * Applied ME's headers caching patch (provided by Nicolas Bougues). + * Fixed pgpewrap core dump. (Closes: #170666) + + -- Marco d'Itri Thu, 20 Mar 2003 15:06:13 +0100 + +mutt (1.5.3-3) unstable; urgency=medium + + * Recompiled to fix missing dependencies information. (Closes: #181167) + + -- Marco d'Itri Sun, 16 Feb 2003 11:46:46 +0100 + +mutt (1.5.3-2) unstable; urgency=medium + + * Compiled with BUFFY_SIZE. (Closes: #179970) + * Stop generating escape codes in the manual. (Closes: #167006) + * Set the default editor as specified by policy. (Closes: #177245) + + -- Marco d'Itri Fri, 14 Feb 2003 19:13:15 +0100 + +mutt (1.5.3-1) unstable; urgency=low + + * New upstream release (Closes: #112865, #165397, #168907, #169018). + * Suggests ispell | aspell (Closes: #175324). + * Add & and = to the URL coloring regex (Closes: #169646). + * Removed message-hook for clearsigned PGP messages (Closes: #168275). + * Removed obsolete patch-1.4.0.dw.pgp-traditional.2. + * By popular (?) demand, use /etc/mailname and only if it fails fall + back to gethostbyname(3) and then to uname(2) (Closes: #167549). + + -- Marco d'Itri Tue, 14 Jan 2003 18:31:01 +0100 + +mutt (1.4.0-5) unstable; urgency=medium + + * Try a different strategy to find the FQDN. Stop using /etc/mailname. + (Closes: #166060). + * Suggests: mixmaster (Closes: #166360). + * Updated copyright file (Closes: #163783). + * *Really* enable --enable-imap-edit-threads (Closes: #162352). + * Ignore Microsoft Thread-* header (Closes: #161473). + * Do not ask the password if gpg-agent or quintuple-agent are active + (Closes: #161508). + * Applied patch-1.5-me_editor.1 (Closes: #72318). + * Applied patch-1.5.1.tlr.mailboxes-overflow.1 (Closes: #153751). + * Applied patch-1.4-me.regex_doc.1 (Closes: #162550). + * Removed patch-1.3.15.sw.pgp-outlook.1 in favour of + patch-1.4.0.dw.pgp-traditional.2. All "traditional" PGP messages now + use text/plain. + + -- Marco d'Itri Tue, 29 Oct 2002 14:38:52 +0100 + +mutt (1.4.0-4) unstable; urgency=medium + + * Recompile with newer libgnutls5 (Closes: #160114). + * Updated contrib/colors.angdraug. + * Updated 010_patch-1.4.admcd.gnutls.55. + + -- Marco d'Itri Tue, 17 Sep 2002 16:07:50 +0200 + +mutt (1.4.0-3) unstable; urgency=medium + + * *Really* compile mutt with --enable-imap-edit-threads (Closes: #154864). + * *Really* merge the Maildirs new messages patch (Closes: #151582). + * Recompile with libgnutls5 (Closes: #152787, #157120). + + -- Marco d'Itri Sun, 18 Aug 2002 16:59:06 +0200 + +mutt (1.4.0-2) unstable; urgency=low + + * Update GNUTLS patch and link against gnutls4. (Closes: #152141). + * Link mutt-utf8 against libncursesw5 instead of slang1a-utf8. + * set pipe_decode=yes in /etc/Muttrc (Closes: #151460). + * Compile mutt with --enable-imap-edit-threads (Closes: #150274). + * Make debian/scripts/lib work even if $CDPATH is set (Closes: #152678). + * Merged patch to fix spurious new message notifications with Maildirs + (Closes: #151582). + + -- Marco d'Itri Fri, 12 Jul 2002 03:34:48 +0200 + +mutt (1.4.0-1) unstable; urgency=medium + + * New upstream release (Closes: #146889, #149348, #148558). + * Updated patch edit_threads.9.2 (Closes: #146451). + * Priority of mutt-utf8 changed from optional to extra. + + -- Marco d'Itri Mon, 10 Jun 2002 21:26:08 +0200 + +mutt (1.3.28-2) unstable; urgency=medium + + * Moved into main. + * Suggests: libgcrypt1, gnutls3 (Closes: #140970). + * Added patch from CVS to fix crash with UTF-8 locales (Closes: #126336). + + -- Marco d'Itri Sat, 6 Apr 2002 18:35:01 +0200 + +mutt (1.3.28-1) unstable; urgency=medium + + * New upstream release (Closes: #138200). + * Updated GNUTLS patch. + * Make flea(1) work even if bug(1) is not installed (Closes: #138273). + * Added /usr/share/bug/mutt/presubj file (Closes: #138274). + + -- Marco d'Itri Tue, 19 Mar 2002 14:42:39 +0100 + +mutt (1.3.27-5) unstable; urgency=medium + + * Added build dependancy on linuxdoc-tools-text (Closes: #137890). + * Use sensible-pager instead of zless to read the manual (Closes: #136206). + * Added example colors scheme contributed by Dmitry Borodaenko. + + -- Marco d'Itri Mon, 11 Mar 2002 19:40:20 +0100 + +mutt (1.3.27-4) unstable; urgency=high + + * Recompiled against new slang packages (Closes: #133255, #134115). + * Added patch-1.3.27.me.aliasdups.1 (Closes: #133559). + * Updated GNUTLS patch. + * Added missing flea(1) symlink (Closes: #133646). + + -- Marco d'Itri Sun, 17 Feb 2002 03:27:50 +0100 + +mutt (1.3.27-3) unstable; urgency=high + + * Recompiled against new slang and packages (Closes: #132644). + * Title bar is changed on more xterm variants (Closes: #131178). + * Removed obsolete advice about shred from README.Debian (Closes: #132786). + + -- Marco d'Itri Sun, 10 Feb 2002 13:26:20 +0100 + +mutt (1.3.27-2) unstable; urgency=high + + * Updated GNUTLS patch (Closes: #131386, #131424). + * Added patch-1.3.27.me.listfrom_doc.1 (Closes: #45706). + * Added missing -fPIC (Closes: #131209). + * Added missing commas in charset.c (Closes: #130481). + + -- Marco d'Itri Thu, 31 Jan 2002 15:23:34 +0100 + +mutt (1.3.27-1) unstable; urgency=medium + + * New upstream release. + * Small fix to pt_BR translation (Closes: #130416). + * Hide gpg status messages (Closes: #127519). + + -- Marco d'Itri Tue, 22 Jan 2002 20:18:21 +0100 + +mutt (1.3.26-1) unstable; urgency=medium + + * New upstream release. + * Removed patch-1.3.25.chip.fast-limited-threads because the patched + code has changed. + + -- Marco d'Itri Sat, 19 Jan 2002 19:30:13 +0100 + +mutt (1.3.25-5) unstable; urgency=high + + * Added build dependancy on groff (Closes: #129605, #129698). + + -- Marco d'Itri Thu, 17 Jan 2002 19:03:29 +0100 + +mutt (1.3.25-4) unstable; urgency=high + + * Forced build dependancy on newer gnutls-dev (Closes: #129283). + * Updated GNUTLS patch (Closes: #129291). + + -- Marco d'Itri Wed, 16 Jan 2002 19:47:45 +0100 + +mutt (1.3.25-3) unstable; urgency=medium + + * Force documentation rebuilding (Closes: #128758, #129045). + * TLS patch update from Andrew McDonald (Closes: #125924, #128718, #129039). + * Suggests gnutls0. + * Fixed typo in manual (Closes: #128836). + * Added patch-1.3.25.chip.fast-limited-threads, which is supposed to + speed up limited threaded display (Closes: #128174). + * Added patch-1.3.25.tlr.attach_overwrite.1 (Closes: #126122). + + -- Marco d'Itri Sun, 13 Jan 2002 17:18:21 +0100 + +mutt (1.3.25-2) unstable; urgency=low + + * Force dependancy on slang1-utf8 (Closes: #127938). + * Enable again optimization (Closes: #127653, #127682). + * Enable {open,close,append}-hook by default again (Closes: #127894). + + -- Marco d'Itri Sun, 6 Jan 2002 19:35:57 +0100 + +mutt (1.3.25-1) unstable; urgency=high + + * New upstream release, fixes remotely exploitable buffer overflow. + * Fixed mutt_dotlock permissions + (Closes: #127264, #127265, #127278, #127308, #127312, #127357). + + -- Marco d'Itri Wed, 2 Jan 2002 18:49:54 +0100 + +mutt (1.3.24-3) unstable; urgency=medium + + * A new mutt-utf8 package is generated (Closes: #99898). + * Added patch-1.3.24.de.new_threads.3 to fix segfaults while sorting + thread (Closes: #123658). + * Added --status-fd option to gpg command line and working $pgp_good_sign + variable to default /etc/Muttrc (see #110414 and #123273 for details). + * Updated thread editing patch to patch-1.3.24.cd.edit_threads.8. + * Added patch-1.3.24.appoct.2 to lookup application/octet-stream files + extensions in mime.types. + * Fixed coredump processing in flea(1) (Closes: #123081). + * Removed obsolete contrib/pgp-macros. + + -- Marco d'Itri Thu, 27 Dec 2001 03:32:16 +0100 + +mutt (1.3.24-2) unstable; urgency=medium + + * Added better GNUTLS code from Andrew McDonald. + * Added again threads editing patch. + * Enable {open,close,append}-hook by default again (Closes: #115473). + * Removed default $pgp_good_sign from Muttrc (related to #110414). + + -- Marco d'Itri Wed, 5 Dec 2001 02:26:13 +0100 + +mutt (1.3.24-1) unstable; urgency=high + + * New upstream release (Closes: #74484, #98630, #114938). + * Added conflict with gnutls < 0.2.9 (Closes: #121645). + * Fixed mailspell script (Closes: #120446). + * Removed 000_patch-1.3.22.1.cd.edit_threads-5.1. + * Added 000_patch-1.3.23.1.ametzler.pgp_good_sign (Closes: #110414). + + -- Marco d'Itri Fri, 30 Nov 2001 22:52:42 +0100 + +mutt (1.3.23-4) unstable; urgency=high + + * Added Build Dependandcies on libgcrypt-dev and zlib1g-dev + (Closes: #119309). + * Added a comment to README.Debian about stunnel (Closes: #115421). + * Removed safefilter script (Closes: #118630). + * Added the broken-outlook-pgp-clearsigning patch (Closes: #120090). + + -- Marco d'Itri Fri, 30 Nov 2001 20:49:02 +0100 + +mutt (1.3.23-3) unstable; urgency=high + + * Moved to non-US (Closes: #118294). + + -- Marco d'Itri Mon, 5 Nov 2001 12:06:43 +0100 + +mutt (1.3.23-2) unstable; urgency=medium + + * Added SSL support using GNUTLS. WARNING: requires the CVS library! + * Added unpack target to debian/rules (Closes: #115765). + * Fixed account-hook (Closes: #117125). + * Added default compression hooks to /etc/Muttrc (Closes: #115473). + + -- Marco d'Itri Sun, 4 Nov 2001 13:59:25 +0100 + +mutt (1.3.23-1) unstable; urgency=medium + + * New upstream release (Closes: #106864, #106229, #110414) + (Closes: #69135, #89195, #92651, #97319, #98627). + * Added README.NFS note from the liblockfile maintainer (Closes: #96788). + * Fixed gpg operations (Closes: #113458, #114163, #114938). + * Fixed compressed folder patch (Closes: #114199). + * Highlight https URLs too (Closes: #113791). + + -- Marco d'Itri Wed, 10 Oct 2001 02:30:15 +0200 + +mutt (1.3.22-2) unstable; urgency=medium + + * Renamed dotlock.1 (Closes: #112545). + * Fixed the threads editing patch (Closes: #112554). + + -- Marco d'Itri Wed, 19 Sep 2001 12:18:47 +0200 + +mutt (1.3.22-1) unstable; urgency=low + + * New upstream release (Closes: ). + * Old bugs fixed in the last NMU (Closes: #29884, #101075, #101484) + (Closes: #101890, #101890, #102439, #106863, #104469, #105391) + (Closes: #110262). + * Fixed bashism in vars.build (Closes: #104137). + * Updated libssl package name in README.Debian (Closes: #96564). + * Added a note about temporary files in README.Debian (Closes: #89277). + * Added a note about locales in README.Debian (Closes: #105545). + * Included threads editing patch (Closes: #111291). + * Fixed paths in mutt.man (Closes: #110462). + + -- Marco d'Itri Sat, 15 Sep 2001 17:33:51 +0200 + +mutt (1.3.19-1) unstable; urgency=low + + * New upstream release (Closes: #81155, #93830, #95426, #100298, #101075). + (Closes: #101451). + * Suggests locales instead of i18ndata (Closes: #98814). + + -- Marco d'Itri Tue, 22 May 2001 13:42:34 +0200 + +mutt (1.3.18-1) unstable; urgency=low + + * New upstream release (Closes: #81155, #92234, #90400, #92860, #95426) + (Closes: #88358, #92846, #92847, #91979, #97658, #98014). + + -- Marco d'Itri Tue, 22 May 2001 13:42:34 +0200 + +mutt (1.3.17-1) unstable; urgency=high + + * New upstream release (Closes: #89011, #82372, #86228, #83187). + + -- Marco d'Itri Sun, 1 Apr 2001 22:09:27 +0200 + +mutt (1.3.15-2) unstable; urgency=high + + * Built again without linking libiconv. + + -- Marco d'Itri Wed, 14 Feb 2001 23:02:23 +0100 + +mutt (1.3.15-1) unstable; urgency=low + + * New upstream release (Closes: #81873, #81155, #81640, #76922). + * Added more headers to the ignore list. + * Removed dh_suidregister (Closes: #84826). + * Removed US-ASCII charset-hook (Closes: #81240). + * Commented all "color header" lines in the default /etc/Muttrc. + * Fixed default colors on white background xterm. + + -- Marco d'Itri Mon, 12 Feb 2001 23:34:41 +0100 + +mutt (1.3.12-2) unstable; urgency=low + + * Fixed typo in muttbug (Closes: #79230). + * Added menu hints (Closes: #80067). + * Compiled with libsasl (Closes: #78746). + + -- Marco d'Itri Sun, 24 Dec 2000 12:18:23 +0100 + +mutt (1.3.12-1) experimental; urgency=low + + * Packaged the development tree (Closes: #60459, #73050, #75885, #77856). + * Documented the fact that pgp_encryptself is gone and will not be back + (Closes: #47833, #69221). + + -- Marco d'Itri Tue, 28 Nov 2000 02:25:50 +0100 + +mutt (1.2.5-5) unstable; urgency=low + + * Added support for libc6 2.2 compressed charmaps + (Closes: #74975). + * Updated README.Debian about SSL support (Closes: #75895). + * Added the compressed folder patch (Closes: #76224). + * Removed some colorization (Closes: #77976). + + -- Marco d'Itri Mon, 27 Nov 2000 18:46:25 +0100 + +mutt (1.2.5-4) stable unstable; urgency=high + + * Typo in debian-ldap-query prevented it from running (#74575). + + -- Marco d'Itri Sun, 29 Oct 2000 13:09:42 +0100 + +mutt (1.2.5-3) stable unstable; urgency=high + + * ====> Removed non GPL-compatible SHA code (patch-1.3.9.tlr.sha.1). <==== + * ====> Disabled linking with the GPL-incompatible openssl library. <==== + * Update debian-ldap-query for new libnet-ldap-perl package (Closes: #74575). + + -- Marco d'Itri Thu, 12 Oct 2000 10:28:10 +0200 + +mutt (1.2.5-2) unstable; urgency=low + + * Disallow suspend by default if mutt is the session leader (Closes: #64169). + * Fixed the check for optional crypto libraries (Closes: #68518). + * Added build dependency to debhelper (Closes: #68401). + * Added some info to README.NFS (Closes: #71163). + * Added ispell wrapper. + + -- Marco d'Itri Thu, 21 Sep 2000 19:43:57 +0200 + +mutt (1.2.5-1) unstable; urgency=low + + * New upstream release (Closes: #67885, #65999, #67420, #65638, #62580). + (Closes: #67420). + * Fixed charmaps handling for autobuilders (Closes: #67609).\ + * Added debian-ldap-query script. + * mutt_imap_*_.so and pgp* moved to /usr/lib/mutt/. + * Added safefilter contributed script. + + -- Marco d'Itri Tue, 1 Aug 2000 18:22:58 +0200 + +mutt (1.2-1) unstable; urgency=low + + * New upstream release. + * Fixed manual.txt.gz path in F1 macro (Closes: #63384). + + -- Marco d'Itri Sun, 7 May 2000 19:51:09 +0200 + +mutt (1.1.12-1) unstable; urgency=low + + * New upstream release. + * Removed duplicated install-docs commands (Closes: #60788). + + -- Marco d'Itri Mon, 20 Mar 2000 22:14:53 +0100 + +mutt (1.1.9-1) unstable; urgency=low + + * New upstream release (Closes: #60139, #57965, #60139). + * pgp_sign_micalg=pgp-sha1 added to the default Muttrc (Closes: #59765). + + -- Marco d'Itri Wed, 15 Mar 2000 10:57:49 +0100 + +mutt (1.1.5-1) unstable; urgency=low + + * New upstream release (Closes: #56011, #58703). + + -- Marco d'Itri Sat, 26 Feb 2000 15:13:09 +0100 + +mutt (1.1.4-1) unstable; urgency=low + + * New upstream release. + + -- Marco d'Itri Wed, 16 Feb 2000 01:14:31 +0100 + +mutt (1.1.3-1) unstable; urgency=low + + * New upstream release (Closes: #57373, #57155, #57533, #56970). + * Fixed Pine.rc (Closes: #57647). + + -- Marco d'Itri Wed, 16 Feb 2000 01:14:20 +0100 + +mutt (1.1.2-2) unstable; urgency=low + + * README.UPDATE installed in the documentation directory (Closes: 56970). + * Patched for run time loading of SSL and Kerberos libraries. + + -- Marco d'Itri Thu, 10 Feb 2000 23:56:21 +0100 + +mutt (1.1.2-1) unstable; urgency=low + + * New upstream release (Closes: #30639, #28727). + * Fixed color problems in xterms. + + -- Marco d'Itri Tue, 1 Feb 2000 12:31:26 +0100 + +mutt (1.1.1-1) experimental; urgency=low + + * My christmas present: packaged the development tree. + + -- Marco d'Itri Sun, 19 Dec 1999 12:08:53 +0100 + --- mutt-1.5.21.orig/debian/mutt-patched.links +++ mutt-1.5.21/debian/mutt-patched.links @@ -0,0 +1 @@ +usr/share/doc/mutt usr/share/doc/mutt-patched --- mutt-1.5.21.orig/debian/README.Debian +++ mutt-1.5.21/debian/README.Debian @@ -0,0 +1,81 @@ +l10n support +~~~~~~~~~~~~ +If you want to see non-ASCII characters on a Debian system, there's no +use fiddling with the variable "charset", as described in the manual +page muttrc(5). +Instead, you'll need to have the Debian package "locales" installed on +your system and set the LANG or LC_CTYPE environment variable. +e.g. US users will want to add "export LC_CTYPE=en_US" to their ~/.bashrc. +If you have a /etc/locale.gen file read carefully the comment and do +what it says, or it will not work. +No, linux systems do not need --enable-locales-fix or --without-wc-funcs, +so don't bother me saying these switches cure your problems. + + +PGP support +~~~~~~~~~~~ +GnuPG support works out of the box with the default /etc/Muttrc. +You do not need any of the example files in /usr/share/doc/mutt/ +unless you plan to send signed+encrypted messages to pgp2 users. + + +gpg-2comp +~~~~~~~~~ +/usr/share/doc/mutt/examples/gpg.rc uses a wrapper program called +gpg-2comp which is not available as a debian package. +This program is needed only to sign and encrypt messages with a method +compatible with PGP 2.x. Users who don't need this feature can use the +commands provided in the default /etc/Muttrc. +The pgpewrap and pgpring programs used by some example rc files have +been installed in /usr/lib/mutt. +The files /usr/share/doc/mutt/examples/*.rc are just examples and are not +supposed to be used as is. Actually they are not supposed to be used at +all, PGP support works out of the box if gnupg is installed. + + +GnuPG passphrase +~~~~~~~~~~~~~~~~ +The GnuPG passphrase is not asked if the $GPG_AGENT_INFO environment +variable exists. + + +Scripts +~~~~~~~ +Look at /usr/lib/mutt/{debian-ldap-query,mailspell}. + + +pgp_encryptself +~~~~~~~~~~~~~~~ +This mutt 1.0.x configuration option does not exist anymore and this +will not change. To achieve the same effect you can add something like +--encrypt-to=your@mail.address to the relevant ~/.muttrc configuration +lines (pgp_encrypt_only_command and pgp_encrypt_sign_command) or to +~/.gnupg/options . + + +S/MIME Support +~~~~~~~~~~~~~~ +See README.SMIME for details. + + +About temporary files and security +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When using mutt to view an encrypted message, the plain text is saved in +a temporary file. If you have reasons to worry an attacker may recover +the deleted file from your hard disk please take appropriate actions to +prevent this (e.g. use a ramdisk or shred(1) or wipe(1)). +Also don't forget about the temporary files created by your editor. +Mutt creates temporary files in a secure way. See #222125 for details. + + +/etc/Muttrc.d/ +~~~~~~~~~~~~~~ +The default /etc/Muttrc will source more configuration directives from +files in the /etc/Muttrc.d/ directory ending in ".rc". +The system administrator may use the directory for local customizations +and packages enhancing mutt may use it to install their configuration +directives. +The directory is processed last in /etc/Muttrc, so that settings there +may override the defaults from the file. + + -- Christoph Berg Sat, 03 Nov 2007 21:02:26 +0100 --- mutt-1.5.21.orig/debian/mutt-patched.install +++ mutt-1.5.21/debian/mutt-patched.install @@ -0,0 +1 @@ +debian/extra/mutt-patched.rc/*.rc etc/Muttrc.d --- mutt-1.5.21.orig/debian/update-autotools.sh +++ mutt-1.5.21/debian/update-autotools.sh @@ -0,0 +1,38 @@ +#! /bin/sh + +set -e + +dh_testdir + +D=$(basename "$PWD") +PATCH_NAME=misc/autotools-update.diff + +debclean +quilt delete $PATCH_NAME || test $? -eq 1 +quilt push -aq +ln -sf /usr/share/misc/config.sub . +ln -sf /usr/share/misc/config.guess . + +cd .. +cp -al $D $D.orig + +cd $D +aclocal -I m4 +autoheader +( cd m4 && make -f Makefile.am.in ) +automake +autoconf +cd .. + +T=`mktemp $D/diff.XXXXXX` +diff -ru $D.orig $D >$T || test $? -eq 1 +patch -p1 -R -d $D <$T + +cd $D +quilt import -f -P $PATCH_NAME `basename $T` +quilt push +quilt refresh -p0 +cd .. + +rm -f $T +rm -rf $D.orig --- mutt-1.5.21.orig/debian/watch +++ mutt-1.5.21/debian/watch @@ -0,0 +1,2 @@ +version=3 +opts=pasv ftp://ftp.mutt.org/mutt/devel/mutt-(.*).tar.gz --- mutt-1.5.21.orig/debian/mutt.preinst +++ mutt-1.5.21/debian/mutt.preinst @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" lt "1.5.19-2" ; then + MD5SUM=$(md5sum /etc/Muttrc.d/smime-paths.rc | cut -d ' ' -f 1) + if [ "$MD5SUM" = "185414b78b332a662500719a179778c5" ] ; then + echo "Removing obsolete config file /etc/Muttrc.d/smime-paths.rc" + rm /etc/Muttrc.d/smime-paths.rc + else + echo "Not removing modified obsolete config file /etc/Muttrc.d/smime-paths.rc" + fi +fi + +#DEBHELPER# + +exit 0 --- mutt-1.5.21.orig/debian/mutt.install +++ mutt-1.5.21/debian/mutt.install @@ -0,0 +1,18 @@ +debian/tmp/usr/bin/mutt +debian/tmp/usr/bin/smime_keys +debian/tmp/usr/bin/mutt_dotlock +debian/tmp/usr/share/locale/* + +debian/extra/lib/mailspell usr/lib/mutt +debian/tmp/usr/bin/pgpring usr/lib/mutt +debian/tmp/usr/bin/pgpewrap usr/lib/mutt +debian/extra/lib/source-muttrc.d usr/lib/mutt +debian/extra/lib/debian-ldap-query usr/lib/mutt +debian/extra/lib/mailto-mutt usr/lib/mutt + +debian/tmp/Muttrc etc +debian/tmp/gpg.rc etc/Muttrc.d +contrib/smime.rc etc/Muttrc.d +debian/extra/rc/*.rc etc/Muttrc.d +debian/extra/mutt.xpm usr/share/pixmaps +debian/tmp/usr/share/doc/*.html usr/share/doc/mutt/html --- mutt-1.5.21.orig/debian/mutt-dbg.links +++ mutt-1.5.21/debian/mutt-dbg.links @@ -0,0 +1 @@ +usr/share/doc/mutt usr/share/doc/mutt-dbg --- mutt-1.5.21.orig/debian/mutt.lintian-overrides +++ mutt-1.5.21/debian/mutt.lintian-overrides @@ -0,0 +1,4 @@ +mutt: setgid-binary usr/bin/mutt_dotlock 2755 root/mail +mutt: arch-dep-package-has-big-usr-share +mutt: binary-without-manpage usr/bin/mutt-org +mutt: menu-command-not-in-package /usr/share/menu/mutt:5 /usr/bin/mutt --- mutt-1.5.21.orig/debian/header.awk +++ mutt-1.5.21/debian/header.awk @@ -0,0 +1,23 @@ +#! /usr/bin/gawk -f + +BEGIN { + sep = "=============================================================================" +} + +FILENAME ~ /debian$/ { + nextfile +} + +/^== END PATCH$/ { + print "" + nextfile +} + +FNR == 1 { + print FILENAME "\n" substr(sep, 0, length(FILENAME)) "\n" + next +} + +{ + print +} --- mutt-1.5.21.orig/debian/mutt-patched.lintian-overrides +++ mutt-1.5.21/debian/mutt-patched.lintian-overrides @@ -0,0 +1 @@ +mutt-patched: binary-without-manpage usr/bin/mutt-patched --- mutt-1.5.21.orig/debian/mutt.postinst +++ mutt-1.5.21/debian/mutt.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ] ; then + update-alternatives --install /usr/bin/mutt mutt /usr/bin/mutt-org 50 +fi + +#DEBHELPER# + +exit 0 --- mutt-1.5.21.orig/debian/mutt.manpages +++ mutt-1.5.21/debian/mutt.manpages @@ -0,0 +1,6 @@ +debian/tmp/usr/share/man/man1/mutt.1 +debian/tmp/usr/share/man/man1/mutt_dotlock.1 +debian/tmp/usr/share/man/man1/smime_keys.1 +debian/tmp/usr/share/man/man5/muttrc.5 +debian/tmp/usr/share/man/man5/mbox.5 +debian/tmp/usr/share/man/man5/mmdf.5 --- mutt-1.5.21.orig/debian/clean +++ mutt-1.5.21/debian/clean @@ -0,0 +1 @@ +aclocal.m4 --- mutt-1.5.21.orig/debian/mutt.prerm +++ mutt-1.5.21/debian/mutt.prerm @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + remove|deconfigure) + update-alternatives --remove mutt /usr/bin/mutt-org + ;; +esac + +#DEBHELPER# + +exit 0 --- mutt-1.5.21.orig/debian/mutt-patched.postinst +++ mutt-1.5.21/debian/mutt-patched.postinst @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ] ; then + # versions prior to 1.5.20-9 used dpkg-divert instead of update-alternatives + if [ "$2" ] && dpkg --compare-versions "$2" lt "1.5.20-9" ; then + dpkg-divert --remove --package mutt-patched --rename \ + --divert /usr/bin/mutt.org /usr/bin/mutt + fi + + update-alternatives --install /usr/bin/mutt mutt /usr/bin/mutt-patched 60 +fi + +#DEBHELPER# + +exit 0 --- mutt-1.5.21.orig/debian/MY-TODO +++ mutt-1.5.21/debian/MY-TODO @@ -0,0 +1,7 @@ +Only in ../m/debian/mutt/usr/share/doc/mutt: BUGS.IMAP +Only in ../m/debian/mutt/usr/share/doc/mutt: README.IMAP +Only in ../m/debian/mutt/usr/share/doc/mutt: TODO.IMAP + +Only in debian/mutt/usr/share/doc/mutt/examples: ca-bundle.crt +Only in debian/mutt/usr/share/doc/mutt/examples: iconv +Only in debian/mutt/usr/share/doc/mutt/examples: smime_keys_test.pl --- mutt-1.5.21.orig/debian/mutt.dirs +++ mutt-1.5.21/debian/mutt.dirs @@ -0,0 +1,2 @@ +etc/Muttrc.d +usr/share/bug/mutt --- mutt-1.5.21.orig/debian/extra/README.SMIME +++ mutt-1.5.21/debian/extra/README.SMIME @@ -0,0 +1,56 @@ +This file describes how to configure mutt to use S/MIME. + +This file is almost the same as smime-notes.txt available in mutt upstream +sources, but it contains a few modifications about Debian-specific issues. + +Mutt needs some user interaction to get it ready for S/MIME. + +1. Make sure, that openssl (must be) and ca-certificates (recommended) + are installed. If not, ask your administrator to do it. + +2. Run 'smime_keys init'. + +3. If ca-certificates is installed, make a symlink: + ln -s /etc/ssl/certs ~/.smime/ca-bundle.crt + If not, there are some other packages which contain Root CA certificates, + for example: kdelibs-data, libcurl2. + This makes you trust anything that was ultimately signed by one of CA + included in symlinked crt file. + +4. Get yourself a certificate. (You can get one for free from www.thawte.com, + or pay for one from VeriSign or one of its competitors). The way the + process generally works: the certificate will be installed "into" your web + browser. If you are asked what application you wish to use the + certificate with, select Netscape. Strangely enough, "mutt" is usually not + an option. + +5. Assuming you are using Mozilla, follow the instructions at + www.verisignlabs.com/Projects/smime_docs/linux.html to export the + certificate into a file called cert.p12. If you don't use Mozilla, you're on + your own. + +6. Run 'smime_keys add_p12 cert.p12'. + * When the script asks for the "Import password", enter the one you + provided when you exported the certificate + * When it asks for a "PEM pass phrase", make up a new password. Every + time you sign or decrypt a message, mutt will ask for the PEM passphrase + * Finally, when the script asks for a label, enter an easy-to-remember + name for the certificate, such as "me". The script output will include + a line like: + added private key: /home/raldi/.smime/keys/12345678.0 for raldi@verisignlabs.com + The number (including the ".0" at the end) is your keyid. You will + need this number in the next step. + +7. Edit your .muttrc file and add a lines: + set smime_default_key=keyid + set smime_sign_as=keyid + Probably you also want to change default values for smime_timeout + and smime_encrypt_with originally set in global /etc/Muttrc + +8. Optionally, you can add following line to your ~/.mailcap to view certificate + from mutt: + application/x-pkcs7-signature;openssl pkcs7 -in %s -inform der -noout -print_certs -text | pager; needsterminal + +Last updated: Tue, 23 Dec 2003 22:35:40 +0100 +Artur R. Czechowski + --- mutt-1.5.21.orig/debian/extra/mutt.xpm +++ mutt-1.5.21/debian/extra/mutt.xpm @@ -0,0 +1,49 @@ +/* XPM */ +static char * mutt_xpm[] = { +"32 32 14 1", +" c None", +". c #CCCCCC", +"+ c #000000", +"@ c #7F7F7F", +"# c #B2B2B2", +"$ c #666667", +"% c #FF0000", +"& c #7F0000", +"* c #999999", +"= c #333333", +"- c #FF00FF", +"; c #FFFFFF", +"> c #7F007F", +", c #7F7F00", +" ", +" == ", +" ++ ", +" +..@@ ", +" +.,.+ ", +" + +.,.+ +++ ", +" + @+.,.+ +@@ ", +" @+ +....+++.@ ", +" +.@ @+.......+ ", +" +.+ +@....+.+ ", +" +.+ @+.....+.+ ", +" +.+@ +@........++++ ", +" +.@+ @+.........+;;> ", +" +..+++++++%@$#.......+.-- ", +" @@.@+&%&+@%%@@.......+>-> ", +" +..@+++@.@%%@$@......+++ ", +" +.........@%%+@$$....+ ", +" @@$.........@%%++@$..$+ ", +" +@@..........*%%++@@$+ ", +" +@@...........@%%++++ ", +" +@$............@+ ", +" +@@...#.......@+ ", +" @+@.#$+@@@...$++ ", +" +..$+@*@+..$+@+ ", +" @@.@++++++$.+@*+ ", +" @+..+*@@+=+@.+@.+ ", +" +@..+++@+++@..++@@+@ ", +" +@.....+@@+@.....+@.@ ", +" +$.....+@*+$.....+@.+ ", +" +@@.$..+@@+@@.$..+@.+ ", +" @++++++@++@++++++@++@ ", +" "}; --- mutt-1.5.21.orig/debian/extra/samples/ray.muttrc +++ mutt-1.5.21/debian/extra/samples/ray.muttrc @@ -0,0 +1,48 @@ +# This configuration file contains the default settings used by old debian +# packages (< 0.94). + +set quote_regexp="^[ \t]*[a-zA-Z\.]*>" # Default: "^([ \t]*[>|#:}])+" + +# +# More header weeding +# +ignore Resent- Precedence In-Reply-To Return-Receipt-To Mailer X400 +ignore Originator X-Loop X-Mailing-List X-Listprocessor X-Face +ignore X-Received X-Mailer X-Envelope-To X-Sender X-Attribution +# Usenet headers can occur for Cc-ed messages; they can still be +# recognized by the Newsgroups header. +ignore Path Lines NNTP-Posting-Host X-Newsreader X-Submitted-Via + +# +# Key bindings +# + +bind editor delete-char + +# Color / video attribute definitions. Not too flashy. +# + +color hdrdefault green black +color header brightyellow black "^from:" +mono header bold "^from:" +color header brightyellow black "^subject:" +mono header bold "^subject:" +color quoted green black +color signature brightred black +color indicator brightyellow red +color error brightred black +mono error bold +color status brightwhite blue +color tree brightmagenta black +color tilde brightmagenta black +# URL highlighting with the same regexp as urlview. +color body brightyellow black (((ht|f)tps?)|mailto):(//)?[^\ "\t]*|www\.[-a-z0-9.]+)[^\ .,;\t>">] +mono body bold (((ht|f)tps?)|mailto):(//)?[^\ "\t]*|www\.[-a-z0-9.]+)[^\ .,;\t>">] +color body brightmagenta black "[-a-z_0-9.]+@[-a-z_0-9.]+" +mono body bold "[-a-z_0-9.]+@[-a-z_0-9.]+" +color body brightyellow black "^Good signature" +mono body bold "^Good signature" +color body brightwhite red "^Bad signature from.*" +mono body bold "^Bad signature from.*" + + --- mutt-1.5.21.orig/debian/extra/samples/sidebar.muttrc +++ mutt-1.5.21/debian/extra/samples/sidebar.muttrc @@ -0,0 +1,74 @@ +# shamelessly copied from +# http://www.lunar-linux.org/index.php?option=com_content&task=view&id=44 + +# set up the sidebar, default not visible +set sidebar_width=12 +set sidebar_visible=no +set sidebar_delim='|' + +# which mailboxes to list in the sidebar +mailboxes =inbox =ml + +# color of folders with new mail +color sidebar_new yellow default + +# ctrl-n, ctrl-p to select next, prev folder +# ctrl-o to open selected folder +bind index \CP sidebar-prev +bind index \CN sidebar-next +bind index \CO sidebar-open +bind pager \CP sidebar-prev +bind pager \CN sidebar-next +bind pager \CO sidebar-open + +# I don't need these. just for documentation purposes. See below. +# sidebar-scroll-up +# sidebar-scroll-down + +# b toggles sidebar visibility +macro index b 'toggle sidebar_visible' +macro pager b 'toggle sidebar_visible' + +# Remap bounce-message function to "B" +bind index B bounce-message + +# +# Mario Holbe suggests: +# macro index b 'toggle sidebar_visible' +# macro pager b 'toggle sidebar_visible' +# + + +# Documentation +# ============= +# +# sidebar_width (number) +# Width of the sidebar. +# +# sidebar_visible (boolean) +# Whether or not the sidebar is visible. +# +# sidebar_delim (string) +# Specifies the delimiter between the sidebar and other screens +# +# color sidebar_new [fg] [bg] +# The foreground (fg) and background (bg) color of folders that contain new +# mail. +# +# sidebar-prev +# Mutt's name for the operation that selects the previous folder. +# +# sidebar-next +# Mutt's name for the operation that selects the next folder. +# +# sidebar-open +# Mutt's name for the operation that opens the currently selected folder. +# +# sidebar-scroll-up +# Only useful if you have more folders than lines in your terminal: scrolls one +# page up through the list of folders. +# +# sidebar-scroll-down +# Only useful if you have more folders than lines in your terminal: scrolls one +# page down through the list of folders. +# --- mutt-1.5.21.orig/debian/extra/samples/colors.angdraug +++ mutt-1.5.21/debian/extra/samples/colors.angdraug @@ -0,0 +1,91 @@ +# This color scheme aims to highlight as much useful information as +# possible without spoiling user's visual experience by irritating +# contrasts. Optimized for dark or transparent background. +# --Dmitry Borodaenko + +# override defaults, make transparency work +color normal white default +color attachment green default # +color hdrdefault cyan default +color indicator black cyan +color markers brightred default +color quoted green default +color signature brightblue default # +color status brightgreen blue +color tilde brightblue default # +color tree red default + +# paint different quote levels +color quoted green default +color quoted1 cyan default +color quoted2 yellow default +color quoted3 red default + +color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # email +color body brightblue default "(http|ftp)://[\-\.\,/+=&%~_:?\#a-zA-Z0-9]+" # URL +color body brightgreen default "(^| |[-.[:alnum:]]+:+)~?\(/[-_.'[:alnum:]]+\)+/?" # Unix file path +color body brightgreen default "(^| +)[[:alpha:]]:[-_.[:alnum:]\]+" # DOS file path +color body brightmagenta default "(^|[ '\"]+)\\$[[:alpha:]][-_[:alpha:]]+" # variable +color body brightred default "(^| )[*_]+[-&[:alnum:]]+[*_]( |$)" # bold/underline +color body yellow default "(^| )[;:8][-^o]?[)>(|/\\]+" # smiley +color body red default "[!?]{3,}" # exclamation +color body green default "^ *[-+*o] +" # list item + +# date formats +color body cyan default "[0-9]{1,2}:[0-9]{2}(:[0-9]{2})?( ?(AM|PM|am|pm))?( +[+-][0-9]{4})?" +color body cyan default "(\(19|20\)?[0-9]{2}/[01]?[0-9]/[0123]?[0-9]|[0123]?[0-9][/.][01]?[0-9][/.]\(19|20\)?[0-9]{2})(( at)? +[0-9]{1,2}:[0-9]{2}(:[0-9]{2})?( ?(AM|PM|am|pm))?( +[+-][0-9]{4})?)?" +color body cyan default "((Sun(day)?|Mon(day)?|Tue(sday)?|Wed(nesday)?|Thu(sday)?|Fri(day)?|Sat(urday)?),? +)?(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|June?|July?|Aug(ust)?|Sep(ember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)[ .]+[0-9]{1,2}(st|nd|rd|th)?,?( +(19|20)[0-9]{2}(,?( at)? [0-9]{1,2}:[0-9]{2}(:[0-9]{2})?( ?(AM|PM|am|pm))?( +[+-][0-9]{4})?)?)?" +color body cyan default "((Sun(day)?|Mon(day)?|Tue(sday)?|Wed(nesday)?|Thu(sday)?|Fri(day)?|Sat(urday)?),? +)?[0-9]{1,2}(st|nd|rd|th)?[ .]+(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|June?|July?|Aug(ust)?|Sep(ember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?),?( +(19|20)?[0-9]{2})?(( at)? [0-9]{1,2}:[0-9]{2}(:[0-9]{2})?( ?(AM|PM|am|pm))?( +[+-][0-9]{4})?)?" + +color header brightgreen default ^From: +color header brightcyan default ^To: +color header brightcyan default ^Reply-To: +color header brightcyan default ^Cc: +color header brightblue default ^Subject: + +color header brightcyan default "^newsgroups: " +color header yellow default "^Delivered-To: " +color header green default "^sender: " +color header green default "^organi[sz]ation: " +color header green default "x-editor: " +color header green default "(x-mailer|user-agent): " +color header green default "X-Operating-System: " +color header green default "X-MimeOLE: " +color header green default "X-Accept-Language: " +color header red default "^message-id:" +color header red default "^in-reply-to: " +color header red default "^references: " +color header cyan default "^followup-to: " +color header cyan default "^mail-followup-to: " +color header cyan default "^reply-to: " +color header magenta default "MIME-Version: " +color header magenta default "Content-Type: " +color header magenta default "Content-Transfer-Encoding: " +color header magenta default "Content-Disposition: " +color header magenta default "Content-Encoding: " +color header magenta default "Content-Language: " + +color status brightwhite blue + +color index brightblue default '~P' # from me +color index cyan default '~p' # personal +color index brightcyan default '~G' # PGP +color index brightred default '~F' # flagged +color index green default '~Q' # replied +color index brightwhite default '~N' # new +color index red default '~D' # deleted + +# threads +#color index brightyellow default "~h 'References: +<.+>'" +#color index yellow default "~h 'References: +<.+> +<.+>'" +#color index brightred default "~h 'References: +<.+> +<.+> +<.+>'" +#color index red default "~h 'References: +<.+> +<.+> +<.+> +<.+>'" +#color index blue default "~h 'References: +<.+> +<.+> +<.+> +<.+> +<.+>'" +#color index green default "~h 'References: +<.+> +<.+> +<.+> +<.+> +<.+> +<.+>'" + +# spam +color index magenta default "\(Resent-\)?Message-Id: <>" +color index magenta default "\(Resent-\)?Message-Id: '<.* .*>'" +color index magenta default "\(Resent-\)?Message-Id: localhost" +color index magenta default "! \(Resent-\)?Message-Id: @" +color index magenta default '~C Undisclosed.*Recipients' --- mutt-1.5.21.orig/debian/extra/lib/source-muttrc.d +++ mutt-1.5.21/debian/extra/lib/source-muttrc.d @@ -0,0 +1,7 @@ +#!/bin/sh -e + +for rc in /etc/Muttrc.d/*.rc; do + test -r "$rc" && echo "source \"$rc\"" +done + +# vi: ft=sh --- mutt-1.5.21.orig/debian/extra/lib/debian-ldap-query +++ mutt-1.5.21/debian/extra/lib/debian-ldap-query @@ -0,0 +1,48 @@ +#!/usr/bin/perl -w +# by Ben Collins , butchered by Marco d'Itri +# to use, add to ~/.muttrc: +# set query_command="/usr/lib/mutt/debian-ldap-query %s" + +use strict; + +my @attrs = qw(sn mn cn ircnick uid); +my $base = 'ou=users, dc=debian, dc=org'; +my $server = 'db.debian.org'; +my $port = 389; + +die "Usage: $0 [...]\n" if not $ARGV[0]; + +eval 'require Net::LDAP;'; +if ($@) { + $@ =~ s/ in \@INC.*/./; + die "Could not load Net::LDAP: $@\n" . + "(Warning: this script depends on the libnet-ldap-perl (>=0.22-1) package.)\n" +} + +my $ldap = Net::LDAP->new($server, port => $port) or + die "Could not contact LDAP server $server:$port"; +$ldap->bind or die 'Could not bind'; + +my @results; + +foreach my $search (@ARGV) { + my $query = join '', map { "($_=*$search*)" } @attrs; + my $mesg = $ldap->search( + base => $base, filter => "(|$query)", attrs => [ @attrs ] + ) or die 'Failed search'; + foreach my $entry ($mesg->entries) { + my $uid = $entry->get_value('uid') || next; + my $fname = $entry->get_value('cn') || ''; + my $mname = $entry->get_value('mn') || ''; + $mname .= ' ' if $mname; + my $lname = $entry->get_value('sn') || ''; + my $nick = $entry->get_value('ircnick')|| ''; + push @results, "<$uid\@debian.org>\t$fname $mname$lname\t($nick)\n"; + } +} + +$ldap->unbind; + +print 'Debian Developer query: found ', scalar @results, "\n", @results; +exit 1 if not @results; +exit 0; --- mutt-1.5.21.orig/debian/extra/lib/mailto-mutt +++ mutt-1.5.21/debian/extra/lib/mailto-mutt @@ -0,0 +1,8 @@ +#!/bin/sh +# +# mailto-mutt -- wrapper to use mutt as mailto handler from Iceweasel +# +# If you want Iceweasel 3.x to use this wrapper for mailto URLs, go to Edit > +# Preferences > Applications, and set "mailto" to "/usr/lib/mutt/mailto-mutt". + +exec x-terminal-emulator -e mutt "$@" --- mutt-1.5.21.orig/debian/extra/lib/mailspell +++ mutt-1.5.21/debian/extra/lib/mailspell @@ -0,0 +1,77 @@ +#!/usr/bin/perl +# +# Wrapper to call ispell on mail messages, ignoring quoted portions +# and signatures. +# By Brendan O'Dea , public domain. +# Usage: set ispell = /usr/lib/mutt/mailspell +# + +use IO::File; +use POSIX 'tmpnam'; +use File::Copy 'move'; + +$0 =~ s#.*/##; + +my $ISPELL = 'ispell'; +my $DIFF = 'diff'; +my $ED = 'ed'; + +# make sure that we don't inherit SIGCHLD +$SIG{CHLD} = 'DEFAULT'; + +# ignore -x ispell option +shift if $ARGV[0] eq '-x'; +die "Usage: $0 [-x] FILE\n" unless @ARGV == 1; + +my $msg = $ARGV[0]; + +# create temporary files +my (%orig, %ed); + +END { + unlink $ed{path} if $ed{path}; + unlink $orig{path} if $orig{path}; +} + +foreach (\%orig, \%ed) { + $_->{path} = tmpnam; + $_->{fd} = IO::File->new($_->{path}, O_RDWR|O_CREAT|O_EXCL, 0600) + or die "$0: can't create $_->{path} ($!)"; +} + +while (<>) { + # stop at sigdashes + last if /^-- \n/; + + # drop quoted text and attribution + $orig{fd}->print($_) unless /^>/ or /^On \w{3}, \w{3} \d{2}, \d{4} at \d/; +} + +$orig{fd}->close; + +my $pid = fork; +die "$0: can't fork ($!)\n" unless defined $pid; +unless ($pid) { + open STDOUT, '>&=' . $ed{fd}->fileno + or die "$0: can't dup stdout to ed script ($!)\n"; + $ed{fd}->close; + exec $DIFF, '-e', $orig{path}, $msg; + die "$0: can't exec $DIFF ($!)\n"; +} + +die "$0: can't reap child ($!)\n" unless wait == $pid; +system $ISPELL, '-x', $orig{path} + and die "$0: problem with $ISPELL ($?)\n"; + +$ed{fd}->seek(0, SEEK_END); +$ed{fd}->print("w\nq\n"); +$ed{fd}->seek(0, SEEK_SET); + +open STDIN, '<&=' . $ed{fd}->fileno + or die "$0: can't dup stdin from ed script ($!)\n"; + +system $ED, '-s', $orig{path} and die "$0: problem with $ED ($?)\n"; +move $orig{path}, $msg or die "$0: can't replace $msg ($!)\n"; +delete $orig{path}; + +1; --- mutt-1.5.21.orig/debian/extra/rc/charset.rc +++ mutt-1.5.21/debian/extra/rc/charset.rc @@ -0,0 +1,9 @@ +# Some GB18030 traditional Chinese mails are wrongly labelled GB2312. +# The first charset is a superset of the second. Let's alias it, so +# that Mutt displays such mails as if they were correctly labelled. +charset-hook ^gb2312$ gb18030 + +# Some mailers send EUC-JP-MS Japanese mails wrongly labelled EUC-JP. +# The first charset is a superset of the second. Let's also alias it. +charset-hook ^euc-jp$ euc-jp-ms + --- mutt-1.5.21.orig/debian/extra/rc/Muttrc.foot +++ mutt-1.5.21/debian/extra/rc/Muttrc.foot @@ -0,0 +1,2 @@ +# See /usr/share/doc/mutt/README.Debian for details. +source /usr/lib/mutt/source-muttrc.d| --- mutt-1.5.21.orig/debian/extra/rc/compressed-folders.rc +++ mutt-1.5.21/debian/extra/rc/compressed-folders.rc @@ -0,0 +1,10 @@ +# Use folders which match on \\.gz$ or \\.bz2$ as [gb]zipped folders: +open-hook \\.gz$ "gzip -cd '%f' > '%t'" +close-hook \\.gz$ "gzip -c '%t' > '%f'" +append-hook \\.gz$ "gzip -c '%t' >> '%f'" +open-hook \\.bz2$ "bzip2 -cd '%f' > '%t'" +close-hook \\.bz2$ "bzip2 -c '%t' > '%f'" +append-hook \\.bz2$ "bzip2 -c '%t' >> '%f'" +open-hook \\.xz$ "xz -cd %f > %t" +close-hook \\.xz$ "xz -c %t > %f" +append-hook \\.xz$ "xz -c %t >> %f" --- mutt-1.5.21.orig/debian/extra/rc/colors.rc +++ mutt-1.5.21/debian/extra/rc/colors.rc @@ -0,0 +1,19 @@ +# colors +color normal white black +color attachment brightyellow black +color hdrdefault cyan black +color indicator black cyan +color markers brightred black +color quoted green black +color signature cyan black +color status brightgreen blue +color tilde blue black +color tree red black +#color header brightgreen black ^From: +#color header brightcyan black ^To: +#color header brightcyan black ^Reply-To: +#color header brightcyan black ^Cc: +#color header brightblue black ^Subject: +#color body brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ +#color body brightblue black (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ + --- mutt-1.5.21.orig/debian/extra/mutt-patched.rc/sidebar.rc +++ mutt-1.5.21/debian/extra/mutt-patched.rc/sidebar.rc @@ -0,0 +1,5 @@ +# Configuration for the sidebar patch. +# See /usr/share/doc/mutt/README.Patches for documentation. + +ifdef sidebar_visible set sidebar_visible sidebar_width=20 + --- mutt-1.5.21.orig/debian/patches/series +++ mutt-1.5.21/debian/patches/series @@ -0,0 +1,68 @@ +# build system patches +misc/am-maintainer-mode + +# features +features/ifdef +features/xtitles +features/trash-folder +features/purge-message +features/imap_fast_trash +features/sensible_browser_position +features-old/patch-1.5.4.vk.pgp_verbose_mime +features/compressed-folders +features/compressed-folders.debian + +# Debian config +debian-specific/Muttrc +debian-specific/Md.etc_mailname_gethostbyname.diff +debian-specific/use_usr_bin_editor.diff +debian-specific/correct_docdir_in_man_page.diff +debian-specific/dont_document_not_present_features.diff +debian-specific/document_debian_defaults +debian-specific/assumed_charset-compat +debian-specific/467432-write_bcc.patch +debian-specific/566076-build_doc_adjustments.patch +misc/define-pgp_getkeys_command.diff +misc/gpg.rc-paths +misc/smime.rc + +# patches integrated from upstream mercurial +# drop them with a new upstream release +upstream/531430-imapuser.patch +upstream/537818-emptycharset.patch +upstream/543467-thread-segfault.patch +upstream/542817-smimekeys-tmpdir.patch +upstream/537694-segv-imap-headers.patch +upstream/548577-gpgme-1.2.patch +upstream/553321-ansi-escape-segfault.patch +upstream/568295-references.patch +upstream/547980-smime_keys-chaining.patch +upstream/528233-readonly-open.patch +upstream/228671-pipe-mime.patch +upstream/383769-score-match.patch +upstream/578087-header-strchr.patch + +upstream/603288-split-fetches.patch +upstream/537061-dont-recode-saved-attachments.patch +upstream/608706-fix-spelling-errors.patch + +upstream/path_max + +# Ubuntu cherry-pick from upstream +ubuntu/lp-693244-autoview + +mutt.org +# extra patches for mutt-patched +mutt-patched/sidebar +mutt-patched/sidebar-dotted +mutt-patched/sidebar-sorted + +# not applying cleanly at the moment +#mutt-patched/nntp + +# unapplied patches for custom packages +# not-applied/chdir +# not-applied/indexcolor +# not-applied/w3mface +# unapplied, not stable at the moment +#mutt-patched/sidebar-newonly --- mutt-1.5.21.orig/debian/patches/mutt.org +++ mutt-1.5.21/debian/patches/mutt.org @@ -0,0 +1,6 @@ +Dummy patch to serve as marker separating patches for mutt-patched + +--- /dev/null ++++ b/.mutt.org +@@ -0,0 +1 @@ ++# dummy patch to serve as marker separating patches for mutt-patched --- mutt-1.5.21.orig/debian/patches/features/xtitles +++ mutt-1.5.21/debian/patches/features/xtitles @@ -0,0 +1,166 @@ +# vi: ft=diff +This is the xterm title patch as found on the mutt mailing lists. + +* Changes made: + - 2007-01-27 myon: using %P caused a segfault, updated status.c to catch + menu==NULL. + - 2007-02-20 myon: make the note about the xterm_set_titles defaults a + comment. + - 2008-08-02 myon: move set_xterm_* prototypes into the proper header file + (cleaner code, no functional change, evades conflict with sidebar patch) + +== END PATCH +--- a/curs_main.c ++++ b/curs_main.c +@@ -110,6 +110,19 @@ + + extern size_t UngetCount; + ++#define ASCII_CTRL_G 0x07 ++#define ASCII_CTRL_OPEN_SQUARE_BRAKET 0x1b ++ ++void set_xterm_title_bar(char *title) ++{ ++ fprintf(stderr ,"%c]2;%s%c", ASCII_CTRL_OPEN_SQUARE_BRAKET, title, ASCII_CTRL_G); ++} ++ ++void set_xterm_icon_name(char *name) ++{ ++ fprintf(stderr, "%c]1;%s%c", ASCII_CTRL_OPEN_SQUARE_BRAKET, name, ASCII_CTRL_G); ++} ++ + void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num) + { + format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX; +@@ -562,6 +575,13 @@ + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + menu->redraw &= ~REDRAW_STATUS; ++ if (option(OPTXTERMSETTITLES)) ++ { ++ menu_status_line (buf, sizeof (buf), menu, NONULL (XtermTitle)); ++ set_xterm_title_bar(buf); ++ menu_status_line (buf, sizeof (buf), menu, NONULL (XtermIcon)); ++ set_xterm_icon_name(buf); ++ } + } + + menu->redraw = 0; +--- a/globals.h ++++ b/globals.h +@@ -141,6 +141,8 @@ + WHERE char *Tochars; + WHERE char *Username; + WHERE char *Visual; ++WHERE char *XtermTitle; ++WHERE char *XtermIcon; + + WHERE char *CurrentFolder; + WHERE char *LastFolder; +--- a/init.c ++++ b/init.c +@@ -1873,6 +1873,26 @@ + toggle_option (MuttVars[idx].data); + else + set_option (MuttVars[idx].data); ++ ++ /* sanity check for xterm */ ++ if ((mutt_strcmp (MuttVars[idx].option, "xterm_set_titles") == 0) ++ && option (OPTXTERMSETTITLES)) ++ { ++ char *ep = getenv ("TERM"); ++ /* Make sure that the terminal can take the control codes */ ++ if (ep == NULL) unset_option (MuttVars[idx].data); ++ else if (mutt_strncasecmp (ep, "xterm", 5) && ++ mutt_strncasecmp (ep, "color-xterm", 11) && ++ mutt_strncasecmp (ep, "eterm", 5) && ++ mutt_strncasecmp (ep, "kterm", 5) && ++ mutt_strncasecmp (ep, "nxterm", 6) && ++ mutt_strncasecmp (ep, "putty", 5) && ++ mutt_strncasecmp (ep, "screen", 6) && ++ mutt_strncasecmp (ep, "cygwin", 6) && ++ mutt_strncasecmp (ep, "rxvt", 4) ) ++ unset_option (MuttVars[idx]. data); ++ ++ } + } + else if (myvar || DTYPE (MuttVars[idx].type) == DT_STR || + DTYPE (MuttVars[idx].type) == DT_PATH || +--- a/init.h ++++ b/init.h +@@ -3364,6 +3364,27 @@ + ** Also see the $$read_inc, $$net_inc and $$time_inc variables and the + ** ``$tuning'' section of the manual for performance considerations. + */ ++ {"xterm_icon", DT_STR, R_BOTH, UL &XtermIcon, UL "M%?n?AIL&ail?"}, ++ /* ++ ** .pp ++ ** Controls the format of the icon title, as long as xterm_set_titles ++ ** is enabled. This string is identical in formatting to the one used by ++ ** ``$$status_format''. ++ */ ++ {"xterm_set_titles", DT_BOOL, R_BOTH, OPTXTERMSETTITLES, 0}, ++ /* The default must be off to force in the validity checking. */ ++ /* ++ ** .pp ++ ** Controls whether mutt sets the xterm title bar and icon name ++ ** (as long as you are in an appropriate terminal). ++ */ ++ {"xterm_title", DT_STR, R_BOTH, UL &XtermTitle, UL "Mutt with %?m?%m messages&no messages?%?n? [%n NEW]?"}, ++ /* ++ ** .pp ++ ** Controls the format of the title bar of the xterm provided that ++ ** xterm_set_titles has been set. This string is identical in formatting ++ ** to the one used by ``$$status_format''. ++ */ + /*--*/ + { NULL, 0, 0, 0, 0 } + }; +--- a/mutt.h ++++ b/mutt.h +@@ -447,6 +447,7 @@ + OPTWRAPSEARCH, + OPTWRITEBCC, /* write out a bcc header? */ + OPTXMAILER, ++ OPTXTERMSETTITLES, + + OPTCRYPTUSEGPGME, + OPTCRYPTUSEPKA, +--- a/pager.c ++++ b/pager.c +@@ -1812,6 +1812,13 @@ + } + BKGDSET (MT_COLOR_NORMAL); + SETCOLOR (MT_COLOR_NORMAL); ++ if (option(OPTXTERMSETTITLES)) ++ { ++ menu_status_line (buffer, sizeof (buffer), index, NONULL (XtermTitle)); ++ set_xterm_title_bar(buffer); ++ menu_status_line (buffer, sizeof (buffer), index, NONULL (XtermIcon)); ++ set_xterm_icon_name(buffer); ++ } + } + + if ((redraw & REDRAW_INDEX) && index) +--- a/status.c ++++ b/status.c +@@ -195,6 +195,8 @@ + break; + + case 'P': ++ if (!menu) ++ break; + if (menu->top + menu->pagelen >= menu->max) + cp = menu->top ? "end" : "all"; + else +--- a/mutt_menu.h ++++ b/mutt_menu.h +@@ -103,6 +103,8 @@ + void menu_current_bottom (MUTTMENU *); + void menu_check_recenter (MUTTMENU *); + void menu_status_line (char *, size_t, MUTTMENU *, const char *); ++void set_xterm_title_bar (char *title); ++void set_xterm_icon_name (char *name); + + MUTTMENU *mutt_new_menu (int); + void mutt_menuDestroy (MUTTMENU **); --- mutt-1.5.21.orig/debian/patches/features/imap_fast_trash +++ mutt-1.5.21/debian/patches/features/imap_fast_trash @@ -0,0 +1,100 @@ +http://marc.info/?l=mutt-dev&m=128045511126422 + +Make "move to trash folder" use IMAP COPY. + +by Paul Miller (jettero) + +--- a/imap/imap.c ++++ b/imap/imap.c +@@ -893,6 +893,12 @@ static int imap_make_msg_set (IMAP_DATA* + if (hdrs[n]->deleted != HEADER_DATA(hdrs[n])->deleted) + match = invert ^ hdrs[n]->deleted; + break; ++ case M_EXPIRED: /* imap_fast_trash version of M_DELETED */ ++ if (hdrs[n]->purged) ++ break; ++ if (hdrs[n]->deleted != HEADER_DATA(hdrs[n])->deleted) ++ match = invert ^ hdrs[n]->deleted; ++ break; + case M_FLAG: + if (hdrs[n]->flagged != HEADER_DATA(hdrs[n])->flagged) + match = invert ^ hdrs[n]->flagged; +@@ -2028,3 +2034,54 @@ int imap_complete(char* dest, size_t dle + + return -1; + } ++ ++int imap_fast_trash() { ++ ++ if( Context->magic == M_IMAP && mx_is_imap(TrashPath) ) { ++ IMAP_MBOX mx; ++ IMAP_DATA *idata = (IMAP_DATA *) Context->data; ++ char mbox[LONG_STRING]; ++ char mmbox[LONG_STRING]; ++ int rc; ++ dprint(1, (debugfile, "[itf] trashcan seems to be on imap.\n")); ++ ++ if ( imap_parse_path(TrashPath, &mx) == 0 ) { ++ if( mutt_account_match(&(idata->conn->account), &(mx.account)) ) { ++ dprint(1, (debugfile, "[itf] trashcan seems to be on the same account.\n")); ++ ++ imap_fix_path (idata, mx.mbox, mbox, sizeof (mbox)); ++ if (!*mbox) ++ strfcpy (mbox, "INBOX", sizeof (mbox)); ++ imap_munge_mbox_name (mmbox, sizeof (mmbox), mbox); ++ ++ rc = imap_exec_msgset (idata, "UID COPY", mmbox, M_EXPIRED, 0, 0); ++ if (!rc) { ++ dprint (1, (debugfile, "imap_copy_messages: No messages del-tagged\n")); ++ rc = -1; ++ goto old_way; ++ ++ } else if (rc < 0) { ++ dprint (1, (debugfile, "could not queue copy\n")); ++ goto old_way; ++ ++ } else { ++ mutt_message (_("Copying %d messages to %s..."), rc, mbox); ++ return 0; ++ } ++ ++ } else { ++ dprint(1, (debugfile, "[itf] trashcan seems to be on a different account.\n")); ++ } ++ ++ old_way: ++ FREE (&mx.mbox); /* we probably only need to free this when the parse works */ ++ ++ } else { ++ dprint(1, (debugfile, "[itf] failed to parse TrashPath.\n" )); ++ } ++ ++ dprint(1, (debugfile, "[itf] giving up and trying old fasioned way.\n" )); ++ } ++ ++ return 1; ++} +--- a/imap/imap.h ++++ b/imap/imap.h +@@ -72,4 +72,7 @@ void imap_keepalive (void); + + int imap_account_match (const ACCOUNT* a1, const ACCOUNT* a2); + ++/* trash */ ++int imap_fast_trash(); ++ + #endif +--- a/mx.c ++++ b/mx.c +@@ -802,6 +802,11 @@ static int trash_append (CONTEXT *ctx) + && stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev) + return 0; /* we are in the trash folder: simple sync */ + ++ #ifdef USE_IMAP ++ if( !imap_fast_trash() ) ++ return 0; ++ #endif ++ + if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL) + { + for (i = 0 ; i < ctx->msgcount ; i++) --- mutt-1.5.21.orig/debian/patches/features/purge-message +++ mutt-1.5.21/debian/patches/features/purge-message @@ -0,0 +1,211 @@ +# vim:ft=diff: +This is the purge message patch by Cedric Duval . + +(requires trash folder patch) + +This patch adds the purge-message function, which, unlike delete-message, will +bypass the trash folder and really delete the mail. + +You can bind this function to D, for instance, by adding the following +lines to your muttrc: + +bind index \eD purge-message +bind pager \eD purge-message + +Please be very careful with this function, and try to use it as less as +possible. The risk resides in getting into the habit of always using +purge-message instead of delete-message, which would really defeat the purpose +of having a trash folder feature. + +* Patch last synced with upstream: + - Date: 2007-02-15 + - File: http://cedricduval.free.fr/mutt/patches/download/patch-1.5.5.1.cd.purge_message.3.4 + +* Changes made: + - Updated to 1.5.13 + - Fixed indentation of "purged" in mutt.h. + +== END PATCH +--- a/OPS ++++ b/OPS +@@ -142,6 +142,7 @@ + OP_PREV_LINE "scroll up one line" + OP_PREV_PAGE "move to the previous page" + OP_PRINT "print the current entry" ++OP_PURGE_MESSAGE "really delete the current entry, bypassing the trash folder" + OP_QUERY "query external program for addresses" + OP_QUERY_APPEND "append new query results to current results" + OP_QUIT "save changes to mailbox and quit" +--- a/curs_main.c ++++ b/curs_main.c +@@ -1843,6 +1843,7 @@ + MAYBE_REDRAW (menu->redraw); + break; + ++ case OP_PURGE_MESSAGE: + case OP_DELETE: + + CHECK_MSGCOUNT; +@@ -1853,6 +1854,7 @@ + if (tag) + { + mutt_tag_set_flag (M_DELETE, 1); ++ mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1); + if (option (OPTDELETEUNTAG)) + mutt_tag_set_flag (M_TAG, 0); + menu->redraw = REDRAW_INDEX; +@@ -1860,6 +1862,8 @@ + else + { + mutt_set_flag (Context, CURHDR, M_DELETE, 1); ++ mutt_set_flag (Context, CURHDR, M_PURGED, ++ (op != OP_PURGE_MESSAGE) ? 0 : 1); + if (option (OPTDELETEUNTAG)) + mutt_set_flag (Context, CURHDR, M_TAG, 0); + if (option (OPTRESOLVE)) +@@ -2161,11 +2165,13 @@ + if (tag) + { + mutt_tag_set_flag (M_DELETE, 0); ++ mutt_tag_set_flag (M_PURGED, 0); + menu->redraw = REDRAW_INDEX; + } + else + { + mutt_set_flag (Context, CURHDR, M_DELETE, 0); ++ mutt_set_flag (Context, CURHDR, M_PURGED, 0); + if (option (OPTRESOLVE) && menu->current < Context->vcount - 1) + { + menu->current++; +@@ -2186,9 +2192,11 @@ + CHECK_ACL(M_ACL_DELETE, _("undelete message(s)")); + + rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0, +- op == OP_UNDELETE_THREAD ? 0 : 1); ++ op == OP_UNDELETE_THREAD ? 0 : 1) ++ + mutt_thread_set_flag (CURHDR, M_PURGED, 0, ++ op == OP_UNDELETE_THREAD ? 0 : 1); + +- if (rc != -1) ++ if (rc > -1) + { + if (option (OPTRESOLVE)) + { +--- a/flags.c ++++ b/flags.c +@@ -104,6 +104,16 @@ + } + break; + ++ case M_PURGED: ++ if (bf) ++ { ++ if (!h->purged) ++ h->purged = 1; ++ } ++ else if (h->purged) ++ h->purged = 0; ++ break; ++ + case M_NEW: + + if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN)) +--- a/functions.h ++++ b/functions.h +@@ -121,6 +121,7 @@ + { "toggle-write", OP_TOGGLE_WRITE, "%" }, + { "next-thread", OP_MAIN_NEXT_THREAD, "\016" }, + { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" }, ++ { "purge-message", OP_PURGE_MESSAGE, NULL }, + { "query", OP_QUERY, "Q" }, + { "quit", OP_QUIT, "q" }, + { "reply", OP_REPLY, "r" }, +@@ -213,6 +214,7 @@ + { "print-message", OP_PRINT, "p" }, + { "previous-thread", OP_MAIN_PREV_THREAD, "\020" }, + { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" }, ++ { "purge-message", OP_PURGE_MESSAGE, NULL }, + { "quit", OP_QUIT, "Q" }, + { "exit", OP_EXIT, "q" }, + { "reply", OP_REPLY, "r" }, +--- a/mutt.h ++++ b/mutt.h +@@ -188,6 +188,7 @@ + M_UNDELETE, + M_DELETED, + M_APPENDED, ++ M_PURGED, + M_FLAG, + M_TAG, + M_UNTAG, +@@ -709,6 +710,7 @@ + unsigned int flagged : 1; /* marked important? */ + unsigned int tagged : 1; + unsigned int appended : 1; /* has been saved */ ++ unsigned int purged : 1; /* bypassing the trash folder */ + unsigned int deleted : 1; + unsigned int changed : 1; + unsigned int attach_del : 1; /* has an attachment marked for deletion */ +--- a/mx.c ++++ b/mx.c +@@ -806,6 +806,7 @@ + { + for (i = 0 ; i < ctx->msgcount ; i++) + if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended ++ && !ctx->hdrs[i]->purged + && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1) + { + mx_close_mailbox (ctx_trash, NULL); +--- a/pager.c ++++ b/pager.c +@@ -2343,12 +2343,15 @@ + MAYBE_REDRAW (redraw); + break; + ++ case OP_PURGE_MESSAGE: + case OP_DELETE: + CHECK_MODE(IsHeader (extra)); + CHECK_READONLY; + CHECK_ACL(M_ACL_DELETE, _("delete message")); + + mutt_set_flag (Context, extra->hdr, M_DELETE, 1); ++ mutt_set_flag (Context, extra->hdr, M_PURGED, ++ ch != OP_PURGE_MESSAGE ? 0 : 1); + if (option (OPTDELETEUNTAG)) + mutt_set_flag (Context, extra->hdr, M_TAG, 0); + redraw = REDRAW_STATUS | REDRAW_INDEX; +@@ -2675,6 +2678,7 @@ + CHECK_ACL(M_ACL_DELETE, _("undelete message")); + + mutt_set_flag (Context, extra->hdr, M_DELETE, 0); ++ mutt_set_flag (Context, extra->hdr, M_PURGED, 0); + redraw = REDRAW_STATUS | REDRAW_INDEX; + if (option (OPTRESOLVE)) + { +@@ -2690,9 +2694,11 @@ + CHECK_ACL(M_ACL_DELETE, _("undelete message(s)")); + + r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0, ++ ch == OP_UNDELETE_THREAD ? 0 : 1) ++ + mutt_thread_set_flag (extra->hdr, M_PURGED, 0, + ch == OP_UNDELETE_THREAD ? 0 : 1); + +- if (r != -1) ++ if (r > -1) + { + if (option (OPTRESOLVE)) + { +--- a/pattern.c ++++ b/pattern.c +@@ -1357,8 +1357,10 @@ + { + switch (op) + { +- case M_DELETE: + case M_UNDELETE: ++ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED, ++ 0); ++ case M_DELETE: + mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE, + (op == M_DELETE)); + break; --- mutt-1.5.21.orig/debian/patches/features/compressed-folders +++ mutt-1.5.21/debian/patches/features/compressed-folders @@ -0,0 +1,1123 @@ +# vi: ft=diff +This is the compressed folders patch by Roland Rosenfeld +. + +The home page for this patch is: + + http://www.spinnaker.de/mutt/compressed/ + +* Patch last synced with upstream: + - Date: 2008-05-20 + - File: http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz + +* Changes made: + - 2008-05-20 myon: refreshed to remove hunks in auto* files + - 2009-09-15 myon: refreshed for mutt-1.5.19 + status.c:103: add sizeof (tmp) to mutt_pretty_mailbox + - 2009-09-15 scotton: removed doc/Muttrc for mutt-1.5.19 (only patch doc/Muttrc.head) + - 2009-09-11 antonio: removed DefaultMagic, see 541360 + - 2010-05-31 myon: remove commented paragraph "Use folders..." in + doc/Muttrc.head, see #578096 + +== END PATCH +--- /dev/null ++++ b/compress.c +@@ -0,0 +1,496 @@ ++/* ++ * Copyright (C) 1997 Alain Penders ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#if HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include "mutt.h" ++ ++#ifdef USE_COMPRESSED ++ ++#include "mx.h" ++#include "mailbox.h" ++#include "mutt_curses.h" ++ ++#include ++#include ++#include ++#include ++ ++typedef struct ++{ ++ const char *close; /* close-hook command */ ++ const char *open; /* open-hook command */ ++ const char *append; /* append-hook command */ ++ off_t size; /* size of real folder */ ++} COMPRESS_INFO; ++ ++ ++/* ++ * ctx - context to lock ++ * excl - exclusive lock? ++ * retry - should retry if unable to lock? ++ */ ++int mbox_lock_compressed (CONTEXT *ctx, FILE *fp, int excl, int retry) ++{ ++ int r; ++ ++ if ((r = mx_lock_file (ctx->realpath, fileno (fp), excl, 1, retry)) == 0) ++ ctx->locked = 1; ++ else if (retry && !excl) ++ { ++ ctx->readonly = 1; ++ return 0; ++ } ++ ++ return (r); ++} ++ ++void mbox_unlock_compressed (CONTEXT *ctx, FILE *fp) ++{ ++ if (ctx->locked) ++ { ++ fflush (fp); ++ ++ mx_unlock_file (ctx->realpath, fileno (fp), 1); ++ ctx->locked = 0; ++ } ++} ++ ++static int is_new (const char *path) ++{ ++ return (access (path, W_OK) != 0 && errno == ENOENT) ? 1 : 0; ++} ++ ++static const char* find_compress_hook (int type, const char *path) ++{ ++ const char* c = mutt_find_hook (type, path); ++ return (!c || !*c) ? NULL : c; ++} ++ ++int mutt_can_read_compressed (const char *path) ++{ ++ return find_compress_hook (M_OPENHOOK, path) ? 1 : 0; ++} ++ ++/* ++ * if the file is new, we really do not append, but create, and so use ++ * close-hook, and not append-hook ++ */ ++static const char* get_append_command (const char *path, const CONTEXT* ctx) ++{ ++ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; ++ return (is_new (path)) ? ci->close : ci->append; ++} ++ ++int mutt_can_append_compressed (const char *path) ++{ ++ int magic; ++ ++ if (is_new (path)) ++ { ++ char *dir_path = safe_strdup(path); ++ char *aux = strrchr(dir_path, '/'); ++ int dir_valid = 1; ++ if (aux) ++ { ++ *aux='\0'; ++ if (access(dir_path, W_OK|X_OK)) ++ dir_valid = 0; ++ } ++ safe_free((void**)&dir_path); ++ return dir_valid && (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0); ++ } ++ ++ magic = mx_get_magic (path); ++ ++ if (magic != 0 && magic != M_COMPRESSED) ++ return 0; ++ ++ return (find_compress_hook (M_APPENDHOOK, path) ++ || (find_compress_hook (M_OPENHOOK, path) ++ && find_compress_hook (M_CLOSEHOOK, path))) ? 1 : 0; ++} ++ ++/* open a compressed mailbox */ ++static COMPRESS_INFO *set_compress_info (CONTEXT *ctx) ++{ ++ COMPRESS_INFO *ci; ++ ++ /* Now lets uncompress this thing */ ++ ci = safe_malloc (sizeof (COMPRESS_INFO)); ++ ctx->compressinfo = (void*) ci; ++ ci->append = find_compress_hook (M_APPENDHOOK, ctx->path); ++ ci->open = find_compress_hook (M_OPENHOOK, ctx->path); ++ ci->close = find_compress_hook (M_CLOSEHOOK, ctx->path); ++ return ci; ++} ++ ++static void set_path (CONTEXT* ctx) ++{ ++ char tmppath[_POSIX_PATH_MAX]; ++ ++ /* Setup the right paths */ ++ ctx->realpath = ctx->path; ++ ++ /* Uncompress to /tmp */ ++ mutt_mktemp (tmppath, sizeof(tmppath)); ++ ctx->path = safe_malloc (strlen (tmppath) + 1); ++ strcpy (ctx->path, tmppath); ++} ++ ++static int get_size (const char* path) ++{ ++ struct stat sb; ++ if (stat (path, &sb) != 0) ++ return 0; ++ return (sb.st_size); ++} ++ ++static void store_size (CONTEXT* ctx) ++{ ++ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; ++ ci->size = get_size (ctx->realpath); ++} ++ ++static const char * ++compresshook_format_str (char *dest, size_t destlen, size_t col, char op, ++ const char *src, const char *fmt, ++ const char *ifstring, const char *elsestring, ++ unsigned long data, format_flag flags) ++{ ++ char tmp[SHORT_STRING]; ++ ++ CONTEXT *ctx = (CONTEXT *) data; ++ switch (op) ++ { ++ case 'f': ++ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); ++ snprintf (dest, destlen, tmp, ctx->realpath); ++ break; ++ case 't': ++ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); ++ snprintf (dest, destlen, tmp, ctx->path); ++ break; ++ } ++ return (src); ++} ++ ++/* ++ * check that the command has both %f and %t ++ * 0 means OK, -1 means error ++ */ ++int mutt_test_compress_command (const char* cmd) ++{ ++ return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1; ++} ++ ++static char *get_compression_cmd (const char* cmd, const CONTEXT* ctx) ++{ ++ char expanded[_POSIX_PATH_MAX]; ++ mutt_FormatString (expanded, sizeof (expanded), 0, cmd, ++ compresshook_format_str, (unsigned long) ctx, 0); ++ return safe_strdup (expanded); ++} ++ ++int mutt_check_mailbox_compressed (CONTEXT* ctx) ++{ ++ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; ++ if (ci->size != get_size (ctx->realpath)) ++ { ++ FREE (&ctx->compressinfo); ++ FREE (&ctx->realpath); ++ mutt_error _("Mailbox was corrupted!"); ++ return (-1); ++ } ++ return (0); ++} ++ ++int mutt_open_read_compressed (CONTEXT *ctx) ++{ ++ char *cmd; ++ FILE *fp; ++ int rc; ++ ++ COMPRESS_INFO *ci = set_compress_info (ctx); ++ if (!ci->open) { ++ ctx->magic = 0; ++ FREE (&ctx->compressinfo); ++ return (-1); ++ } ++ if (!ci->close || access (ctx->path, W_OK) != 0) ++ ctx->readonly = 1; ++ ++ set_path (ctx); ++ store_size (ctx); ++ ++ if (!ctx->quiet) ++ mutt_message (_("Decompressing %s..."), ctx->realpath); ++ ++ cmd = get_compression_cmd (ci->open, ctx); ++ if (cmd == NULL) ++ return (-1); ++ dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd)); ++ ++ if ((fp = fopen (ctx->realpath, "r")) == NULL) ++ { ++ mutt_perror (ctx->realpath); ++ FREE (&cmd); ++ return (-1); ++ } ++ mutt_block_signals (); ++ if (mbox_lock_compressed (ctx, fp, 0, 1) == -1) ++ { ++ fclose (fp); ++ mutt_unblock_signals (); ++ mutt_error _("Unable to lock mailbox!"); ++ FREE (&cmd); ++ return (-1); ++ } ++ ++ endwin (); ++ fflush (stdout); ++ fprintf (stderr, _("Decompressing %s...\n"),ctx->realpath); ++ rc = mutt_system (cmd); ++ mbox_unlock_compressed (ctx, fp); ++ mutt_unblock_signals (); ++ fclose (fp); ++ ++ if (rc) ++ { ++ mutt_any_key_to_continue (NULL); ++ ctx->magic = 0; ++ FREE (&ctx->compressinfo); ++ mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd); ++ } ++ FREE (&cmd); ++ if (rc) ++ return (-1); ++ ++ if (mutt_check_mailbox_compressed (ctx)) ++ return (-1); ++ ++ ctx->magic = mx_get_magic (ctx->path); ++ ++ return (0); ++} ++ ++void restore_path (CONTEXT* ctx) ++{ ++ FREE (&ctx->path); ++ ctx->path = ctx->realpath; ++} ++ ++/* remove the temporary mailbox */ ++void remove_file (CONTEXT* ctx) ++{ ++ if (ctx->magic == M_MBOX || ctx->magic == M_MMDF) ++ remove (ctx->path); ++} ++ ++int mutt_open_append_compressed (CONTEXT *ctx) ++{ ++ FILE *fh; ++ COMPRESS_INFO *ci = set_compress_info (ctx); ++ ++ if (!get_append_command (ctx->path, ctx)) ++ { ++ if (ci->open && ci->close) ++ return (mutt_open_read_compressed (ctx)); ++ ++ ctx->magic = 0; ++ FREE (&ctx->compressinfo); ++ return (-1); ++ } ++ ++ set_path (ctx); ++ ++ if (!is_new (ctx->realpath)) ++ if ((fh = fopen (ctx->path, "w"))) ++ fclose (fh); ++ /* No error checking - the parent function will catch it */ ++ ++ return (0); ++} ++ ++/* close a compressed mailbox */ ++void mutt_fast_close_compressed (CONTEXT *ctx) ++{ ++ dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n", ++ ctx->path)); ++ ++ if (ctx->compressinfo) ++ { ++ if (ctx->fp) ++ fclose (ctx->fp); ++ ctx->fp = NULL; ++ /* if the folder was removed, remove the gzipped folder too */ ++ if ((ctx->magic > 0) ++ && (access (ctx->path, F_OK) != 0) ++ && ! option (OPTSAVEEMPTY)) ++ remove (ctx->realpath); ++ else ++ remove_file (ctx); ++ ++ restore_path (ctx); ++ FREE (&ctx->compressinfo); ++ } ++} ++ ++/* return 0 on success, -1 on failure */ ++int mutt_sync_compressed (CONTEXT* ctx) ++{ ++ char *cmd; ++ int rc = 0; ++ FILE *fp; ++ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; ++ ++ if (!ctx->quiet) ++ mutt_message (_("Compressing %s..."), ctx->realpath); ++ ++ cmd = get_compression_cmd (ci->close, ctx); ++ if (cmd == NULL) ++ return (-1); ++ ++ if ((fp = fopen (ctx->realpath, "a")) == NULL) ++ { ++ mutt_perror (ctx->realpath); ++ FREE (&cmd); ++ return (-1); ++ } ++ mutt_block_signals (); ++ if (mbox_lock_compressed (ctx, fp, 1, 1) == -1) ++ { ++ fclose (fp); ++ mutt_unblock_signals (); ++ mutt_error _("Unable to lock mailbox!"); ++ store_size (ctx); ++ FREE (&cmd); ++ return (-1); ++ } ++ ++ dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd)); ++ ++ endwin (); ++ fflush (stdout); ++ fprintf (stderr, _("Compressing %s...\n"), ctx->realpath); ++ if (mutt_system (cmd)) ++ { ++ mutt_any_key_to_continue (NULL); ++ mutt_error (_("%s: Error compressing mailbox! Original mailbox deleted, uncompressed one kept!\n"), ctx->path); ++ rc = -1; ++ } ++ ++ mbox_unlock_compressed (ctx, fp); ++ mutt_unblock_signals (); ++ fclose (fp); ++ ++ FREE (&cmd); ++ ++ store_size (ctx); ++ ++ return (rc); ++} ++ ++int mutt_slow_close_compressed (CONTEXT *ctx) ++{ ++ FILE *fp; ++ const char *append; ++ char *cmd; ++ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; ++ ++ dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n", ++ ctx->path)); ++ ++ if (! (ctx->append ++ && ((append = get_append_command (ctx->realpath, ctx)) ++ || (append = ci->close)))) ++ { ++ /* if we can not or should not append, we only have to remove the */ ++ /* compressed info, because sync was already called */ ++ mutt_fast_close_compressed (ctx); ++ return (0); ++ } ++ ++ if (ctx->fp) ++ fclose (ctx->fp); ++ ctx->fp = NULL; ++ ++ if (!ctx->quiet) ++ { ++ if (append == ci->close) ++ mutt_message (_("Compressing %s..."), ctx->realpath); ++ else ++ mutt_message (_("Compressed-appending to %s..."), ctx->realpath); ++ } ++ ++ cmd = get_compression_cmd (append, ctx); ++ if (cmd == NULL) ++ return (-1); ++ ++ if ((fp = fopen (ctx->realpath, "a")) == NULL) ++ { ++ mutt_perror (ctx->realpath); ++ FREE (&cmd); ++ return (-1); ++ } ++ mutt_block_signals (); ++ if (mbox_lock_compressed (ctx, fp, 1, 1) == -1) ++ { ++ fclose (fp); ++ mutt_unblock_signals (); ++ mutt_error _("Unable to lock mailbox!"); ++ FREE (&cmd); ++ return (-1); ++ } ++ ++ dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd)); ++ ++ endwin (); ++ fflush (stdout); ++ ++ if (append == ci->close) ++ fprintf (stderr, _("Compressing %s...\n"), ctx->realpath); ++ else ++ fprintf (stderr, _("Compressed-appending to %s...\n"), ctx->realpath); ++ ++ if (mutt_system (cmd)) ++ { ++ mutt_any_key_to_continue (NULL); ++ mutt_error (_(" %s: Error compressing mailbox! Uncompressed one kept!\n"), ++ ctx->path); ++ FREE (&cmd); ++ mbox_unlock_compressed (ctx, fp); ++ mutt_unblock_signals (); ++ fclose (fp); ++ return (-1); ++ } ++ ++ mbox_unlock_compressed (ctx, fp); ++ mutt_unblock_signals (); ++ fclose (fp); ++ remove_file (ctx); ++ restore_path (ctx); ++ FREE (&cmd); ++ FREE (&ctx->compressinfo); ++ ++ return (0); ++} ++ ++#endif /* USE_COMPRESSED */ +--- /dev/null ++++ b/compress.h +@@ -0,0 +1,27 @@ ++/* ++ * Copyright (C) 1997 Alain Penders ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++int mutt_can_read_compressed (const char *); ++int mutt_can_append_compressed (const char *); ++int mutt_open_read_compressed (CONTEXT *); ++int mutt_open_append_compressed (CONTEXT *); ++int mutt_slow_close_compressed (CONTEXT *); ++int mutt_sync_compressed (CONTEXT *); ++int mutt_test_compress_command (const char *); ++int mutt_check_mailbox_compressed (CONTEXT *); ++void mutt_fast_close_compressed (CONTEXT *); +--- a/configure.ac ++++ b/configure.ac +@@ -812,6 +812,11 @@ + AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ]) + fi]) + ++AC_ARG_ENABLE(compressed, AC_HELP_STRING([--enable-compressed], [Enable compressed folders support]), ++ [if test x$enableval = xyes; then ++ AC_DEFINE(USE_COMPRESSED,1, [ Define to support compressed folders. ]) ++ fi]) ++ + AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), + [if test $withval != yes; then + AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", +--- a/curs_main.c ++++ b/curs_main.c +@@ -1153,6 +1153,11 @@ + { + int check; + ++#ifdef USE_COMPRESSED ++ if (Context->compressinfo && Context->realpath) ++ mutt_str_replace (&LastFolder, Context->realpath); ++ else ++#endif + mutt_str_replace (&LastFolder, Context->path); + oldcount = Context ? Context->msgcount : 0; + +--- a/doc/manual.xml.head ++++ b/doc/manual.xml.head +@@ -6116,6 +6116,205 @@ + + + ++ ++Compressed folders Support (OPTIONAL) ++ ++ ++If Mutt was compiled with compressed folders support (by running the ++configure script with the ++--enable-compressed flag), Mutt can open folders ++stored in an arbitrary format, provided that the user has a script to ++convert from/to this format to one of the accepted. ++ ++The most common use is to open compressed archived folders e.g. with ++gzip. ++ ++In addition, the user can provide a script that gets a folder in an ++accepted format and appends its context to the folder in the ++user-defined format, which may be faster than converting the entire ++folder to the accepted format, appending to it and converting back to ++the user-defined format. ++ ++There are three hooks defined (open-hook, close-hook and append-hook) which define commands to ++uncompress and compress a folder and to append messages to an existing ++compressed folder respectively. ++ ++For example: ++ ++ ++open-hook \\.gz$ "gzip -cd %f > %t" ++close-hook \\.gz$ "gzip -c %t > %f" ++append-hook \\.gz$ "gzip -c %t >> %f" ++ ++ ++You do not have to specify all of the commands. If you omit append-hook, the folder will be open and ++closed again each time you will add to it. If you omit close-hook (or give empty command) , the ++folder will be open in the mode. If you specify append-hook though you'll be able to ++append to the folder. ++ ++Note that Mutt will only try to use hooks if the file is not in one of ++the accepted formats. In particular, if the file is empty, mutt ++supposes it is not compressed. This is important because it allows the ++use of programs that do not have well defined extensions. Just use ++"." as a regexp. But this may be surprising if your ++compressing script produces empty files. In this situation, unset ++$save_empty, so that ++the compressed file will be removed if you delete all of the messages. ++ ++ ++ ++Open a compressed mailbox for reading ++ ++ ++Usage: open-hook regexp "command" ++ ++The command is the command that can be used for ++opening the folders whose names match regexp. ++ ++The command string is the printf-like format ++string, and it should accept two parameters: %f, which is ++replaced with the (compressed) folder name, and %t which is ++replaced with the name of the temporary folder to which to write. ++ ++%f and %t can be repeated any number of times in the ++command string, and all of the entries are replaced with the ++appropriate folder name. In addition, %% is replaced by ++%, as in printf, and any other %anything is left as is. ++ ++The command should not remove the original compressed file. The ++command should return non-zero exit status if it ++fails, so mutt knows something's wrong. ++ ++Example: ++ ++ ++open-hook \\.gz$ "gzip -cd %f > %t" ++ ++ ++If the command is empty, this operation is ++disabled for this file type. ++ ++ ++ ++ ++Write a compressed mailbox ++ ++ ++Usage: close-hook regexp "command" ++ ++This is used to close the folder that was open with the open-hook command after some changes were ++made to it. ++ ++The command string is the command that can be ++used for closing the folders whose names match ++regexp. It has the same format as in the open-hook command. Temporary folder in this ++case is the folder previously produced by the open-hook command. ++ ++The command should not remove the decompressed file. The ++command should return non-zero exit status if it ++fails, so mutt knows something's wrong. ++ ++Example: ++ ++ ++close-hook \\.gz$ "gzip -c %t > %f" ++ ++ ++If the command is empty, this operation is ++disabled for this file type, and the file can only be open in the ++read-only mode. ++ ++close-hook is not called when you ++exit from the folder if the folder was not changed. ++ ++ ++ ++ ++Append a message to a compressed mailbox ++ ++ ++Usage: append-hook regexp "command" ++ ++This command is used for saving to an existing compressed folder. The ++command is the command that can be used for ++appending to the folders whose names match ++regexp. It has the same format as in the open-hook command. The temporary folder in ++this case contains the messages that are being appended. ++ ++The command should not remove the decompressed file. The ++command should return non-zero exit status if it ++fails, so mutt knows something's wrong. ++ ++Example: ++ ++ ++append-hook \\.gz$ "gzip -c %t >> %f" ++ ++ ++When append-hook is used, the folder ++is not opened, which saves time, but this means that we can not find ++out what the folder type is. Thus the default ($mbox_type) type is always ++supposed (i.e. this is the format used for the temporary folder). ++ ++If the file does not exist when you save to it, close-hook is called, and not append-hook. append-hook is only for appending to ++existing folders. ++ ++If the command is empty, this operation is ++disabled for this file type. In this case, the folder will be open and ++closed again (using open-hook and ++close-hookrespectively) each time you ++will add to it. ++ ++ ++ ++ ++Encrypted folders ++ ++ ++The compressed folders support can also be used to handle encrypted ++folders. If you want to encrypt a folder with PGP, you may want to use ++the following hooks: ++ ++ ++open-hook \\.pgp$ "pgp -f < %f > %t" ++close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId < %t > %f" ++ ++ ++Please note, that PGP does not support appending to an encrypted ++folder, so there is no append-hook defined. ++ ++If you are using GnuPG instead of PGP, you may use the following hooks ++instead: ++ ++ ++open-hook \\.gpg$ "gpg --decrypt < %f > %t" ++close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId < %t > %f" ++ ++ ++Note: the folder is temporary stored ++decrypted in the /tmp directory, where it can be read by your system ++administrator. So think about the security aspects of this. ++ ++ ++ ++ + + Mutt's MIME Support + +--- a/doc/muttrc.man.head ++++ b/doc/muttrc.man.head +@@ -346,6 +346,24 @@ + to a certain recipient. The meaning of "key ID" is to be taken + broadly: This can be a different e-mail address, a numerical key ID, + or even just an arbitrary search string. ++.PP ++.nf ++\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP" ++\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP" ++\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP" ++.fi ++.IP ++These commands provide a way to handle compressed folders. The given ++\fBregexp\fP specifies which folders are taken as compressed (e.g. ++"\fI\\\\.gz$\fP"). The commands tell Mutt how to uncompress a folder ++(\fBopen-hook\fP), compress a folder (\fBclose-hook\fP) or append a ++compressed mail to a compressed folder (\fBappend-hook\fP). The ++\fIcommand\fP string is the ++.BR printf (3) ++like format string, and it should accept two parameters: \fB%f\fP, ++which is replaced with the (compressed) folder name, and \fB%t\fP ++which is replaced with the name of the temporary folder to which to ++write. + .TP + \fBpush\fP \fIstring\fP + This command adds the named \fIstring\fP to the keyboard buffer. +--- a/hook.c ++++ b/hook.c +@@ -24,6 +24,10 @@ + #include "mailbox.h" + #include "mutt_crypt.h" + ++#ifdef USE_COMPRESSED ++#include "compress.h" ++#endif ++ + #include + #include + #include +@@ -92,6 +96,16 @@ + memset (&pattern, 0, sizeof (pattern)); + pattern.data = safe_strdup (path); + } ++#ifdef USE_COMPRESSED ++ else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK)) ++ { ++ if (mutt_test_compress_command (command.data)) ++ { ++ strfcpy (err->data, _("badly formatted command string"), err->dsize); ++ return (-1); ++ } ++ } ++#endif + else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ICONVHOOK | M_ACCOUNTHOOK)) + && (!WithCrypto || !(data & M_CRYPTHOOK)) + ) +--- a/init.h ++++ b/init.h +@@ -3530,6 +3530,11 @@ + { "fcc-hook", mutt_parse_hook, M_FCCHOOK }, + { "fcc-save-hook", mutt_parse_hook, M_FCCHOOK | M_SAVEHOOK }, + { "folder-hook", mutt_parse_hook, M_FOLDERHOOK }, ++#ifdef USE_COMPRESSED ++ { "open-hook", mutt_parse_hook, M_OPENHOOK }, ++ { "close-hook", mutt_parse_hook, M_CLOSEHOOK }, ++ { "append-hook", mutt_parse_hook, M_APPENDHOOK }, ++#endif + { "group", parse_group, M_GROUP }, + { "ungroup", parse_group, M_UNGROUP }, + { "hdr_order", parse_list, UL &HeaderOrderList }, +--- a/main.c ++++ b/main.c +@@ -401,6 +401,12 @@ + #else + "-LOCALES_HACK " + #endif ++ ++#ifdef USE_COMPRESSED ++ "+COMPRESSED " ++#else ++ "-COMPRESSED " ++#endif + + #ifdef HAVE_WC_FUNCS + "+HAVE_WC_FUNCS " +--- a/Makefile.am ++++ b/Makefile.am +@@ -22,7 +22,7 @@ + bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@ + mutt_SOURCES = \ + addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \ +- crypt.c cryptglue.c \ ++ crypt.c cryptglue.c compress.c \ + commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \ + edit.c enter.c flags.c init.c filter.c from.c \ + getdomain.c group.c \ +@@ -61,7 +61,7 @@ + bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h + + EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \ +- configure account.h \ ++ configure account.h compress.h \ + attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \ + globals.h hash.h history.h init.h keymap.h mutt_crypt.h \ + mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \ +--- a/mbox.c ++++ b/mbox.c +@@ -29,6 +29,10 @@ + #include "copy.h" + #include "mutt_curses.h" + ++#ifdef USE_COMPRESSED ++#include "compress.h" ++#endif ++ + #include + #include + #include +@@ -1070,6 +1074,12 @@ + int mbox_close_mailbox (CONTEXT *ctx) + { + mx_unlock_file (ctx->path, fileno (ctx->fp), 1); ++ ++#ifdef USE_COMPRESSED ++ if (ctx->compressinfo) ++ mutt_slow_close_compressed (ctx); ++#endif ++ + mutt_unblock_signals (); + mx_fastclose_mailbox (ctx); + return 0; +--- a/mutt.h ++++ b/mutt.h +@@ -146,6 +146,11 @@ + #define M_ACCOUNTHOOK (1<<9) + #define M_REPLYHOOK (1<<10) + #define M_SEND2HOOK (1<<11) ++#ifdef USE_COMPRESSED ++#define M_OPENHOOK (1<<12) ++#define M_APPENDHOOK (1<<13) ++#define M_CLOSEHOOK (1<<14) ++#endif + + /* tree characters for linearize_tree and print_enriched_string */ + #define M_TREE_LLCORNER 1 +@@ -887,6 +892,11 @@ + int flagged; /* how many flagged messages */ + int msgnotreadyet; /* which msg "new" in pager, -1 if none */ + ++#ifdef USE_COMPRESSED ++ void *compressinfo; /* compressed mbox module private data */ ++ char *realpath; /* path to compressed mailbox */ ++#endif /* USE_COMPRESSED */ ++ + short magic; /* mailbox type */ + + unsigned char rights[(RIGHTSMAX + 7)/8]; /* ACL bits */ +--- a/mx.c ++++ b/mx.c +@@ -30,6 +30,10 @@ + #include "keymap.h" + #include "url.h" + ++#ifdef USE_COMPRESSED ++#include "compress.h" ++#endif ++ + #ifdef USE_IMAP + #include "imap.h" + #endif +@@ -414,6 +418,10 @@ + return (-1); + } + ++#ifdef USE_COMPRESSED ++ if (magic == 0 && mutt_can_read_compressed (path)) ++ return M_COMPRESSED; ++#endif + return (magic); + } + +@@ -453,6 +461,13 @@ + { + struct stat sb; + ++#ifdef USE_COMPRESSED ++ /* special case for appending to compressed folders - ++ * even if we can not open them for reading */ ++ if (mutt_can_append_compressed (ctx->path)) ++ mutt_open_append_compressed (ctx); ++#endif ++ + ctx->append = 1; + + #ifdef USE_IMAP +@@ -616,7 +631,12 @@ + } + + ctx->magic = mx_get_magic (path); +- ++ ++#ifdef USE_COMPRESSED ++ if (ctx->magic == M_COMPRESSED) ++ mutt_open_read_compressed (ctx); ++#endif ++ + if(ctx->magic == 0) + mutt_error (_("%s is not a mailbox."), path); + +@@ -721,6 +741,10 @@ + mutt_free_header (&ctx->hdrs[i]); + FREE (&ctx->hdrs); + FREE (&ctx->v2r); ++#ifdef USE_COMPRESSED ++ if (ctx->compressinfo) ++ mutt_fast_close_compressed (ctx); ++#endif + FREE (&ctx->path); + FREE (&ctx->pattern); + if (ctx->limit_pattern) +@@ -773,6 +797,12 @@ + + if (tmp && tmp->new == 0) + mutt_update_mailbox (tmp); ++ ++#ifdef USE_COMPRESSED ++ if (rc == 0 && ctx->compressinfo) ++ return mutt_sync_compressed (ctx); ++#endif ++ + return rc; + } + +@@ -1043,6 +1073,11 @@ + !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY)) + mx_unlink_empty (ctx->path); + ++#ifdef USE_COMPRESSED ++ if (ctx->compressinfo && mutt_slow_close_compressed (ctx)) ++ return (-1); ++#endif ++ + mx_fastclose_mailbox (ctx); + + return 0; +@@ -1361,6 +1396,11 @@ + { + int rc; + ++#ifdef USE_COMPRESSED ++ if (ctx->compressinfo) ++ return mutt_check_mailbox_compressed (ctx); ++#endif ++ + if (ctx) + { + if (ctx->locked) lock = 0; +--- a/mx.h ++++ b/mx.h +@@ -36,6 +36,9 @@ + M_MAILDIR, + M_IMAP, + M_POP ++#ifdef USE_COMPRESSED ++ , M_COMPRESSED ++#endif + }; + + WHERE short DefaultMagic INITVAL (M_MBOX); +--- a/po/POTFILES.in ++++ b/po/POTFILES.in +@@ -8,6 +8,7 @@ + color.c + commands.c + compose.c ++compress.c + crypt-gpgme.c + crypt.c + cryptglue.c +--- a/status.c ++++ b/status.c +@@ -96,6 +96,14 @@ + + case 'f': + snprintf (fmt, sizeof(fmt), "%%%ss", prefix); ++#ifdef USE_COMPRESSED ++ if (Context && Context->compressinfo && Context->realpath) ++ { ++ strfcpy (tmp, Context->realpath, sizeof (tmp)); ++ mutt_pretty_mailbox (tmp, sizeof (tmp)); ++ } ++ else ++#endif + if (Context && Context->path) + { + strfcpy (tmp, Context->path, sizeof (tmp)); +--- a/po/de.po ++++ b/po/de.po +@@ -5159,6 +5159,36 @@ + msgid "show S/MIME options" + msgstr "Zeige S/MIME Optionen" + ++ ++#: compress.c:228 compress.c:253 ++#, c-format ++msgid "Decompressing %s...\n" ++msgstr "Entpacke %s...\n" ++ ++#: compress.c:350 compress.c:377 compress.c:423 compress.c:454 ++#, c-format ++msgid "Compressing %s...\n" ++msgstr "Komprimiere %s...\n" ++ ++#: compress.c:381 ++#, c-format ++msgid "" ++"%s: Error compressing mailbox! Original mailbox deleted, uncompressed one " ++"kept!\n" ++msgstr "" ++"%s: Fehler beim Komprimieren der Mailbox! Ursprngliche Mailbox gelscht, " ++"entpackte gespeichert!\n" ++ ++#: compress.c:425 compress.c:456 ++#, c-format ++msgid "Compressed-appending to %s...\n" ++msgstr "Hnge komprimiert an %s... an\n" ++ ++#: compress.c:461 ++#, c-format ++msgid " %s: Error compressing mailbox! Uncompressed one kept!\n" ++msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n" ++ + #~ msgid "Clear" + #~ msgstr "Klartext" + --- mutt-1.5.21.orig/debian/patches/features/compressed-folders.debian +++ mutt-1.5.21/debian/patches/features/compressed-folders.debian @@ -0,0 +1,9 @@ +to enable the use of compressed folders + +--- a/config-debian.h ++++ b/config-debian.h +@@ -0,0 +1,4 @@ ++#ifndef USE_COMPRESSED ++#error "You forgot to update debian/patches/autotools-update." ++#error "Run sh debian/update-autotools.sh" ++#endif --- mutt-1.5.21.orig/debian/patches/features/ifdef +++ mutt-1.5.21/debian/patches/features/ifdef @@ -0,0 +1,145 @@ +# vim:ft=diff: +This is the ifdef patch by Cedric Duval . + +This command allows to test if a feature has been compiled in before actually +attempting to configure / use it. + +Syntax: + +ifdef + +where can be the name of a variable, function, or command. + +Examples: + +ifdef imap-fetch-mail 'source ~/.mutt/imap_setup' +ifdef trash set trash=~/Mail/trash + +* Patch last synced with upstream: + - Date: 2007-02-15 + - File: + http://cedricduval.free.fr/mutt/patches/download/patch-1.5.4.cd.ifdef.1 + +* Changes made: + - Updated to 1.5.13 + - Also look for commands + - Use mutt_strcmp in favor of ascii_strncasecmp to compare strings. + +== END PATCH +--- a/init.c ++++ b/init.c +@@ -601,6 +601,65 @@ + } + } + ++static int parse_ifdef (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ++{ ++ int i, j, res = 0; ++ BUFFER token; ++ ++ memset (&token, 0, sizeof (token)); ++ mutt_extract_token (tmp, s, 0); ++ ++ /* is the item defined as a variable? */ ++ res = (mutt_option_index (tmp->data) != -1); ++ ++ /* a function? */ ++ if (!res) ++ for (i = 0; !res && i < MENU_MAX; i++) ++ { ++ struct binding_t *b = km_get_table (Menus[i].value); ++ ++ if (!b) ++ continue; ++ ++ for (j = 0; b[j].name; j++) ++ if (!mutt_strcmp (tmp->data, b[j].name)) ++ { ++ res = 1; ++ break; ++ } ++ } ++ ++ /* a command? */ ++ if (!res) ++ for (i = 0; Commands[i].name; i++) ++ { ++ if (!mutt_strcmp (tmp->data, Commands[i].name)) ++ { ++ res = 1; ++ break; ++ } ++ } ++ ++ if (!MoreArgs (s)) ++ { ++ snprintf (err->data, err->dsize, _("ifdef: too few arguments")); ++ return (-1); ++ } ++ mutt_extract_token (tmp, s, M_TOKEN_SPACE); ++ ++ if (res) ++ { ++ if (mutt_parse_rc_line (tmp->data, &token, err) == -1) ++ { ++ mutt_error ("Erreur: %s", err->data); ++ FREE (&token.data); ++ return (-1); ++ } ++ FREE (&token.data); ++ } ++ return 0; ++} ++ + static int parse_unignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) + { + do +--- a/init.h ++++ b/init.h +@@ -3439,6 +3439,7 @@ + static int parse_unlists (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_alias (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_unalias (BUFFER *, BUFFER *, unsigned long, BUFFER *); ++static int parse_ifdef (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_ignore (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_unignore (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_source (BUFFER *, BUFFER *, unsigned long, BUFFER *); +@@ -3489,6 +3490,7 @@ + { "group", parse_group, M_GROUP }, + { "ungroup", parse_group, M_UNGROUP }, + { "hdr_order", parse_list, UL &HeaderOrderList }, ++ { "ifdef", parse_ifdef, 0 }, + #ifdef HAVE_ICONV + { "iconv-hook", mutt_parse_hook, M_ICONVHOOK }, + #endif +--- a/doc/manual.xml.head ++++ b/doc/manual.xml.head +@@ -4373,6 +4373,28 @@ + + + ++ ++ ++Configuring features conditionally ++ ++ ++Usage: ifdef item command ++ ++ ++ ++This command allows to test if a feature has been compiled in, before ++actually executing the command. Item can be either the name of a ++function, variable, or command. Example: ++ ++ ++ ++ ++ifdef imap_keepalive 'source ~/.mutt/imap_setup' ++ ++ ++ ++ ++ + + Removing Hooks + --- mutt-1.5.21.orig/debian/patches/features/sensible_browser_position +++ mutt-1.5.21/debian/patches/features/sensible_browser_position @@ -0,0 +1,103 @@ +# vi: ft=diff +This is the sensible browser position patch by Haakon Riiser. + + * Found in: <20050309162127.GA5656@s> + http://lists.df7cb.de/mutt/message/20050309.162127.a244a894.en.html + +== END PATCH +--- a/menu.c ++++ b/menu.c +@@ -852,8 +852,17 @@ + + int mutt_menuLoop (MUTTMENU *menu) + { ++ static int last_position = -1; + int i = OP_NULL; + ++ if ( menu->max && menu->is_mailbox_list ) { ++ if ( last_position > (menu->max-1) ) { ++ last_position = -1; ++ } else if (last_position >= 0) { ++ menu->current = last_position; ++ } ++ } ++ + FOREVER + { + if (option (OPTMENUCALLER)) +@@ -1081,6 +1090,8 @@ + break; + + default: ++ if (menu->is_mailbox_list) ++ last_position = menu->current; + return (i); + } + } +--- a/browser.c ++++ b/browser.c +@@ -56,6 +56,7 @@ + int num; + } FOLDER; + ++static char OldLastDir[_POSIX_PATH_MAX] = ""; + static char LastDir[_POSIX_PATH_MAX] = ""; + static char LastDirBackup[_POSIX_PATH_MAX] = ""; + +@@ -536,9 +537,13 @@ + menu->tagged = 0; + + if (buffy) ++ { ++ menu->is_mailbox_list = 1; + snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0)); ++ } + else + { ++ menu->is_mailbox_list = 0; + strfcpy (path, LastDir, sizeof (path)); + mutt_pretty_mailbox (path, sizeof (path)); + #ifdef USE_IMAP +@@ -547,8 +552,22 @@ + path, NONULL (Mask.pattern)); + else + #endif +- snprintf (title, titlelen, _("Directory [%s], File mask: %s"), +- path, NONULL(Mask.pattern)); ++ { ++ char *p = strrchr (OldLastDir, '/'); ++ if (p && p - OldLastDir == mutt_strlen (LastDir) && ++ mutt_strncmp (LastDir, OldLastDir, p - OldLastDir) == 0) ++ { ++ /* If we get here, it means that LastDir is the parent directory of ++ * OldLastDir. I.e., we're returning from a subdirectory, and we want ++ * to position the cursor on the directory we're returning from. */ ++ int i; ++ for (i = 0; i < state->entrymax; i++) ++ if (mutt_strcmp (state->entry[i].name, p + 1) == 0) ++ menu->current = i; ++ } ++ snprintf (title, titlelen, _("Directory [%s], File mask: %s"), ++ path, NONULL(Mask.pattern)); ++ } + } + menu->redraw = REDRAW_FULL; + } +@@ -731,7 +750,6 @@ + #endif + ) + { +- char OldLastDir[_POSIX_PATH_MAX]; + + /* save the old directory */ + strfcpy (OldLastDir, LastDir, sizeof (OldLastDir)); +--- a/mutt_menu.h ++++ b/mutt_menu.h +@@ -49,6 +49,7 @@ + int offset; /* which screen row to start the index */ + int pagelen; /* number of entries per screen */ + int tagprefix; ++ int is_mailbox_list; + + /* Setting dialog != NULL overrides normal menu behaviour. + * In dialog mode menubar is hidden and prompt keys are checked before --- mutt-1.5.21.orig/debian/patches/features/trash-folder +++ mutt-1.5.21/debian/patches/features/trash-folder @@ -0,0 +1,283 @@ +# vim:ft=diff: +This is the trash folder patch by Cedric Duval . + +With this patch, if the trash variable is set to a path (unset by default), the +deleted mails will be moved to a trash folder instead of being irremediably +purged when syncing the mailbox. + +For instance, set trash="~/Mail/trash" will cause every deleted mail to go to +this folder. + +Note that the append to the trash folder doesn't occur until the resync is +done. This allows you to change your mind and undo deletes, and thus the moves +to the trash folder are unnecessary. + +Notes + + * You might also want to have a look at the purge message feature below + which is related to this patch. + * IMAP is now supported. To retain the previous behavior, add this to your + muttrc: + folder-hook ^imap:// 'unset trash' + +FAQ + +Every once in a while, someone asks what are the advantages of this patch over +a macro based solution. Here's an attempt to answer this question: + + * The folder history doesn't clutter up with unwanted trash entries. + * Delayed move to the trash allows to change one's mind. + * No need to treat the case of "normal folders" and trash folders + separately with folder-hooks, and to create two sets of macros (one for + the index, one for the pager). + * Works not only with delete-message, but also with every deletion + functions like delete-pattern, delete-thread or delete-subthread. + +To sum up, it's more integrated and transparent to the user. + +* Patch last synced with upstream: + - Date: 2007-02-15 + - File: http://cedricduval.free.fr/mutt/patches/download/patch-1.5.5.1.cd.trash_folder.3.4 + +* Changes made: + - Updated to 1.5.13: + - structure of _mutt_save_message changed (commands.c) + - context of option (OPTCONFIRMAPPEND) changed (muttlib.c) + - Fixed indentation of "appended" in mutt.h. + +== END PATCH +--- a/commands.c ++++ b/commands.c +@@ -717,6 +717,7 @@ + if (option (OPTDELETEUNTAG)) + mutt_set_flag (Context, h, M_TAG, 0); + } ++ mutt_set_flag (Context, h, M_APPENDED, 1); + + return 0; + } +--- a/flags.c ++++ b/flags.c +@@ -65,7 +65,13 @@ + { + h->deleted = 0; + update = 1; +- if (upd_ctx) ctx->deleted--; ++ if (upd_ctx) ++ { ++ ctx->deleted--; ++ if (h->appended) ++ ctx->appended--; ++ } ++ h->appended = 0; /* when undeleting, also reset the appended flag */ + #ifdef USE_IMAP + /* see my comment above */ + if (ctx->magic == M_IMAP) +@@ -87,6 +93,17 @@ + } + break; + ++ case M_APPENDED: ++ if (bf) ++ { ++ if (!h->appended) ++ { ++ h->appended = 1; ++ if (upd_ctx) ctx->appended++; ++ } ++ } ++ break; ++ + case M_NEW: + + if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN)) +--- a/globals.h ++++ b/globals.h +@@ -139,6 +139,7 @@ + WHERE char *Status; + WHERE char *Tempdir; + WHERE char *Tochars; ++WHERE char *TrashPath; + WHERE char *Username; + WHERE char *Visual; + WHERE char *XtermTitle; +--- a/imap/message.c ++++ b/imap/message.c +@@ -876,6 +876,7 @@ + if (ctx->hdrs[n]->tagged) + { + mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1); ++ mutt_set_flag (ctx, ctx->hdrs[n], M_APPENDED, 1); + if (option (OPTDELETEUNTAG)) + mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0); + } +@@ -883,6 +884,7 @@ + else + { + mutt_set_flag (ctx, h, M_DELETE, 1); ++ mutt_set_flag (ctx, h, M_APPENDED, 1); + if (option (OPTDELETEUNTAG)) + mutt_set_flag (ctx, h, M_TAG, 0); + } +--- a/init.h ++++ b/init.h +@@ -3195,6 +3195,16 @@ + ** by \fIyou\fP. The sixth character is used to indicate when a mail + ** was sent to a mailing-list you subscribe to. + */ ++ { "trash", DT_PATH, R_NONE, UL &TrashPath, 0 }, ++ /* ++ ** .pp ++ ** If set, this variable specifies the path of the trash folder where the ++ ** mails marked for deletion will be moved, instead of being irremediably ++ ** purged. ++ ** .pp ++ ** NOTE: When you delete a message in the trash folder, it is really ++ ** deleted, so that you have a way to clean the trash. ++ */ + #ifdef USE_SOCKET + { "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 }, + /* +--- a/mutt.h ++++ b/mutt.h +@@ -187,6 +187,7 @@ + M_DELETE, + M_UNDELETE, + M_DELETED, ++ M_APPENDED, + M_FLAG, + M_TAG, + M_UNTAG, +@@ -707,6 +708,7 @@ + unsigned int mime : 1; /* has a MIME-Version header? */ + unsigned int flagged : 1; /* marked important? */ + unsigned int tagged : 1; ++ unsigned int appended : 1; /* has been saved */ + unsigned int deleted : 1; + unsigned int changed : 1; + unsigned int attach_del : 1; /* has an attachment marked for deletion */ +@@ -879,6 +881,7 @@ + int new; /* how many new messages? */ + int unread; /* how many unread messages? */ + int deleted; /* how many deleted messages */ ++ int appended; /* how many saved messages? */ + int flagged; /* how many flagged messages */ + int msgnotreadyet; /* which msg "new" in pager, -1 if none */ + +--- a/muttlib.c ++++ b/muttlib.c +@@ -1515,7 +1515,9 @@ + + if (magic > 0 && !mx_access (s, W_OK)) + { +- if (option (OPTCONFIRMAPPEND)) ++ if (option (OPTCONFIRMAPPEND) && ++ (!TrashPath || (mutt_strcmp (s, TrashPath) != 0))) ++ /* if we're appending to the trash, there's no point in asking */ + { + snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s); + if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO) +--- a/mx.c ++++ b/mx.c +@@ -776,6 +776,53 @@ + return rc; + } + ++/* move deleted mails to the trash folder */ ++static int trash_append (CONTEXT *ctx) ++{ ++ CONTEXT *ctx_trash; ++ int i = 0; ++ struct stat st, stc; ++ ++ if (!TrashPath || !ctx->deleted || ++ (ctx->magic == M_MAILDIR && option (OPTMAILDIRTRASH))) ++ return 0; ++ ++ for (;i < ctx->msgcount && (!ctx->hdrs[i]->deleted || ++ ctx->hdrs[i]->appended); i++); ++ if (i == ctx->msgcount) ++ return 0; /* nothing to be done */ ++ ++ if (mutt_save_confirm (TrashPath, &st) != 0) ++ { ++ mutt_error _("message(s) not deleted"); ++ return -1; ++ } ++ ++ if (lstat (ctx->path, &stc) == 0 && stc.st_ino == st.st_ino ++ && stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev) ++ return 0; /* we are in the trash folder: simple sync */ ++ ++ if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL) ++ { ++ for (i = 0 ; i < ctx->msgcount ; i++) ++ if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended ++ && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1) ++ { ++ mx_close_mailbox (ctx_trash, NULL); ++ return -1; ++ } ++ ++ mx_close_mailbox (ctx_trash, NULL); ++ } ++ else ++ { ++ mutt_error _("Can't open trash folder"); ++ return -1; ++ } ++ ++ return 0; ++} ++ + /* save changes and close mailbox */ + int mx_close_mailbox (CONTEXT *ctx, int *index_hint) + { +@@ -912,6 +959,7 @@ + if (mutt_append_message (&f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0) + { + mutt_set_flag (ctx, ctx->hdrs[i], M_DELETE, 1); ++ mutt_set_flag (ctx, ctx->hdrs[i], M_APPENDED, 1); + } + else + { +@@ -936,6 +984,14 @@ + return 0; + } + ++ /* copy mails to the trash before expunging */ ++ if (purge && ctx->deleted && mutt_strcmp(ctx->path, TrashPath)) ++ if (trash_append (ctx) != 0) ++ { ++ ctx->closing = 0; ++ return -1; ++ } ++ + #ifdef USE_IMAP + /* allow IMAP to preserve the deleted flag across sessions */ + if (ctx->magic == M_IMAP) +@@ -1133,6 +1189,12 @@ + msgcount = ctx->msgcount; + deleted = ctx->deleted; + ++ if (purge && ctx->deleted && mutt_strcmp(ctx->path, TrashPath)) ++ { ++ if (trash_append (ctx) == -1) ++ return -1; ++ } ++ + #ifdef USE_IMAP + if (ctx->magic == M_IMAP) + rc = imap_sync_mailbox (ctx, purge, index_hint); +--- a/postpone.c ++++ b/postpone.c +@@ -277,6 +277,9 @@ + /* finished with this message, so delete it. */ + mutt_set_flag (PostContext, h, M_DELETE, 1); + ++ /* and consider it saved, so that it won't be moved to the trash folder */ ++ mutt_set_flag (PostContext, h, M_APPENDED, 1); ++ + /* update the count for the status display */ + PostCount = PostContext->msgcount - PostContext->deleted; + --- mutt-1.5.21.orig/debian/patches/upstream/537061-dont-recode-saved-attachments.patch +++ mutt-1.5.21/debian/patches/upstream/537061-dont-recode-saved-attachments.patch @@ -0,0 +1,14 @@ +As a side effect of the fix for http://bugs.mutt.org/3234, mutt is recoding all +save attachments, this is causing problems; a proper fix for this issue is being +tracked on http://bugs.mutt.org/3293 + +--- a/attach.c ++++ b/attach.c +@@ -807,7 +807,6 @@ + STATE s; + + memset (&s, 0, sizeof (s)); +- s.flags |= M_CHARCONV; + + if ((s.fpout = mutt_save_attachment_open (path, flags)) == NULL) + { --- mutt-1.5.21.orig/debian/patches/upstream/543467-thread-segfault.patch +++ mutt-1.5.21/debian/patches/upstream/543467-thread-segfault.patch @@ -0,0 +1,17 @@ +added a patch to prevent segfault when Ctrl+R is hit on a malformed group of +messages (see upstream bug http://bugs.mutt.org/3335) + +--- a/flags.c ++++ b/flags.c +@@ -303,7 +303,10 @@ + int mutt_thread_set_flag (HEADER *hdr, int flag, int bf, int subthread) + { + THREAD *start, *cur = hdr->thread; +- ++ ++ if ( !hdr->thread ) ++ return (-1); ++ + if ((Sort & SORT_MASK) != SORT_THREADS) + { + mutt_error _("Threading is not enabled."); --- mutt-1.5.21.orig/debian/patches/upstream/568295-references.patch +++ mutt-1.5.21/debian/patches/upstream/568295-references.patch @@ -0,0 +1,17 @@ +The purpose of this patch is to preserve the References header if the +In-Reply-To header is not initially present; forwarded upstream to +http://bugs.mutt.org/3378 + +--- a/headers.c ++++ b/headers.c +@@ -114,8 +114,8 @@ + $edit_headers set, we remove References: as they're likely invalid; + we can simply compare strings as we don't generate References for + multiple Message-Ids in IRT anyways */ +- if (!n->in_reply_to || (msg->env->in_reply_to && +- mutt_strcmp (n->in_reply_to->data, ++ if (msg->env->in_reply_to && ++ (!n->in_reply_to || mutt_strcmp (n->in_reply_to->data, + msg->env->in_reply_to->data) != 0)) + mutt_free_list (&msg->env->references); + --- mutt-1.5.21.orig/debian/patches/upstream/537694-segv-imap-headers.patch +++ mutt-1.5.21/debian/patches/upstream/537694-segv-imap-headers.patch @@ -0,0 +1,15 @@ +This patch fixes a segfault that happens when the IMAP server sends some +additional flags for the same message ID, see upstream bug +http://bugs.mutt.org/3288 + +--- a/imap/message.c ++++ b/imap/message.c +@@ -288,7 +288,7 @@ + continue; + } + /* May receive FLAGS updates in a separate untagged response (#2935) */ +- if (idx < ctx->msgcount) ++ if (ctx->hdrs[idx] != NULL) + { + dprint (2, (debugfile, "imap_read_headers: message %d is not new\n", + h.sid)); --- mutt-1.5.21.orig/debian/patches/upstream/path_max +++ mutt-1.5.21/debian/patches/upstream/path_max @@ -0,0 +1,16 @@ +Fixed in hg around 5354:d4ea7f571f10; remove as soon as there's no PATH_MAX in the code anymore. + +--- a/mutt.h ++++ b/mutt.h +@@ -52,6 +52,11 @@ + #include + #endif + ++/* PATH_MAX is undefined on the hurd */ ++#ifndef PATH_MAX ++#define PATH_MAX _POSIX_PATH_MAX ++#endif ++ + #include + #include + --- mutt-1.5.21.orig/debian/patches/upstream/547980-smime_keys-chaining.patch +++ mutt-1.5.21/debian/patches/upstream/547980-smime_keys-chaining.patch @@ -0,0 +1,84 @@ +To suppose certificate chaining in smime_keys, see upstream +http://bugs.mutt.org/3339 + +--- a/smime_keys.pl ++++ b/smime_keys.pl +@@ -81,6 +81,30 @@ + # OPS + # + ++ ++sub get_certs { ++ my $file = shift; ++ return undef unless (defined($file) && -e $file); ++ ++ open IN, "<$file"; ++ ++ my @certs = (); ++ my $in_cert = 0; ++ my $cert = q{}; ++ while ( ) { ++ $in_cert = 1 if ( /^-----BEGIN CERTIFICATE-----$/ ); ++ $cert .= $_; ++ ++ if ( /^-----END CERTIFICATE-----$/ ) { ++ push @certs, $cert; ++ $cert = q{}; ++ $in_cert = 0; ++ } ++ } ++ ++ return @certs; ++} ++ + if(@ARGV == 1 and $ARGV[0] eq "init") { + init_paths; + } +@@ -91,13 +115,27 @@ + change_label($ARGV[1]); + } + elsif(@ARGV == 2 and $ARGV[0] eq "add_cert") { +- my $format = -B $ARGV[1] ? 'DER' : 'PEM'; +- my $cmd = "$opensslbin x509 -noout -hash -in $ARGV[1] -inform $format"; +- my $cert_hash = `$cmd`; +- $? and die "'$cmd' returned $?"; +- chomp($cert_hash); +- my $label = query_label; +- &add_certificate($ARGV[1], \$cert_hash, 1, $label, '?'); ++ foreach my $cert ( get_certs( $ARGV[1] ) ) { ++ ++ my $file = sprintf( '/tmp/smime-%d.%d', $$, int(rand( 999999 ) ) ); ++ print STDERR "TMPFILE: $file\n"; ++ if ( -e $file ) { ++ die( "ERROR: TMPFILE $file existss?!?!" ); ++ } ++ open OUT, ">$file"; ++ print OUT $cert; ++ close OUT; ++ ++ my $format = -B $file ? 'DER' : 'PEM'; ++ my $cmd = "$opensslbin x509 -noout -hash -in $file -inform $format"; ++ ++ my $cert_hash = `$cmd`; ++ $? and die "'$cmd' returned $?"; ++ chomp($cert_hash); ++ my $label = query_label; ++ &add_certificate($ARGV[1], \$cert_hash, 1, $label, '?'); ++ unlink $file; ++ } + } + elsif(@ARGV == 2 and $ARGV[0] eq "add_pem") { + -e $ARGV[1] and -s $ARGV[1] or die("$ARGV[1] is nonexistent or empty."); +@@ -381,9 +419,10 @@ + print "the key ID. This has to be _one_ word (no whitespaces).\n\n"; + + print "Enter label: "; +- chomp($input = ); ++ $input = ; ++ chomp($input) if ( defined($input) ); + +- my ($label, $junk) = split(/\s/, $input, 2); ++ my ($label, $junk) = split(/\s/, $input, 2) if ( defined($input) ); + + defined $junk + and print "\nUsing '$label' as label; ignoring '$junk'\n"; --- mutt-1.5.21.orig/debian/patches/upstream/228671-pipe-mime.patch +++ mutt-1.5.21/debian/patches/upstream/228671-pipe-mime.patch @@ -0,0 +1,36 @@ +Don't draw imap fetch progress if we aren't in visual mode. +Drawing progress leaves terminal in confusing state when piping a message +from pager to less(1). See http://bugs.mutt.org/1771 + +Updated in #569279. + +--- a/imap/message.c ++++ b/imap/message.c +@@ -398,7 +398,7 @@ + char path[_POSIX_PATH_MAX]; + char *pc; + long bytes; +- progress_t progressbar; ++ progress_t progressbar, *pbar; + int uid; + int cacheno; + IMAP_CACHE *cache; +@@ -495,9 +495,15 @@ + imap_error ("imap_fetch_message()", buf); + goto bail; + } +- mutt_progress_init (&progressbar, _("Fetching message..."), +- M_PROGRESS_SIZE, NetInc, bytes); +- if (imap_read_literal (msg->fp, idata, bytes, &progressbar) < 0) ++ if (!isendwin()) ++ { ++ mutt_progress_init (&progressbar, _("Fetching message..."), ++ M_PROGRESS_SIZE, NetInc, bytes); ++ pbar = &progressbar; ++ } ++ else ++ pbar = NULL; ++ if (imap_read_literal (msg->fp, idata, bytes, pbar) < 0) + goto bail; + /* pick up trailing line */ + if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) --- mutt-1.5.21.orig/debian/patches/upstream/528233-readonly-open.patch +++ mutt-1.5.21/debian/patches/upstream/528233-readonly-open.patch @@ -0,0 +1,28 @@ +Open attachments as read-only so the editor won't be able to modify it; +otherwise the user can believe that he/she can edit it and risk to lose his/her +work (see upstream bug http://bugs.mutt.org/3261) + +#528233, updated in #572203 + +--- a/attach.c ++++ b/attach.c +@@ -492,6 +492,7 @@ int mutt_view_attachment (FILE *fp, BODY + FREE (&fname); + if (mutt_save_attachment (fp, a, tempfile, 0, NULL) == -1) + goto return_error; ++ chmod (tempfile, 0400); + } + + use_pipe = rfc1524_expand_command (a, tempfile, type, +@@ -633,7 +634,11 @@ int mutt_view_attachment (FILE *fp, BODY + if (entry) + rfc1524_free_entry (&entry); + if (fp && tempfile[0]) ++ { ++ /* Restore write permission so mutt_unlink can open the file for writing */ ++ chmod(tempfile, 0600); + mutt_unlink (tempfile); ++ } + else if (unlink_tempfile) + unlink(tempfile); + --- mutt-1.5.21.orig/debian/patches/upstream/537818-emptycharset.patch +++ mutt-1.5.21/debian/patches/upstream/537818-emptycharset.patch @@ -0,0 +1,15 @@ +without this patch mutt crashes if any option that contains charset is set to +empty, see upstream bug http://bugs.mutt.org/3326 + +--- a/init.c ++++ b/init.c +@@ -1732,6 +1732,9 @@ + char *p, *q = NULL, *s = safe_strdup (val); + int rc = 0, strict = strcmp (opt->option, "send_charset") == 0; + ++ if (!s) ++ return rc; ++ + for (p = strtok_r (s, ":", &q); p; p = strtok_r (NULL, ":", &q)) + { + if (!*p) --- mutt-1.5.21.orig/debian/patches/upstream/383769-score-match.patch +++ mutt-1.5.21/debian/patches/upstream/383769-score-match.patch @@ -0,0 +1,14 @@ +better matching for ~f, same as mutt-ng did, see upstream +http://bugs.mutt.org/2179 + +--- a/score.c ++++ b/score.c +@@ -133,7 +133,7 @@ + hdr->score = 0; /* in case of re-scoring */ + for (tmp = Score; tmp; tmp = tmp->next) + { +- if (mutt_pattern_exec (tmp->pat, 0, NULL, hdr) > 0) ++ if (mutt_pattern_exec (tmp->pat, M_MATCH_FULL_ADDRESS, NULL, hdr) > 0) + { + if (tmp->exact || tmp->val == 9999 || tmp->val == -9999) + { --- mutt-1.5.21.orig/debian/patches/upstream/553321-ansi-escape-segfault.patch +++ mutt-1.5.21/debian/patches/upstream/553321-ansi-escape-segfault.patch @@ -0,0 +1,17 @@ +This patch prevents mutt from crashing when *buf is freed, the root cause is the +fact that an adjacent memory segment (*fmt) overruns and overwrite prev_size +field in the heap. + +The bug and the patch were forwarded upstream, see http://bugs.mutt.org/3371 + +--- a/pager.c ++++ b/pager.c +@@ -1053,7 +1053,7 @@ + q = *fmt; + while (*p) + { +- if (*p == '\010' && (p > *buf)) ++ if (*p == '\010' && (p > *buf) && (q > *fmt)) + { + if (*(p+1) == '_') /* underline */ + p += 2; --- mutt-1.5.21.orig/debian/patches/upstream/608706-fix-spelling-errors.patch +++ mutt-1.5.21/debian/patches/upstream/608706-fix-spelling-errors.patch @@ -0,0 +1,426 @@ +Simple patch to fix some spelling errors, forwarded upstream on: +http://bugs.mutt.org/3493 + +--- a/copy.c ++++ b/copy.c +@@ -77,7 +77,7 @@ + if ((fgets (buf, sizeof (buf), in)) == NULL) + break; + +- /* Is it the begining of a header? */ ++ /* Is it the beginning of a header? */ + if (nl && buf[0] != ' ' && buf[0] != '\t') + { + ignore = 1; +@@ -147,7 +147,7 @@ + if ((fgets (buf, sizeof (buf), in)) == NULL) + break; + +- /* Is it the begining of a header? */ ++ /* Is it the beginning of a header? */ + if (nl && buf[0] != ' ' && buf[0] != '\t') + { + /* Do we have anything pending? */ +--- a/edit.c ++++ b/edit.c +@@ -39,7 +39,7 @@ + * declared "static" (sigh) + */ + static char* EditorHelp1 = N_("\ +-~~ insert a line begining with a single ~\n\ ++~~ insert a line beginning with a single ~\n\ + ~b users add users to the Bcc: field\n\ + ~c users add users to the Cc: field\n\ + ~f messages include messages\n\ +--- a/enter.c ++++ b/enter.c +@@ -435,7 +435,7 @@ + break; + + case OP_EDITOR_KILL_WORD: +- /* delete to begining of word */ ++ /* delete to beginning of word */ + if (state->curpos != 0) + { + i = state->curpos; +--- a/crypt.c ++++ b/crypt.c +@@ -224,7 +224,7 @@ + /* free tmp_body if messages was signed AND encrypted ... */ + if (tmp_smime_pbody != msg->content && tmp_smime_pbody != tmp_pbody) + { +- /* detatch and dont't delete msg->content, ++ /* detatch and don't delete msg->content, + which tmp_smime_pbody->parts after signing. */ + tmp_smime_pbody->parts = tmp_smime_pbody->parts->next; + msg->content->next = NULL; +--- a/init.c ++++ b/init.c +@@ -2543,7 +2543,7 @@ + Matches[Num_matched++] = User_typed; + + /* All matches are stored. Longest non-ambiguous string is "" +- * i.e. dont change 'buffer'. Fake successful return this time */ ++ * i.e. don't change 'buffer'. Fake successful return this time */ + if (User_typed[0] == 0) + return 1; + } +@@ -2599,7 +2599,7 @@ + Matches[Num_matched++] = User_typed; + + /* All matches are stored. Longest non-ambiguous string is "" +- * i.e. dont change 'buffer'. Fake successful return this time */ ++ * i.e. don't change 'buffer'. Fake successful return this time */ + if (User_typed[0] == 0) + return 1; + } +@@ -2646,7 +2646,7 @@ + Matches[Num_matched++] = User_typed; + + /* All matches are stored. Longest non-ambiguous string is "" +- * i.e. dont change 'buffer'. Fake successful return this time */ ++ * i.e. don't change 'buffer'. Fake successful return this time */ + if (User_typed[0] == 0) + return 1; + } +--- a/po/mutt.pot ++++ b/po/mutt.pot +@@ -3620,7 +3620,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "" + + #: recvattach.c:775 +--- a/recvattach.c ++++ b/recvattach.c +@@ -707,7 +707,7 @@ + { + if (!mutt_can_decode (top)) + { +- mutt_error (_("I dont know how to print %s attachments!"), type); ++ mutt_error (_("I don't know how to print %s attachments!"), type); + return (0); + } + } +--- a/po/bg.po ++++ b/po/bg.po +@@ -3899,7 +3899,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr " %s !" + + #: recvattach.c:775 +--- a/po/ca.po ++++ b/po/ca.po +@@ -4054,7 +4054,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Es desconeix com imprimir adjuncions de tipus «%s»." + + #: recvattach.c:775 +--- a/po/cs.po ++++ b/po/cs.po +@@ -3781,7 +3781,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Nevím, jak vytisknout přílohy typu %s!." + + #: recvattach.c:775 +--- a/po/da.po ++++ b/po/da.po +@@ -3850,7 +3850,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Kan ikke udskrive %s-brevdele." + + #: recvattach.c:775 +--- a/po/de.po ++++ b/po/de.po +@@ -3779,7 +3779,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Kann %s Anhnge nicht drucken!" + + #: recvattach.c:775 +--- a/po/el.po ++++ b/po/el.po +@@ -4528,7 +4528,7 @@ + # + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr " %s !" + + # +--- a/po/eo.po ++++ b/po/eo.po +@@ -3772,7 +3772,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Mi ne scias presi %s-partojn!" + + #: recvattach.c:775 +--- a/po/es.po ++++ b/po/es.po +@@ -3898,7 +3898,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "No s cmo imprimir archivos adjuntos %s!" + + #: recvattach.c:775 +--- a/po/et.po ++++ b/po/et.po +@@ -3875,7 +3875,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Ma ei tea, kuidas trkkida %s lisasid!" + + #: recvattach.c:775 +--- a/po/eu.po ++++ b/po/eu.po +@@ -3764,7 +3764,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Ez dakit nola inprimatu %s gehigarriak!" + + #: recvattach.c:775 +--- a/po/fr.po ++++ b/po/fr.po +@@ -3958,7 +3958,7 @@ + # , c-format + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Je ne sais pas comment imprimer %s attachements!" + + #: recvattach.c:775 +--- a/po/ga.po ++++ b/po/ga.po +@@ -3809,7 +3809,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "N eol dom conas a phriontil iatin %s!" + + #: recvattach.c:775 +--- a/po/gl.po ++++ b/po/gl.po +@@ -3912,7 +3912,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Non sei cmo imprimir adxuntos %s!" + + #: recvattach.c:775 +--- a/po/hu.po ++++ b/po/hu.po +@@ -3888,7 +3888,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Nem tudom hogyan kell nyomtatni a(z) %s csatolst!" + + #: recvattach.c:775 +--- a/po/id.po ++++ b/po/id.po +@@ -3773,7 +3773,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Saya tidak tahu bagaimana mencetak lampiran %s!" + + #: recvattach.c:775 +--- a/po/it.po ++++ b/po/it.po +@@ -3859,7 +3859,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Non so come stampare allegati %s!" + + #: recvattach.c:775 +--- a/po/ja.po ++++ b/po/ja.po +@@ -3797,7 +3797,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "ɤΤ褦źեե %s 뤫!" + + #: recvattach.c:775 +--- a/po/ko.po ++++ b/po/ko.po +@@ -3863,7 +3863,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "÷ι %s !" + + #: recvattach.c:775 +--- a/po/lt.po ++++ b/po/lt.po +@@ -3904,7 +3904,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "A neinau kaip spausdinti %s priedus!" + + #: recvattach.c:775 +--- a/po/nl.po ++++ b/po/nl.po +@@ -3771,7 +3771,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Kan %s bijlagen niet afdrukken!" + + #: recvattach.c:775 +--- a/po/pl.po ++++ b/po/pl.po +@@ -3788,7 +3788,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Nie wiem jak wydrukowa %s zacznikw!" + + #: recvattach.c:775 +--- a/po/pt_BR.po ++++ b/po/pt_BR.po +@@ -3932,7 +3932,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Eu no sei como imprimir anexos %s!" + + #: recvattach.c:775 +--- a/po/ru.po ++++ b/po/ru.po +@@ -3795,7 +3795,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr " %s !" + + #: recvattach.c:775 +--- a/po/sk.po ++++ b/po/sk.po +@@ -3920,7 +3920,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Neviem ako tlai prlohy %s!" + + #: recvattach.c:775 +--- a/po/sv.po ++++ b/po/sv.po +@@ -3784,7 +3784,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "Jag vet inte hur %s bilagor ska skrivas ut!" + + #: recvattach.c:775 +--- a/po/tr.po ++++ b/po/tr.po +@@ -3806,7 +3806,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "%s eklerinin nasıl yazdırılacağı bilinmiyor!" + + #: recvattach.c:775 +--- a/po/uk.po ++++ b/po/uk.po +@@ -3846,7 +3846,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr " , %s!" + + #: recvattach.c:775 +--- a/po/zh_CN.po ++++ b/po/zh_CN.po +@@ -3763,7 +3763,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "我不知道要怎么打印附件 %s!" + + #: recvattach.c:775 +--- a/po/zh_TW.po ++++ b/po/zh_TW.po +@@ -3900,7 +3900,7 @@ + + #: recvattach.c:710 + #, c-format +-msgid "I dont know how to print %s attachments!" ++msgid "I don't know how to print %s attachments!" + msgstr "我不知道要怎麼列印 %s 附件!" + + #: recvattach.c:775 --- mutt-1.5.21.orig/debian/patches/upstream/548577-gpgme-1.2.patch +++ mutt-1.5.21/debian/patches/upstream/548577-gpgme-1.2.patch @@ -0,0 +1,27 @@ +this patch fixes upstream bug http://bugs.mutt.org/3300 so that +mutt will be able to open pgp crypted/signed message with gpgme + +--- a/init.c ++++ b/init.c +@@ -53,6 +53,10 @@ + #include + #include + ++#if defined(CRYPT_BACKEND_GPGME) ++#include ++#endif ++ + #define CHECK_PAGER \ + if ((CurrentMenu == MENU_PAGER) && (idx >= 0) && \ + (MuttVars[idx].flags & R_RESORT)) \ +@@ -3266,6 +3270,10 @@ + + mutt_read_histfile (); + ++#ifdef CRYPT_BACKEND_GPGME ++ gpgme_check_version (NULL); ++#endif ++ + #if 0 + set_option (OPTWEED); /* turn weeding on by default */ + #endif --- mutt-1.5.21.orig/debian/patches/upstream/603288-split-fetches.patch +++ mutt-1.5.21/debian/patches/upstream/603288-split-fetches.patch @@ -0,0 +1,21 @@ +A workaround for Exchange 2010 IMAP protocol, tracked in +http://bugs.mutt.org/3459, already merged in the ubuntu version of mutt + +--- a/imap/message.c ++++ b/imap/message.c +@@ -242,6 +242,15 @@ + char *cmd; + + fetchlast = msgend + 1; ++ /* Microsoft Exchange 2010 violates the IMAP protocol and ++ * starts omitting messages if one FETCHes more than 2047 (or ++ * or somewhere around that number. We therefore split the ++ * FETCH into chunks of 2000 messages each */ ++ if (fetchlast - msgno - 1 > 2000) ++ { ++ fetchlast = msgno+1 + 2000; ++ } ++ + safe_asprintf (&cmd, "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE %s)", + msgno + 1, fetchlast, hdrreq); + imap_cmd_start (idata, cmd); --- mutt-1.5.21.orig/debian/patches/upstream/531430-imapuser.patch +++ mutt-1.5.21/debian/patches/upstream/531430-imapuser.patch @@ -0,0 +1,14 @@ +fixes a problem where the imap->login has the precedence so the user +is asked with wrong informaton, see upstream #3240 + +--- a/account.c ++++ b/account.c +@@ -222,7 +222,7 @@ + else + { + snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "), +- account->flags & M_ACCT_LOGIN ? account->login : account->user, ++ ((account->flags & M_ACCT_LOGIN) && !(account->user)) ? account->login : account->user, + account->host); + account->pass[0] = '\0'; + if (mutt_get_password (prompt, account->pass, sizeof (account->pass))) --- mutt-1.5.21.orig/debian/patches/upstream/542817-smimekeys-tmpdir.patch +++ mutt-1.5.21/debian/patches/upstream/542817-smimekeys-tmpdir.patch @@ -0,0 +1,13 @@ +skip the configured tmpdir if it contains '=', that convention is used only by +mutt, see upstream http://bugs.mutt.org/3324 + +--- a/smime_keys.pl ++++ b/smime_keys.pl +@@ -946,6 +946,7 @@ + $option = "notemp" if (not defined($option)); + if (! $tmpdir and $option eq "temp") { + $tmpdir = mutt_Q 'tmpdir'; ++ $tmpdir = '/tmp' if ($tmpdir =~ m/=/); # if the tmpdir contains '=', use the default + $tmpdir = newfile("$tmpdir/smime"); + mkdir $tmpdir, 0700 || die "Can't create $tmpdir: $!\n"; + } --- mutt-1.5.21.orig/debian/patches/upstream/578087-header-strchr.patch +++ mutt-1.5.21/debian/patches/upstream/578087-header-strchr.patch @@ -0,0 +1,14 @@ +This fixes a segfault that can happen on a malformed message; patch comes from +upstream http://bugs.mutt.org/3483 + +--- a/sendlib.c ++++ b/sendlib.c +@@ -1799,7 +1799,7 @@ + else + { + t = strchr (start, ':'); +- if (t > end) ++ if (!t || t > end) + { + dprint (1, (debugfile, "mwoh: warning: header not in " + "'key: value' format!\n")); --- mutt-1.5.21.orig/debian/patches/features-old/patch-1.5.4.vk.pgp_verbose_mime +++ mutt-1.5.21/debian/patches/features-old/patch-1.5.4.vk.pgp_verbose_mime @@ -0,0 +1,45 @@ +Enable pgp_mime_signature_filename and pgp_mime_signature_description + +--- a/globals.h ++++ b/globals.h +@@ -243,6 +243,8 @@ + WHERE char *PgpListSecringCommand; + WHERE char *PgpListPubringCommand; + WHERE char *PgpGetkeysCommand; ++WHERE char *PgpMimeSignatureFilename; ++WHERE char *PgpMimeSignatureDescription; + + /*-- formerly in smime.h --*/ + WHERE char *SmimeDefaultKey; +--- a/init.h ++++ b/init.h +@@ -2556,6 +2556,18 @@ + ** a line quoted text if it also matches $$smileys. This mostly + ** happens at the beginning of a line. + */ ++ { "pgp_mime_signature_filename", DT_STR, R_NONE, UL &PgpMimeSignatureFilename, UL "signature.asc"}, ++ /* ++ ** .pp ++ ** This option sets the filename used for signature parts in PGP/MIME ++ ** signed messages. ++ */ ++ { "pgp_mime_signature_description", DT_STR, R_NONE, UL &PgpMimeSignatureDescription, UL "Digital signature"}, ++ /* ++ ** .pp ++ ** This option sets the Content-Description used for signature parts in ++ ** PGP/MIME signed messages. ++ */ + + + +--- a/pgp.c ++++ b/pgp.c +@@ -1129,6 +1129,8 @@ + t->disposition = DISPNONE; + t->encoding = ENC7BIT; + t->unlink = 1; /* ok to remove this file after sending. */ ++ mutt_set_parameter ("name", PgpMimeSignatureFilename, &t->parameter); ++ t->description = safe_strdup (PgpMimeSignatureDescription); + + return (a); + } --- mutt-1.5.21.orig/debian/patches/not-applied/w3mface +++ mutt-1.5.21/debian/patches/not-applied/w3mface @@ -0,0 +1,308 @@ +# vim:ft=diff: +This is the xface (w3mface) patch by TAKAHASHI Tamotsu +. + +Needs w3m-img, compface, and netpbm installed. + +* Homepage: http://www.df7cb.de/projects/mutt/x-face/ + +* Changes made: + - Remove LIBEXECDIR definition to avoid needing rerunning automake, + hardcode /usr/lib/w3m/w3mimgdisplay. + +== END PATCH +Index: xface/globals.h +=================================================================== +--- xface.orig/globals.h 2007-02-15 20:28:46.961763520 +0100 ++++ xface/globals.h 2007-02-15 20:28:56.069378952 +0100 +@@ -146,6 +146,11 @@ WHERE const char *ReleaseDate; + + WHERE HASH *Groups; + ++WHERE char *UncompFace; ++WHERE char *IconToPbm; ++WHERE char *W3mImgDisplay; ++WHERE char *W3mOpt; ++ + WHERE LIST *AutoViewList INITVAL(0); + WHERE LIST *AlternativeOrderList INITVAL(0); + WHERE LIST *AttachAllow INITVAL(0); +Index: xface/hcache.c +=================================================================== +--- xface.orig/hcache.c 2007-02-15 20:28:46.968762456 +0100 ++++ xface/hcache.c 2007-02-15 20:28:56.069378952 +0100 +@@ -401,6 +401,7 @@ dump_envelope(ENVELOPE * e, unsigned cha + d = dump_char(e->message_id, d, off); + d = dump_char(e->supersedes, d, off); + d = dump_char(e->date, d, off); ++ d = dump_char(e->x_face, d, off); + d = dump_char(e->x_label, d, off); + + d = dump_buffer(e->spam, d, off); +@@ -438,6 +439,7 @@ restore_envelope(ENVELOPE * e, const uns + restore_char(&e->message_id, d, off); + restore_char(&e->supersedes, d, off); + restore_char(&e->date, d, off); ++ restore_char(&e->x_face, d, off); + restore_char(&e->x_label, d, off); + + restore_buffer(&e->spam, d, off); +Index: xface/init.h +=================================================================== +--- xface.orig/init.h 2007-02-15 20:28:46.976761240 +0100 ++++ xface/init.h 2007-02-15 20:29:15.382442920 +0100 +@@ -2941,6 +2941,31 @@ struct option_t MuttVars[] = { + ** Controls whether mutt writes out the Bcc header when preparing + ** messages to be sent. Exim users may wish to unset this. + */ ++ { "xface", DT_BOOL, R_NONE, OPTXFACE, 0 }, ++ /* ++ ** .pp ++ ** Controls whether mutt displays X-Faces. ++ */ ++ { "xface_icontopbm", DT_PATH, R_NONE, UL &IconToPbm, UL "icontopbm" }, ++ /* ++ ** .pp ++ ** Specify the path to ``icontopbm'' program. ++ */ ++ { "xface_uncompface", DT_PATH, R_NONE, UL &UncompFace, UL "uncompface" }, ++ /* ++ ** .pp ++ ** Specify the path to ``uncompface'' program. ++ */ ++ { "xface_w3mimgdisplay",DT_PATH, R_NONE, UL &W3mImgDisplay, UL "/usr/lib/w3m/w3mimgdisplay" }, ++ /* ++ ** .pp ++ ** Specify the path to ``w3mimgdisplay'' program. ++ */ ++ { "xface_w3mimgdisplay_options",DT_STR, R_NONE, UL &W3mOpt, UL "-x 5 -y 5" }, ++ /* ++ ** .pp ++ ** Specify options for ``w3mimgdisplay'' program. ++ */ + /*--*/ + { NULL } + }; +Index: xface/mutt.h +=================================================================== +--- xface.orig/mutt.h 2007-02-15 20:28:46.983760176 +0100 ++++ xface/mutt.h 2007-02-15 20:28:56.071378648 +0100 +@@ -450,6 +450,7 @@ enum + OPTWRAP, + OPTWRAPSEARCH, + OPTWRITEBCC, /* write out a bcc header? */ ++ OPTXFACE, + OPTXMAILER, + + OPTCRYPTUSEGPGME, +@@ -587,6 +588,7 @@ typedef struct envelope + char *message_id; + char *supersedes; + char *date; ++ char *x_face; /* X-Face header content */ + char *x_label; + BUFFER *spam; + LIST *references; /* message references (in reverse order) */ +Index: xface/muttlib.c +=================================================================== +--- xface.orig/muttlib.c 2007-02-15 20:28:46.991758960 +0100 ++++ xface/muttlib.c 2007-02-15 20:28:56.072378496 +0100 +@@ -670,6 +670,7 @@ void mutt_free_envelope (ENVELOPE **p) + FREE (&(*p)->message_id); + FREE (&(*p)->supersedes); + FREE (&(*p)->date); ++ FREE (&(*p)->x_face); + FREE (&(*p)->x_label); + + mutt_buffer_free (&(*p)->spam); +Index: xface/pager.c +=================================================================== +--- xface.orig/pager.c 2007-02-15 20:28:47.000757592 +0100 ++++ xface/pager.c 2007-02-15 20:28:56.072378496 +0100 +@@ -1479,6 +1479,89 @@ upNLines (int nlines, struct line_t *inf + return cur; + } + ++static int ++display_xface (HEADER *hdr) ++{ ++ char facefile[_POSIX_PATH_MAX + 1]; ++ char command[LONG_STRING]; ++ char *facedata; ++ FILE *fpin = NULL, *fpout = NULL; ++ pid_t pid; ++ ++ /* everything ready? */ ++ if (!UncompFace || !(*UncompFace) || ++ !IconToPbm || !(*IconToPbm) || ++ !W3mImgDisplay || !(*W3mImgDisplay) || ++ !hdr || !hdr->env || !hdr->env->x_face) ++ return 0; ++ ++ /* test w3mimgdisplay */ ++ snprintf (command, sizeof (command), "%s -test >/dev/null", W3mImgDisplay); ++ if (mutt_system (command) == -1) ++ return 0; ++ ++ /* prepare facedata */ ++ facedata = hdr->env->x_face; ++ ++ /* convert facedata to imagedata ++ * and store imagedata in facefile ++ */ ++ mutt_mktemp (facefile); ++ if ((fpout = safe_fopen (facefile, "w")) == NULL) ++ { ++ mutt_error (_("Could not create temporary file!")); ++ return 0; ++ } ++ snprintf (command, sizeof (command), ++ "( echo '/* Width=48, Height=48 */'; %s ) | %s", ++ UncompFace, IconToPbm); ++ pid = mutt_create_filter_fd ++ (command, &fpin, NULL, NULL, -1, fileno (fpout), -1); ++ if (pid < 0) ++ { ++ mutt_perror (_("face filter")); ++ safe_fclose (&fpout); ++ mutt_unlink (facefile); ++ return 0; ++ } ++ /* pass facedata to converters */ ++ fputs (facedata, fpin); ++ if (safe_fclose (&fpin) != 0 && errno != EPIPE) ++ { ++ if (fpout != NULL) ++ { ++ mutt_wait_filter (pid); ++ safe_fclose (&fpout); ++ } ++ mutt_unlink (facefile); ++ return 0; ++ } ++ if (fpout != NULL) ++ mutt_wait_filter (pid); ++ safe_fclose (&fpout); ++ ++ /* ++ * w3mimgdisplay ++ */ ++ snprintf (command, sizeof (command), ++ "%s %s", W3mImgDisplay, NONULL (W3mOpt)); ++ pid = mutt_create_filter_fd ++ (command, &fpin, NULL, NULL, -1, -1, -1); ++ if (pid < 0) ++ { ++ mutt_perror ("w3mdisp"); ++ mutt_unlink (facefile); ++ return 0; ++ } ++ /* pass facefile to w3mimgdisplay */ ++ fprintf (fpin, "2;3;\n0;1;0;0;48;48;0;0;48;48;%s\n4;\n3;\n", facefile); ++ if (safe_fclose (&fpin) != 0 && errno != EPIPE) ++ mutt_perror ("w3mdisp"); ++ mutt_wait_filter (pid); ++ mutt_unlink (facefile); ++ return 0; ++} ++ + static struct mapping_t PagerHelp[] = { + { N_("Exit"), OP_EXIT }, + { N_("PrevPg"), OP_PREV_PAGE }, +@@ -1514,6 +1597,7 @@ mutt_pager (const char *banner, const ch + int lines = 0, curline = 0, topline = 0, oldtopline = 0, err, first = 1; + int r = -1; + int redraw = REDRAW_FULL; ++ int xface = 0; + FILE *fp = NULL; + LOFF_T last_pos = 0, last_offset = 0; + int old_smart_wrap, old_markers; +@@ -1593,6 +1677,8 @@ mutt_pager (const char *banner, const ch + + if (redraw & REDRAW_FULL) + { ++ xface = 1; /* display xface later */ ++ + SETCOLOR (MT_COLOR_NORMAL); + /* clear() doesn't optimize screen redraws */ + move (0, 0); +@@ -1794,6 +1880,11 @@ mutt_pager (const char *banner, const ch + } else move (statusoffset, COLS-1); + mutt_refresh (); + ++ /* X-Face */ ++ if (option (OPTXFACE) && xface && IsHeader (extra)) ++ display_xface (extra->hdr); ++ xface = 0; ++ + if (IsHeader (extra) && OldHdr == extra->hdr && TopLine != topline + && lineInfo[curline].offset < sb.st_size-1) + { +Index: xface/parse.c +=================================================================== +--- xface.orig/parse.c 2007-02-15 20:28:47.007756528 +0100 ++++ xface/parse.c 2007-02-15 20:28:56.073378344 +0100 +@@ -43,6 +43,7 @@ char *mutt_read_rfc822_line (FILE *f, ch + char *buf = line; + char ch; + size_t offset = 0; ++ int xface = 0; + + FOREVER + { +@@ -53,6 +54,9 @@ char *mutt_read_rfc822_line (FILE *f, ch + return (line); + } + ++ if (ascii_strcasecmp (buf, "x-face:") == 0) ++ xface = 1; ++ + buf += strlen (buf) - 1; + if (*buf == '\n') + { +@@ -71,9 +75,12 @@ char *mutt_read_rfc822_line (FILE *f, ch + /* eat tabs and spaces from the beginning of the continuation line */ + while ((ch = fgetc (f)) == ' ' || ch == '\t') + ; +- ungetc (ch, f); +- *++buf = ' '; /* string is still terminated because we removed +- at least one whitespace char above */ ++ if (!xface) ++ { ++ ungetc (ch, f); ++ *++buf = ' '; /* string is still terminated because we removed ++ at least one whitespace char above */ ++ } + } + + buf++; +@@ -1244,6 +1251,11 @@ int mutt_parse_rfc822_line (ENVELOPE *e, + e->x_label = safe_strdup(p); + matched = 1; + } ++ else if (ascii_strcasecmp (line+1, "-face") == 0) ++ { ++ e->x_face = safe_strdup (p); ++ matched = 1; ++ } + + default: + break; +Index: xface/sendlib.c +=================================================================== +--- xface.orig/sendlib.c 2007-02-15 20:28:47.017755008 +0100 ++++ xface/sendlib.c 2007-02-15 20:28:56.074378192 +0100 +@@ -1829,6 +1829,9 @@ int mutt_write_rfc822_header (FILE *fp, + } + } + ++ if (env->x_face) ++ fprintf (fp, "X-Face: %s\n", env->x_face); ++ + if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent) + { + /* Add a vanity header */ +--- a/PATCHES ++++ b/PATCHES +@@ -0,0 +1 @@ ++patch-1.5.13.tamo.w3mface.2 --- mutt-1.5.21.orig/debian/patches/not-applied/chdir +++ mutt-1.5.21/debian/patches/not-applied/chdir @@ -0,0 +1,100 @@ +# vim:ft=diff: +This is the chdir patch by Christoph Berg . + +* Homepage: http://www.df7cb.de/projects/mutt/chdir/ + +== END PATCH +Index: mutt/init.c +=================================================================== +--- mutt.orig/init.c 2006-12-12 14:15:03.000000000 +0100 ++++ mutt/init.c 2007-02-15 20:46:18.950836872 +0100 +@@ -2214,6 +2214,35 @@ static int parse_source (BUFFER *tmp, BU + return (source_rc (path, err)); + } + ++static int parse_cd (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ++{ ++ char path[_POSIX_PATH_MAX]; ++ ++ if (mutt_extract_token (tmp, s, 0) != 0) ++ { ++ snprintf (err->data, err->dsize, _("cd: error at %s"), s->dptr); ++ return (-1); ++ } ++ if (MoreArgs (s)) ++ { ++ strfcpy (err->data, _("cd: too many arguments"), err->dsize); ++ return (-1); ++ } ++ strfcpy (path, tmp->data, sizeof (path)); ++ mutt_expand_path (path, sizeof (path)); ++ if (!*path) { ++ char *home = getenv("HOME"); ++ if (home) ++ strfcpy (path, home, sizeof (path)); ++ } ++ if (chdir(path) != 0) { ++ snprintf (err->data, err->dsize, _("cd: %s"), strerror(errno)); ++ return (-1); ++ } ++ return (0); ++} ++ ++ + /* line command to execute + + token scratch buffer to be used by parser. caller should free +Index: mutt/init.h +=================================================================== +--- mutt.orig/init.h 2006-12-12 14:15:03.000000000 +0100 ++++ mutt/init.h 2007-02-15 20:46:18.951836720 +0100 +@@ -3020,6 +3020,7 @@ static int parse_unalias (BUFFER *, BUFF + static int parse_ignore (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_unignore (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_source (BUFFER *, BUFFER *, unsigned long, BUFFER *); ++static int parse_cd (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_set (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_my_hdr (BUFFER *, BUFFER *, unsigned long, BUFFER *); + static int parse_unmy_hdr (BUFFER *, BUFFER *, unsigned long, BUFFER *); +@@ -3056,6 +3057,7 @@ struct command_t Commands[] = { + { "auto_view", parse_list, UL &AutoViewList }, + { "alternative_order", parse_list, UL &AlternativeOrderList}, + { "bind", mutt_parse_bind, 0 }, ++ { "cd", parse_cd, 0 }, + { "charset-hook", mutt_parse_hook, M_CHARSETHOOK }, + #ifdef HAVE_COLOR + { "color", mutt_parse_color, 0 }, +Index: mutt/doc/manual.xml.head +=================================================================== +--- mutt.orig/doc/manual.xml.head 2007-02-15 20:51:41.226843472 +0100 ++++ mutt/doc/manual.xml.head 2007-02-15 20:51:45.303223768 +0100 +@@ -1701,6 +1701,25 @@ sequence. + + + ++ ++Changing the current working directory ++ ++ ++ ++Usage: cd directory ++ ++ ++ ++ ++The cd command changes Mutt's current working directory. ++This affects commands and functions like source, ++change-folder, and save-entry that use ++relative paths. Using cd without directory changes to your ++home directory. ++ ++ ++ ++ + + Defining aliases for character sets + +--- a/PATCHES ++++ b/PATCHES +@@ -0,0 +1 @@ ++patch-1.5.13.cb.chdir.1 --- mutt-1.5.21.orig/debian/patches/not-applied/indexcolor +++ mutt-1.5.21/debian/patches/not-applied/indexcolor @@ -0,0 +1,670 @@ +# vim:ft=diff: +This is the indexcolor patch by Christian Aichinger . + +This patch enables different colorings for different parts of the index +display. For example you can choose one color for the subject, another one for +the author, and a third one for the flags. + +* Patch last synced with upstream: + - Date: 2007-02-15 + - File: http://greek0.net/mutt.html + http://greek0.net/patches/mutt-1.5.12-indexcolor-3+cb.diff + +* Changes made: + - Repatch for 1.5.13. + - Remove trailing whitespace. + +== END PATCH +Index: mutt/color.c +=================================================================== +--- mutt.orig/color.c 2007-02-15 21:26:09.140472816 +0100 ++++ mutt/color.c 2007-02-15 21:26:47.860586464 +0100 +@@ -35,6 +35,8 @@ int ColorDefs[MT_COLOR_MAX]; + COLOR_LINE *ColorHdrList = NULL; + COLOR_LINE *ColorBodyList = NULL; + COLOR_LINE *ColorIndexList = NULL; ++COLOR_LINE *ColorIndexSubjectList = NULL; ++COLOR_LINE *ColorIndexAuthorList = NULL; + + /* local to this file */ + static int ColorQuoteSize; +@@ -93,6 +95,14 @@ static struct mapping_t Fields[] = + { "bold", MT_COLOR_BOLD }, + { "underline", MT_COLOR_UNDERLINE }, + { "index", MT_COLOR_INDEX }, ++ { "index_subject", MT_COLOR_INDEX_SUBJECT }, ++ { "index_author", MT_COLOR_INDEX_AUTHOR }, ++ { "index_collapsed", MT_COLOR_INDEX_COLLAPSED }, ++ { "index_date", MT_COLOR_INDEX_DATE }, ++ { "index_flags", MT_COLOR_INDEX_FLAGS }, ++ { "index_label", MT_COLOR_INDEX_LABEL }, ++ { "index_number", MT_COLOR_INDEX_NUMBER }, ++ { "index_size", MT_COLOR_INDEX_SIZE }, + { NULL, 0 } + }; + +@@ -364,12 +374,55 @@ int mutt_parse_unmono (BUFFER *buf, BUFF + return _mutt_parse_uncolor(buf, s, data, err, 0); + } + ++static void ++mutt_do_uncolor (BUFFER *buf, BUFFER *s, COLOR_LINE **ColorList, ++ int *do_cache, int parse_uncolor) ++{ ++ COLOR_LINE *tmp, *last = NULL; ++ ++ do ++ { ++ mutt_extract_token (buf, s, 0); ++ if (!mutt_strcmp ("*", buf->data)) ++ { ++ for (tmp = *ColorList; tmp; ) ++ { ++ if (!*do_cache) ++ *do_cache = 1; ++ last = tmp; ++ tmp = tmp->next; ++ mutt_free_color_line(&last, parse_uncolor); ++ } ++ *ColorList = NULL; ++ } ++ else ++ { ++ for (last = NULL, tmp = *ColorList; tmp; last = tmp, tmp = tmp->next) ++ { ++ if (!mutt_strcmp (buf->data, tmp->pattern)) ++ { ++ if (!*do_cache) ++ *do_cache = 1; ++ dprint(1,(debugfile,"Freeing pattern \"%s\" from ColorList\n", ++ tmp->pattern)); ++ if (last) ++ last->next = tmp->next; ++ else ++ *ColorList = tmp->next; ++ mutt_free_color_line(&tmp, parse_uncolor); ++ break; ++ } ++ } ++ } ++ } ++ while (MoreArgs (s)); ++} ++ + static int + _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err, + short parse_uncolor) + { + int object = 0, do_cache = 0; +- COLOR_LINE *tmp, *last = NULL; + + mutt_extract_token (buf, s, 0); + +@@ -379,6 +432,13 @@ _mutt_parse_uncolor (BUFFER *buf, BUFFER + return (-1); + } + ++ if (object > MT_COLOR_INDEX_AUTHOR) /* uncolor index column */ ++ { ++ ColorDefs[object] = 0; ++ set_option (OPTFORCEREDRAWINDEX); ++ return (0); ++ } ++ + if (mutt_strncmp (buf->data, "index", 5) != 0) + { + snprintf (err->data, err->dsize, +@@ -416,44 +476,12 @@ _mutt_parse_uncolor (BUFFER *buf, BUFFER + return 0; + } + +- +- do +- { +- mutt_extract_token (buf, s, 0); +- if (!mutt_strcmp ("*", buf->data)) +- { +- for (tmp = ColorIndexList; tmp; ) +- { +- if (!do_cache) +- do_cache = 1; +- last = tmp; +- tmp = tmp->next; +- mutt_free_color_line(&last, parse_uncolor); +- } +- ColorIndexList = NULL; +- } +- else +- { +- for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next) +- { +- if (!mutt_strcmp (buf->data, tmp->pattern)) +- { +- if (!do_cache) +- do_cache = 1; +- dprint(1,(debugfile,"Freeing pattern \"%s\" from ColorIndexList\n", +- tmp->pattern)); +- if (last) +- last->next = tmp->next; +- else +- ColorIndexList = tmp->next; +- mutt_free_color_line(&tmp, parse_uncolor); +- break; +- } +- } +- } +- } +- while (MoreArgs (s)); +- ++ if (object == MT_COLOR_INDEX) ++ mutt_do_uncolor(buf, s, &ColorIndexList, &do_cache, parse_uncolor); ++ if (object == MT_COLOR_INDEX_SUBJECT) ++ mutt_do_uncolor(buf, s, &ColorIndexSubjectList, &do_cache, parse_uncolor); ++ if (object == MT_COLOR_INDEX_AUTHOR) ++ mutt_do_uncolor(buf, s, &ColorIndexAuthorList, &do_cache, parse_uncolor); + + if (do_cache && !option (OPTNOCURSES)) + { +@@ -693,7 +721,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER * + + /* extract a regular expression if needed */ + +- if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX) ++ if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX || object == MT_COLOR_INDEX_SUBJECT || object == MT_COLOR_INDEX_AUTHOR) + { + if (!MoreArgs (s)) + { +@@ -737,6 +765,18 @@ _mutt_parse_color (BUFFER *buf, BUFFER * + r = add_pattern (&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1); + set_option (OPTFORCEREDRAWINDEX); + } ++ else if (object == MT_COLOR_INDEX_SUBJECT) ++ { ++ r = add_pattern (&ColorIndexSubjectList, buf->data, ++ 1, fg, bg, attr, err, 1); ++ set_option (OPTFORCEREDRAWINDEX); ++ } ++ else if (object == MT_COLOR_INDEX_AUTHOR) ++ { ++ r = add_pattern (&ColorIndexAuthorList, buf->data, ++ 1, fg, bg, attr, err, 1); ++ set_option (OPTFORCEREDRAWINDEX); ++ } + else if (object == MT_COLOR_QUOTED) + { + if (q_level >= ColorQuoteSize) +@@ -762,7 +802,11 @@ _mutt_parse_color (BUFFER *buf, BUFFER * + ColorQuote[q_level] = fgbgattr_to_color(fg, bg, attr); + } + else ++ { + ColorDefs[object] = fgbgattr_to_color(fg, bg, attr); ++ if (object > MT_COLOR_INDEX_AUTHOR) ++ set_option (OPTFORCEREDRAWINDEX); ++ } + + #ifdef HAVE_COLOR + # ifdef HAVE_BKGDSET +Index: mutt/curs_lib.c +=================================================================== +--- mutt.orig/curs_lib.c 2007-02-15 21:26:09.183466280 +0100 ++++ mutt/curs_lib.c 2007-02-15 21:26:15.898445448 +0100 +@@ -648,6 +648,7 @@ void mutt_format_string (char *dest, siz + size_t k, k2; + char scratch[MB_LEN_MAX]; + mbstate_t mbstate1, mbstate2; ++ int escaped = 0; + + memset(&mbstate1, 0, sizeof (mbstate1)); + memset(&mbstate2, 0, sizeof (mbstate2)); +@@ -663,7 +664,15 @@ void mutt_format_string (char *dest, siz + k = (k == (size_t)(-1)) ? 1 : n; + wc = replacement_char (); + } +- if (arboreal && wc < M_TREE_MAX) ++ if (escaped) { ++ escaped = 0; ++ w = 0; ++ } ++ else if (arboreal && wc == M_SPECIAL_INDEX) { ++ escaped = 1; ++ w = 0; ++ } ++ else if (arboreal && wc < M_TREE_MAX) + w = 1; /* hack */ + else + { +Index: mutt/hdrline.c +=================================================================== +--- mutt.orig/hdrline.c 2007-02-15 21:26:09.226459744 +0100 ++++ mutt/hdrline.c 2007-02-15 21:26:15.899445296 +0100 +@@ -99,6 +99,34 @@ static int first_mailing_list (char *buf + return 0; + } + ++/* Takes the color to embed, the buffer to manipulate and the buffer length as ++ * arguments. ++ * Returns the number of chars written. */ ++static size_t add_index_color(char *buf, size_t buflen, ++ format_flag flags, char color) ++{ ++ int len; ++ ++ /* only add color markers if we are operating on main index entries. */ ++ if (!(flags & M_FORMAT_INDEX)) ++ return 0; ++ ++ if (color == MT_COLOR_INDEX) { /* buf might be uninitialized other cases */ ++ len = mutt_strlen(buf); ++ buf += len; ++ buflen -= len; ++ } ++ ++ if (buflen < 2) ++ return 0; ++ ++ buf[0] = M_SPECIAL_INDEX; ++ buf[1] = color; ++ buf[2] = '\0'; ++ ++ return 2; ++} ++ + static void make_from (ENVELOPE *hdr, char *buf, size_t len, int do_lists) + { + int me; +@@ -251,6 +279,7 @@ hdr_format_str (char *dest, + #define THREAD_NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 1) + #define THREAD_OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 2) + size_t len; ++ size_t colorlen; + + hdr = hfi->hdr; + ctx = hfi->ctx; +@@ -302,12 +331,17 @@ hdr_format_str (char *dest, + break; + + case 'c': ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SIZE); + mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length); +- mutt_format_s (dest, destlen, prefix, buf2); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + break; + + case 'C': +- snprintf (fmt, sizeof (fmt), "%%%sd", prefix); ++ colorlen = add_index_color(fmt, sizeof(fmt), flags, MT_COLOR_INDEX_NUMBER); ++ snprintf (fmt+colorlen, sizeof(fmt)-colorlen, "%%%sd", prefix); ++ add_index_color(fmt+colorlen, sizeof(fmt)-colorlen, flags, MT_COLOR_INDEX); ++ + snprintf (dest, destlen, fmt, hdr->msgno + 1); + break; + +@@ -406,7 +440,10 @@ hdr_format_str (char *dest, + if (do_locales) + setlocale (LC_TIME, "C"); + +- mutt_format_s (dest, destlen, prefix, buf2); ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_DATE); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); ++ + if (len > 0 && op != 'd' && op != 'D') /* Skip ending op */ + src = cp + 1; + } +@@ -436,8 +473,10 @@ hdr_format_str (char *dest, + case 'F': + if (!optional) + { ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR); + make_from (hdr->env, buf2, sizeof (buf2), 0); +- mutt_format_s (dest, destlen, prefix, buf2); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + } + else if (mutt_addr_is_user (hdr->env->from)) + optional = 0; +@@ -463,7 +502,9 @@ hdr_format_str (char *dest, + if (!optional) + { + snprintf (fmt, sizeof (fmt), "%%%sd", prefix); +- snprintf (dest, destlen, fmt, (int) hdr->lines); ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SIZE); ++ snprintf (dest+colorlen, destlen-colorlen, fmt, (int) hdr->lines); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + } + else if (hdr->lines <= 0) + optional = 0; +@@ -472,8 +513,10 @@ hdr_format_str (char *dest, + case 'L': + if (!optional) + { ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR); + make_from (hdr->env, buf2, sizeof (buf2), 1); +- mutt_format_s (dest, destlen, prefix, buf2); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + } + else if (!check_for_mailing_list (hdr->env->to, NULL, NULL, 0) && + !check_for_mailing_list (hdr->env->cc, NULL, NULL, 0)) +@@ -528,10 +571,16 @@ hdr_format_str (char *dest, + snprintf (fmt, sizeof (fmt), "%%%sd", prefix); + if (!optional) + { +- if (threads && is_index && hdr->collapsed && hdr->num_hidden > 1) +- snprintf (dest, destlen, fmt, hdr->num_hidden); +- else if (is_index && threads) +- mutt_format_s (dest, destlen, prefix, " "); ++ colorlen = add_index_color(dest, destlen, flags, ++ MT_COLOR_INDEX_COLLAPSED); ++ if (threads && is_index && hdr->collapsed && hdr->num_hidden > 1) { ++ snprintf (dest+colorlen, destlen-colorlen, fmt, hdr->num_hidden); ++ add_index_color(dest, destlen-colorlen, flags, MT_COLOR_INDEX); ++ } ++ else if (is_index && threads) { ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, " "); ++ add_index_color(dest, destlen-colorlen, flags, MT_COLOR_INDEX); ++ } + else + *dest = '\0'; + } +@@ -548,15 +597,23 @@ hdr_format_str (char *dest, + { + if (flags & M_FORMAT_FORCESUBJ) + { +- mutt_format_s (dest, destlen, "", NONULL (hdr->env->subject)); ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SUBJECT); ++ mutt_format_s (dest+colorlen, destlen-colorlen, "", ++ NONULL (hdr->env->subject)); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); ++ + snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, dest); + mutt_format_s_tree (dest, destlen, prefix, buf2); + } + else + mutt_format_s_tree (dest, destlen, prefix, hdr->tree); + } +- else +- mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->subject)); ++ else { ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SUBJECT); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, ++ NONULL (hdr->env->subject)); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); ++ } + break; + + case 'S': +@@ -652,7 +709,9 @@ hdr_format_str (char *dest, + hdr->tagged ? '*' : + (hdr->flagged ? '!' : + (Tochars && ((i = mutt_user_is_recipient (hdr)) < mutt_strlen (Tochars)) ? Tochars[i] : ' '))); +- mutt_format_s (dest, destlen, prefix, buf2); ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_FLAGS); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + break; + + case 'X': +@@ -672,7 +731,9 @@ hdr_format_str (char *dest, + if (optional) + optional = hdr->env->x_label ? 1 : 0; + +- mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label)); ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_LABEL); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, NONULL (hdr->env->x_label)); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + break; + + case 'Y': +@@ -698,10 +759,12 @@ hdr_format_str (char *dest, + if (optional) + optional = i; + ++ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_LABEL); + if (i) +- mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label)); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, NONULL (hdr->env->x_label)); + else +- mutt_format_s (dest, destlen, prefix, ""); ++ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, ""); ++ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX); + + break; + +Index: mutt/menu.c +=================================================================== +--- mutt.orig/menu.c 2007-02-15 21:26:09.270453056 +0100 ++++ mutt/menu.c 2007-02-15 21:26:15.900445144 +0100 +@@ -36,7 +36,30 @@ extern int Charset_is_utf8; /* FIXME: ba + + extern size_t UngetCount; + +-static void print_enriched_string (int attr, unsigned char *s, int do_color) ++static int get_color(int index, int type) { ++ COLOR_LINE *color; ++ HEADER *hdr = Context->hdrs[index]; ++ ++ switch (type) { ++ case MT_COLOR_INDEX_SUBJECT: ++ color = ColorIndexSubjectList; ++ break; ++ case MT_COLOR_INDEX_AUTHOR: ++ color = ColorIndexAuthorList; ++ break; ++ default: ++ return ColorDefs[type]; ++ } ++ ++ for (; color; color = color->next) ++ if (mutt_pattern_exec (color->color_pattern, M_MATCH_FULL_ADDRESS, ++ Context, hdr)) ++ return color->pair; ++ ++ return 0; ++} ++ ++static void print_enriched_string (int index, int attr, unsigned char *s, int do_color) + { + wchar_t wc; + size_t k; +@@ -133,6 +156,18 @@ static void print_enriched_string (int a + } + if (do_color) attrset(attr); + } ++ else if(*s == M_SPECIAL_INDEX) ++ { ++ s++; ++ if (do_color) { ++ if (*s == MT_COLOR_INDEX) ++ attrset(attr); ++ else ++ attron(get_color(index, *s)); ++ } ++ s++; ++ n -= 2; ++ } + else if ((k = mbrtowc (&wc, (char *)s, n, &mbstate)) > 0) + { + addnstr ((char *)s, k); +@@ -235,7 +270,7 @@ void menu_redraw_index (MUTTMENU *menu) + addstr (" "); + } + +- print_enriched_string (menu->color(i), (unsigned char *) buf, 1); ++ print_enriched_string (i, menu->color(i), (unsigned char *) buf, 1); + SETCOLOR (MT_COLOR_NORMAL); + } + else +@@ -249,7 +284,7 @@ void menu_redraw_index (MUTTMENU *menu) + } + + CLEARLINE (i - menu->top + menu->offset); +- print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current); ++ print_enriched_string (i, menu->color(i), (unsigned char *) buf, i != menu->current); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } +@@ -286,7 +321,7 @@ void menu_redraw_motion (MUTTMENU *menu) + menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); + menu_pad_string (buf, sizeof (buf)); + move (menu->oldcurrent + menu->offset - menu->top, 3); +- print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); ++ print_enriched_string (menu->oldcurrent, menu->color(menu->oldcurrent), (unsigned char *) buf, 1); + SETCOLOR (MT_COLOR_NORMAL); + } + +@@ -304,7 +339,7 @@ void menu_redraw_motion (MUTTMENU *menu) + clrtoeol (); + menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); + menu_pad_string (buf, sizeof (buf)); +- print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); ++ print_enriched_string (menu->oldcurrent, menu->color(menu->oldcurrent), (unsigned char *) buf, 1); + + /* now draw the new one to reflect the change */ + menu_make_entry (buf, sizeof (buf), menu, menu->current); +@@ -313,7 +348,7 @@ void menu_redraw_motion (MUTTMENU *menu) + ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); + CLEARLINE (menu->current - menu->top + menu->offset); +- print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); ++ print_enriched_string (menu->current, menu->color(menu->current), (unsigned char *) buf, 0); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } +@@ -339,7 +374,7 @@ void menu_redraw_current (MUTTMENU *menu + attrset (attr); + addch (' '); + menu_pad_string (buf, sizeof (buf)); +- print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1); ++ print_enriched_string (menu->current, menu->color(menu->current), (unsigned char *) buf, 1); + SETCOLOR (MT_COLOR_NORMAL); + } + else +@@ -348,7 +383,7 @@ void menu_redraw_current (MUTTMENU *menu + ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); + clrtoeol (); +- print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); ++ print_enriched_string (menu->current, menu->color(menu->current), (unsigned char *) buf, 0); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } +Index: mutt/mutt_curses.h +=================================================================== +--- mutt.orig/mutt_curses.h 2007-02-15 21:26:09.314446368 +0100 ++++ mutt/mutt_curses.h 2007-02-15 21:26:15.900445144 +0100 +@@ -126,6 +126,16 @@ enum + MT_COLOR_BOLD, + MT_COLOR_UNDERLINE, + MT_COLOR_INDEX, ++ /* please no non-MT_COLOR_INDEX objects after this point */ ++ MT_COLOR_INDEX_SUBJECT, ++ MT_COLOR_INDEX_AUTHOR, ++ /* below only index coloring stuff that doesn't have a colorline! */ ++ MT_COLOR_INDEX_COLLAPSED, ++ MT_COLOR_INDEX_DATE, ++ MT_COLOR_INDEX_FLAGS, ++ MT_COLOR_INDEX_LABEL, ++ MT_COLOR_INDEX_NUMBER, ++ MT_COLOR_INDEX_SIZE, + MT_COLOR_MAX + }; + +@@ -165,6 +175,8 @@ extern int ColorDefs[]; + extern COLOR_LINE *ColorHdrList; + extern COLOR_LINE *ColorBodyList; + extern COLOR_LINE *ColorIndexList; ++extern COLOR_LINE *ColorIndexSubjectList; ++extern COLOR_LINE *ColorIndexAuthorList; + + void ci_init_color (void); + void ci_start_color (void); +Index: mutt/mutt.h +=================================================================== +--- mutt.orig/mutt.h 2007-02-15 21:26:09.358439680 +0100 ++++ mutt/mutt.h 2007-02-15 21:26:15.901444992 +0100 +@@ -176,6 +176,8 @@ typedef enum + #define M_TREE_MISSING 13 + #define M_TREE_MAX 14 + ++#define M_SPECIAL_INDEX M_TREE_MAX ++ + #define M_THREAD_COLLAPSE (1<<0) + #define M_THREAD_UNCOLLAPSE (1<<1) + #define M_THREAD_GET_HIDDEN (1<<2) +Index: mutt/doc/manual.xml.head +=================================================================== +--- mutt.orig/doc/manual.xml.head 2007-02-15 21:26:09.446426304 +0100 ++++ mutt/doc/manual.xml.head 2007-02-15 21:26:15.903444688 +0100 +@@ -1837,8 +1837,8 @@ silently truncated at the screen width, + + + Usage: color object foreground background [ regexp ] +-Usage: color index foreground background pattern +-Usage: uncolor index pattern [ pattern ... ] ++Usage: color index-object foreground background pattern ++ Usage: uncolor index-object pattern [ pattern ... ] + + + +@@ -1901,6 +1901,54 @@ index (match pattern + + ++index_author (color of the author name in the index, uses pattern) ++ ++ ++ ++ ++ ++index_collapsed (the number of messages in a collapsed thread in the index) ++ ++ ++ ++ ++ ++index_date (color of the date field in the index) ++ ++ ++ ++ ++ ++index_flags (color of the message flags in the index) ++ ++ ++ ++ ++ ++index_label (color of the message label in the index) ++ ++ ++ ++ ++ ++index_number (color of the message number in the index) ++ ++ ++ ++ ++ ++index_size (color of the message size and line number in the index) ++ ++ ++ ++ ++ ++index_subject (color of the subject in the index, uses pattern) ++ ++ ++ ++ ++ + indicator (arrow or bar used to indicate the current item in a menu) + + +--- a/PATCHES ++++ b/PATCHES +@@ -0,0 +1 @@ ++patch-1.5.13.greek0.indexcolor-3+cb --- mutt-1.5.21.orig/debian/patches/misc/am-maintainer-mode +++ mutt-1.5.21/debian/patches/misc/am-maintainer-mode @@ -0,0 +1,15 @@ +Adds AM_MAINTAINER_MODE to configure.ac so the timestamp of the +automake files won't be updated + +Index: debian-mutt-sidebar/configure.ac +=================================================================== +--- debian-mutt-sidebar.orig/configure.ac 2007-08-11 16:42:36.000000000 +0200 ++++ debian-mutt-sidebar/configure.ac 2007-08-11 16:42:49.000000000 +0200 +@@ -9,6 +9,7 @@ AM_CONFIG_HEADER([config.h]) + + mutt_cv_version=`cat $srcdir/VERSION` + AM_INIT_AUTOMAKE(mutt, $mutt_cv_version) ++AM_MAINTAINER_MODE + AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION']) + + AC_GNU_SOURCE --- mutt-1.5.21.orig/debian/patches/misc/hyphen-as-minus.patch +++ mutt-1.5.21/debian/patches/misc/hyphen-as-minus.patch @@ -0,0 +1,36 @@ +patch to escape all hyphen so they will be interpreted as minus +signs and lintian will not complain + +--- a/doc/mutt.man ++++ b/doc/mutt.man +@@ -23,7 +23,7 @@ + .SH SYNOPSIS + .PP + .B mutt +-[-nRyzZ] ++[\-nRyzZ] + [\-e \fIcmd\fP] [\-F \fIfile\fP] [\-m \fItype\fP] [\-f \fIfile\fP] + .PP + .B mutt +@@ -59,10 +59,10 @@ + [\-n] [\-e \fIcmd\fP] [\-F \fIfile\fP] \-Q \fIquery\fP + .PP + .B mutt +--v[v] ++\-v[v] + .PP + .B mutt +--D ++\-D + .SH DESCRIPTION + .PP + Mutt is a small but very powerful text based program for reading and sending electronic +@@ -81,7 +81,7 @@ + .IP "-a \fIfile\fP [...]" + Attach a file to your message using MIME. + When attaching single or multiple files, separating filenames and recipient addresses with +-"\-\-" is mandatory, e.g. \fBmutt -a image.jpg \-\- addr1\fP or ++"\-\-" is mandatory, e.g. \fBmutt \-a image.jpg \-\- addr1\fP or + \fBmutt \-a img.jpg *.png \-\- addr1 addr2\fP. + The \-a option must be placed at the end of command line options. + .IP "-b \fIaddress\fP" --- mutt-1.5.21.orig/debian/patches/misc/hg.pmdef.debugtime +++ mutt-1.5.21/debian/patches/misc/hg.pmdef.debugtime @@ -0,0 +1,57 @@ +see http://bugs.mutt.org/3263, this patch adds time/date to +the entries in .muttdebug so it will be easier to correlate them +to external events logged in tcpdump streams or logfiles + +--- a/init.c ++++ b/init.c +@@ -2846,8 +2846,8 @@ + { + t = time (0); + setbuf (debugfile, NULL); /* don't buffer the debugging output! */ +- fprintf (debugfile, "Mutt %s started at %s.\nDebugging at level %d.\n\n", +- MUTT_VERSION, asctime (localtime (&t)), debuglevel); ++ dprint(1,(debugfile,"Mutt/%s (%s) debugging at level %d\n", ++ MUTT_VERSION, ReleaseDate, debuglevel)); + } + } + #endif +--- a/lib.c ++++ b/lib.c +@@ -1007,6 +1007,24 @@ + return sysexits_h[i].str; + } + ++void mutt_debug (FILE *fp, const char *fmt, ...) ++{ ++ va_list ap; ++ time_t now = time (NULL); ++ static char buf[23] = ""; ++ static time_t last = 0; ++ ++ if (now > last) ++ { ++ strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S", localtime (&now)); ++ last = now; ++ } ++ fprintf (fp, "[%s] ", buf); ++ va_start (ap, fmt); ++ vfprintf (fp, fmt, ap); ++ va_end (ap); ++} ++ + int mutt_atos (const char *str, short *dst) + { + int rc; +--- a/lib.h ++++ b/lib.h +@@ -126,7 +126,9 @@ + MUTT_LIB_WHERE FILE *debugfile MUTT_LIB_INITVAL(0); + MUTT_LIB_WHERE int debuglevel MUTT_LIB_INITVAL(0); + +-# define dprint(N,X) do { if(debuglevel>=N && debugfile) fprintf X; } while (0) ++void mutt_debug (FILE *, const char *, ...); ++ ++# define dprint(N,X) do { if(debuglevel>=N && debugfile) mutt_debug X; } while (0) + + # else + --- mutt-1.5.21.orig/debian/patches/misc/gpg.rc-paths +++ mutt-1.5.21/debian/patches/misc/gpg.rc-paths @@ -0,0 +1,20 @@ +use the correct path of pgpewrap + +Index: debian-mutt/contrib/gpg.rc +=================================================================== +--- debian-mutt.orig/contrib/gpg.rc 2007-03-20 22:20:31.000000000 +0100 ++++ debian-mutt/contrib/gpg.rc 2007-03-20 22:25:55.000000000 +0100 +@@ -49,11 +49,11 @@ set pgp_clearsign_command="gpg --no-verb + + # create a pgp/mime encrypted attachment + # set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" +-set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" ++set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" + + # create a pgp/mime encrypted and signed attachment + # set pgp_encrypt_sign_command="pgpewrap gpg-2comp %?p?--passphrase-fd 0? -v --batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" +-set pgp_encrypt_sign_command="pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" ++set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" + + # import a key into the public key ring + set pgp_import_command="gpg --no-verbose --import %f" --- mutt-1.5.21.orig/debian/patches/misc/define-pgp_getkeys_command.diff +++ mutt-1.5.21/debian/patches/misc/define-pgp_getkeys_command.diff @@ -0,0 +1,13 @@ +disabling pgp_getkeys_command until upstream fixes it + +--- a/contrib/gpg.rc ++++ b/contrib/gpg.rc +@@ -72,6 +72,8 @@ set pgp_list_secring_command="gpg --no-v + + # fetch keys + # set pgp_getkeys_command="pkspxycwrap %r" ++# This will work when #172960 will be fixed upstream ++# set pgp_getkeys_command="gpg --recv-keys %r" + + # pattern for good signature - may need to be adapted to locale! + --- mutt-1.5.21.orig/debian/patches/misc/smime.rc +++ mutt-1.5.21/debian/patches/misc/smime.rc @@ -0,0 +1,49 @@ +add CA's provided by ca-certificates to the ones distributed by +the default installation of mutt + +--- a/contrib/smime.rc ++++ b/contrib/smime.rc +@@ -4,33 +4,34 @@ + + # If you compiled mutt with support for both PGP and S/MIME, PGP + # will be the default method unless the following option is set +-set smime_is_default ++#set smime_is_default + + # Uncoment this if you don't want to set labels for certificates you add. + # unset smime_ask_cert_label + + # Passphrase expiration +-set smime_timeout=300 ++#set smime_timeout=300 + + # Global crypto options -- these affect PGP operations as well. +-set crypt_autosign = yes +-set crypt_replyencrypt = yes +-set crypt_replysign = yes +-set crypt_replysignencrypted = yes +-set crypt_verify_sig = yes ++#set crypt_autosign = yes ++#set crypt_replyencrypt = yes ++#set crypt_replysign = yes ++#set crypt_replysignencrypted = yes ++#set crypt_verify_sig = yes + + # Section A: Key Management. + + # The (default) keyfile for signing/decrypting. Uncomment the following + # line and replace the keyid with your own. +-set smime_default_key="12345678.0" ++#set smime_default_key="12345678.0" + + # Uncommen to make mutt ask what key to use when trying to decrypt a message. + # It will use the default key above (if that was set) else. + # unset smime_decrypt_use_default_key + + # Path to a file or directory with trusted certificates +-set smime_ca_location="~/.smime/ca-bundle.crt" ++#set smime_ca_location="~/.smime/ca-bundle.crt" ++set smime_ca_location=`for f in $HOME/.smime/ca-certificates.crt $HOME/.smime/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt ; do if [ -e $f ] ; then echo $f ; exit ; fi ; done` + + # Path to where all known certificates go. (must exist!) + set smime_certificates="~/.smime/certificates" --- mutt-1.5.21.orig/debian/patches/misc/smime_keys-manpage.patch +++ mutt-1.5.21/debian/patches/misc/smime_keys-manpage.patch @@ -0,0 +1,133 @@ +add a missing manpage for smime_keys +see upstream CR #3272 + +Index: mutt/doc/Makefile.am +=================================================================== +--- mutt.orig/doc/Makefile.am 2009-06-25 12:35:40.000000000 +0200 ++++ mutt/doc/Makefile.am 2009-06-25 12:36:48.000000000 +0200 +@@ -10,6 +10,7 @@ + noinst_PROGRAMS = makedoc + + EXTRA_DIST = dotlock.man \ ++ smime_keys.man \ + muttbug.man \ + mutt.man \ + PGP-Notes.txt \ +@@ -45,13 +46,14 @@ + + all: makedoc-all + +-makedoc-all: mutt.1 muttrc.man manual.html stamp-doc-rc stamp-doc-chunked manual.txt ++makedoc-all: mutt.1 smime_keys.1 muttrc.man manual.html stamp-doc-rc stamp-doc-chunked manual.txt + + install-data-local: makedoc-all instdoc + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1 + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man5 + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir) + ./instdoc mutt.1 $(DESTDIR)$(mandir)/man1/mutt.1 ++ ./instdoc smime_keys.1 $(DESTDIR)$(mandir)/man1/smime_keys.1 + ./instdoc $(srcdir)/muttbug.man $(DESTDIR)$(mandir)/man1/flea.1 + ./instdoc $(srcdir)/muttbug.man $(DESTDIR)$(mandir)/man1/muttbug.1 + test x@DOTLOCK_TARGET@ = x || ./instdoc $(srcdir)/dotlock.man \ +@@ -80,7 +82,7 @@ + fi + + uninstall-local: +- for f in mutt.1 mutt_dotlock.1 flea.1 muttbug.1 ; do \ ++ for f in mutt.1 mutt_dotlock.1 flea.1 muttbug.1 smime_keys.1; do \ + rm -f $(DESTDIR)$(mandir)/man1/$$f ; \ + done + for f in muttrc.5 mbox.5 mmdf.5 ; do \ +@@ -142,7 +144,7 @@ + rm -rf vars.tmp.1 vars.tmp.2 + + clean-local: +- rm -f *~ *.html *.orig *.rej stamp-doc-* *.ps mutt.1 muttrc.man ++ rm -f *~ *.html *.orig *.rej stamp-doc-* *.ps mutt.1 smime_keys.1 muttrc.man + rm -f *.aux *.log *.tex *.out + + DISTCLEANFILES=manual.txt manual.html manual.xml manual.pdf html \ +@@ -166,6 +168,9 @@ + mutt.1: $(srcdir)/mutt.man + $(EDIT) $(srcdir)/mutt.man > $@ + ++smime_keys.1: $(srcdir)/smime_keys.man ++ $(EDIT) $(srcdir)/smime_keys.man > $@ ++ + stamp-doc-xml: makedoc$(EXEEXT) $(top_srcdir)/init.h \ + manual.xml.head $(top_srcdir)/functions.h $(top_srcdir)/OPS* manual.xml.tail \ + $(srcdir)/gen-map-doc $(top_srcdir)/VERSION $(top_srcdir)/ChangeLog +Index: mutt/doc/smime_keys.man +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ mutt/doc/smime_keys.man 2009-06-25 12:36:48.000000000 +0200 +@@ -0,0 +1,69 @@ ++.\" -*-nroff-*- ++.\" ++.\" ++.\" Copyright (C) 2001,2002 Oliver Ehli ++.\" Copyright (C) 2001 Mike Schiraldi ++.\" Copyright (C) 2003 Bjoern Jacke ++.\" ++.\" This program is free software; you can redistribute it and/or modify ++.\" it under the terms of the GNU General Public License as published by ++.\" the Free Software Foundation; either version 2 of the License, or ++.\" (at your option) any later version. ++.\" ++.\" This program is distributed in the hope that it will be useful, ++.\" but WITHOUT ANY WARRANTY; without even the implied warranty of ++.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++.\" GNU General Public License for more details. ++.\" ++.\" You should have received a copy of the GNU General Public License ++.\" along with this program; if not, write to the Free Software ++.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++.\" ++.TH smime_keys 1 "May 2009" Unix "User Manuals" ++.SH "NAME" ++smime_keys \- Utility to add S/MIME certificate to the internal database used by mutt ++.SH SYNOPSIS ++.PP ++.B smime_keys ++ [file(s) | keyID [file(s)]] ++.SH "DESCRIPTION" ++The purpose of this tool is to manipulate the internal database of S/MIME certificates ++used by mutt to sign mail messages which will be sent or to verify mail messages received ++and signed with S/MIME ++.SH OPTIONS ++.PP ++.IP \fBinit\fP ++no files needed, inits directory structure. ++.IP \fBlist\fP ++lists the certificates stored in database. ++.IP \fBlabel\fP ++keyID required. changes/removes/adds label. ++.IP \fBremove\fP ++keyID required. ++.IP \fBverify\fP ++1=keyID and optionally 2=CRL ++Verifies the certificate chain, and optionally wether ++this certificate is included in supplied CRL (PEM format). ++Note: to verify all certificates at the same time, ++replace keyID with "all" ++.IP \fBadd_cert\fP ++certificate required. ++.IP \fBadd_chain\fP ++three files reqd: 1=Key, 2=certificate ++plus 3=intermediate certificate(s). ++.IP \fBadd_p12\fP ++one file reqd. Adds keypair to database. ++file is PKCS12 (e.g. export from netscape). ++.IP \fBadd_pem\fP ++one file reqd. Adds keypair to database. ++(file was converted from e.g. PKCS12). ++.IP \fBadd_root\fP ++one file reqd. Adds PEM root certificate to the location ++specified within muttrc (smime_verify_* command) ++.SH NO WARRANTIES ++This program is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++.PP ++Mutt Home Page: http://www.mutt.org/ --- mutt-1.5.21.orig/debian/patches/misc/manpage-typos.patch +++ mutt-1.5.21/debian/patches/misc/manpage-typos.patch @@ -0,0 +1,46 @@ +Fixes some errors in the manpage, see http://bugs.debian.org/428017 + +--- a/init.h ++++ b/init.h +@@ -760,7 +760,7 @@ + ** If the GECOS field contains a string like ``lastname, firstname'' then you + ** should set it to ``\fC.*\fP''. + ** .pp +- ** This can be useful if you see the following behavior: you address a e-mail ++ ** This can be useful if you see the following behavior: you address an e-mail + ** to user ID ``stevef'' whose full name is ``Steve Franklin''. If mutt expands + ** ``stevef'' to ``"Franklin" stevef@foo.bar'' then you should set the $$gecos_mask to + ** a regular expression that will match the whole name so mutt will expand +@@ -1869,7 +1869,7 @@ + { "pgp_clearsign_command", DT_STR, R_NONE, UL &PgpClearSignCommand, 0 }, + /* + ** .pp +- ** This format is used to create a old-style ``clearsigned'' PGP ++ ** This format is used to create an old-style ``clearsigned'' PGP + ** message. Note that the use of this format is \fBstrongly\fP + ** \fBdeprecated\fP. + ** .pp +@@ -2218,20 +2218,20 @@ + { "ssl_use_sslv2", DT_BOOL, R_NONE, OPTSSLV2, 1 }, + /* + ** .pp +- ** This variables specifies whether to attempt to use SSLv2 in the ++ ** This variable specifies whether to attempt to use SSLv2 in the + ** SSL authentication process. + */ + # endif /* defined USE_SSL_OPENSSL */ + { "ssl_use_sslv3", DT_BOOL, R_NONE, OPTSSLV3, 1 }, + /* + ** .pp +- ** This variables specifies whether to attempt to use SSLv3 in the ++ ** This variable specifies whether to attempt to use SSLv3 in the + ** SSL authentication process. + */ + { "ssl_use_tlsv1", DT_BOOL, R_NONE, OPTTLSV1, 1 }, + /* + ** .pp +- ** This variables specifies whether to attempt to use TLSv1 in the ++ ** This variable specifies whether to attempt to use TLSv1 in the + ** SSL authentication process. + */ + # ifdef USE_SSL_GNUTLS --- mutt-1.5.21.orig/debian/patches/mutt-patched/sidebar-sorted +++ mutt-1.5.21/debian/patches/mutt-patched/sidebar-sorted @@ -0,0 +1,75 @@ +From: Evgeni Golov +License: 3-BSD + +When using IMAP and imap_check_subscribed, the server reports the +dirs in a random order. +This patch introduces a new option, sidebar_sort. Which, when it is +set, sorts the dirs in the sidebar alphabetically. + +I hope, it's usefull for someone ;) + +PS: This has to be applied ontop of my sidebar-dotted patch, but it +should be easy to adopt it to a vanilla mutt. + +--- a/sidebar.c ++++ b/sidebar.c +@@ -54,6 +54,35 @@ + for ( ; tmp->next != 0; tmp = tmp->next ) + tmp->next->prev = tmp; + ++ if (option(OPTSIDEBARSORT)) { ++ int needsort=1; ++ BUFFY *prev; ++ BUFFY *next; ++ BUFFY *tmp2; ++ while (needsort==1) { ++ needsort=0; ++ tmp = Incoming; ++ for ( ; tmp ; tmp=tmp->next ) { ++ if (tmp->next != NULL && strcmp(tmp->path, tmp->next->path) > 0) { ++ needsort=1; ++ prev = tmp->prev; ++ next = tmp->next; ++ if (prev != NULL) ++ prev->next = next; ++ else ++ Incoming = next; ++ next->prev = prev; ++ tmp2 = next->next; ++ next->next = tmp; ++ tmp->prev = next; ++ tmp->next = tmp2; ++ if (tmp2 != NULL) ++ tmp2->prev = tmp; ++ } ++ } ++ } ++ } ++ + if ( TopBuffy == 0 && BottomBuffy == 0 ) + TopBuffy = Incoming; + if ( BottomBuffy == 0 ) { +--- a/init.h ++++ b/init.h +@@ -1986,6 +1986,11 @@ + ** .pp + ** Should the sidebar shorten the path showed. + */ ++ { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 }, ++ /* ++ ** .pp ++ ** Should the sidebar be sorted. ++ */ + { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, + /* + ** .pp +--- a/mutt.h ++++ b/mutt.h +@@ -433,6 +433,7 @@ + OPTSCORE, + OPTSIDEBAR, + OPTSIDEBARSHORTPATH, ++ OPTSIDEBARSORT, + OPTSIGDASHES, + OPTSIGONTOP, + OPTSORTRE, --- mutt-1.5.21.orig/debian/patches/mutt-patched/sidebar +++ mutt-1.5.21/debian/patches/mutt-patched/sidebar @@ -0,0 +1,1331 @@ +This is the sidebar patch. + +When enabled, mutt will show a list of mailboxes with (new) message counts in a +separate column on the left side of the screen. + +As this feature is still considered to be unstable, this patch is only applied +in the "mutt-patched" package. + +* Configuration variables: + + sidebar_delim (string, default "|") + + This specifies the delimiter between the sidebar (if visible) and + other screens. + + sidebar_visible (boolean, default no) + + This specifies whether or not to show sidebar (left-side list of folders). + + sidebar_width (integer, default 0) +- + The width of the sidebar. + +* Patch source: + - http://www.lunar-linux.org/index.php?page=mutt-sidebar + - http://lunar-linux.org/~tchan/mutt/patch-1.5.19.sidebar.20090522.txt + +* Changes made: + - 2008-08-02 myon: Refreshed patch using quilt push -f to remove hunks we do + not need (Makefile.in). + +--- a/buffy.c ++++ b/buffy.c +@@ -312,6 +312,10 @@ + return 0; + } + ++ mailbox->msgcount = 0; ++ mailbox->msg_unread = 0; ++ mailbox->msg_flagged = 0; ++ + while ((de = readdir (dirp)) != NULL) + { + if (*de->d_name == '.') +@@ -329,7 +333,9 @@ + continue; + } + /* one new and undeleted message is enough */ +- mailbox->new = 1; ++ mailbox->has_new = mailbox->new = 1; ++ mailbox->msgcount++; ++ mailbox->msg_unread++; + rc = 1; + break; + } +@@ -337,6 +343,32 @@ + + closedir (dirp); + ++ /* ++ * count read messages (for folderlist (sidebar) we also need to count ++ * messages in cur so that we the total number of messages ++ */ ++ snprintf (path, sizeof (path), "%s/cur", mailbox->path); ++ if ((dirp = opendir (path)) == NULL) ++ { ++ mailbox->magic = 0; ++ } ++ while ((de = readdir (dirp)) != NULL) ++ { ++ char *p; ++ if (*de->d_name != '.') { ++ if ((p = strstr (de->d_name, ":2,"))) { ++ if (!strchr (p + 3, 'T')) { ++ mailbox->msgcount++; ++ if ( !strchr (p + 3, 'S')) ++ mailbox->msg_unread++; ++ if (strchr(p + 3, 'F')) ++ mailbox->msg_flagged++; ++ } ++ } else ++ mailbox->msgcount++; ++ } ++ } ++ + return rc; + } + +@@ -345,14 +377,33 @@ + { + int rc = 0; + int statcheck; ++ CONTEXT *ctx; + + if (option (OPTCHECKMBOXSIZE)) + statcheck = sb->st_size > mailbox->size; + else + statcheck = sb->st_mtime > sb->st_atime + || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime); +- if (statcheck) ++ if (statcheck || mailbox->msgcount == 0) + { ++ BUFFY b = *mailbox; ++ int msgcount = 0; ++ int msg_unread = 0; ++ /* parse the mailbox, to see how much mail there is */ ++ ctx = mx_open_mailbox( mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); ++ if(ctx) ++ { ++ msgcount = ctx->msgcount; ++ msg_unread = ctx->unread; ++ mx_close_mailbox(ctx, 0); ++ } ++ *mailbox = b; ++ mailbox->msgcount = msgcount; ++ mailbox->msg_unread = msg_unread; ++ if(statcheck) ++ { ++ mailbox->has_new = mailbox->new = 1; ++ } + if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited) + { + rc = 1; +@@ -374,9 +425,11 @@ + int mutt_buffy_check (int force) + { + BUFFY *tmp; ++ struct dirent *de, *dp; + struct stat sb; + struct stat contex_sb; + time_t t; ++ CONTEXT *ctx; + + sb.st_size=0; + contex_sb.st_dev=0; +@@ -456,6 +509,20 @@ + case M_MH: + if ((tmp->new = mh_buffy (tmp->path)) > 0) + BuffyCount++; ++ ++ if ((dp = opendir (tmp->path)) == NULL) ++ break; ++ tmp->msgcount = 0; ++ while ((de = readdir (dp))) ++ { ++ if (mh_valid_message (de->d_name)) ++ { ++ tmp->msgcount++; ++ tmp->has_new = tmp->new = 1; ++ } ++ } ++ closedir (dp); ++ + break; + } + } +--- a/buffy.h ++++ b/buffy.h +@@ -25,7 +25,12 @@ + char path[_POSIX_PATH_MAX]; + off_t size; + struct buffy_t *next; ++ struct buffy_t *prev; + short new; /* mailbox has new mail */ ++ short has_new; /* set it new if new and not read */ ++ int msgcount; /* total number of messages */ ++ int msg_unread; /* number of unread messages */ ++ int msg_flagged; /* number of flagged messages */ + short notified; /* user has been notified */ + short magic; /* mailbox type */ + short newly_created; /* mbox or mmdf just popped into existence */ +--- a/color.c ++++ b/color.c +@@ -93,6 +93,8 @@ + { "bold", MT_COLOR_BOLD }, + { "underline", MT_COLOR_UNDERLINE }, + { "index", MT_COLOR_INDEX }, ++ { "sidebar_new", MT_COLOR_NEW }, ++ { "sidebar_flagged", MT_COLOR_FLAGGED }, + { NULL, 0 } + }; + +--- a/compose.c ++++ b/compose.c +@@ -72,7 +72,7 @@ + + #define HDR_XOFFSET 10 + #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ +-#define W (COLS - HDR_XOFFSET) ++#define W (COLS - HDR_XOFFSET - SidebarWidth) + + static char *Prompts[] = + { +@@ -112,7 +112,7 @@ + { + int off = 0; + +- mvaddstr (HDR_CRYPT, 0, "Security: "); ++ mvaddstr (HDR_CRYPT, SidebarWidth, "Security: "); + + if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) + { +@@ -144,7 +144,7 @@ + } + + clrtoeol (); +- move (HDR_CRYPTINFO, 0); ++ move (HDR_CRYPTINFO, SidebarWidth); + clrtoeol (); + + if ((WithCrypto & APPLICATION_PGP) +@@ -161,7 +161,7 @@ + && (msg->security & ENCRYPT) + && SmimeCryptAlg + && *SmimeCryptAlg) { +- mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "), ++ mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "), + NONULL(SmimeCryptAlg)); + off = 20; + } +@@ -175,7 +175,7 @@ + int c; + char *t; + +- mvaddstr (HDR_MIX, 0, " Mix: "); ++ mvaddstr (HDR_MIX, SidebarWidth, " Mix: "); + + if (!chain) + { +@@ -190,7 +190,7 @@ + if (t && t[0] == '0' && t[1] == '\0') + t = ""; + +- if (c + mutt_strlen (t) + 2 >= COLS) ++ if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth) + break; + + addstr (NONULL(t)); +@@ -242,7 +242,7 @@ + + buf[0] = 0; + rfc822_write_address (buf, sizeof (buf), addr, 1); +- mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]); ++ mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]); + mutt_paddstr (W, buf); + } + +@@ -252,10 +252,10 @@ + draw_envelope_addr (HDR_TO, msg->env->to); + draw_envelope_addr (HDR_CC, msg->env->cc); + draw_envelope_addr (HDR_BCC, msg->env->bcc); +- mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); ++ mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); + mutt_paddstr (W, NONULL (msg->env->subject)); + draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); +- mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]); ++ mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]); + mutt_paddstr (W, fcc); + + if (WithCrypto) +@@ -266,7 +266,7 @@ + #endif + + SETCOLOR (MT_COLOR_STATUS); +- mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments")); ++ mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments")); + BKGDSET (MT_COLOR_STATUS); + clrtoeol (); + +@@ -304,7 +304,7 @@ + /* redraw the expanded list so the user can see the result */ + buf[0] = 0; + rfc822_write_address (buf, sizeof (buf), *addr, 1); +- move (line, HDR_XOFFSET); ++ move (line, HDR_XOFFSET+SidebarWidth); + mutt_paddstr (W, buf); + + return 0; +@@ -549,7 +549,7 @@ + if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) + { + mutt_str_replace (&msg->env->subject, buf); +- move (HDR_SUBJECT, HDR_XOFFSET); ++ move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth); + clrtoeol (); + if (msg->env->subject) + mutt_paddstr (W, msg->env->subject); +@@ -566,7 +566,7 @@ + { + strfcpy (fcc, buf, fcclen); + mutt_pretty_mailbox (fcc, fcclen); +- move (HDR_FCC, HDR_XOFFSET); ++ move (HDR_FCC, HDR_XOFFSET + SidebarWidth); + mutt_paddstr (W, fcc); + fccSet = 1; + } +--- a/curs_main.c ++++ b/curs_main.c +@@ -26,7 +26,9 @@ + #include "mailbox.h" + #include "mapping.h" + #include "sort.h" ++#include "buffy.h" + #include "mx.h" ++#include "sidebar.h" + + #ifdef USE_POP + #include "pop.h" +@@ -532,8 +534,12 @@ + menu->redraw |= REDRAW_STATUS; + if (do_buffy_notify) + { +- if (mutt_buffy_notify () && option (OPTBEEPNEW)) +- beep (); ++ if (mutt_buffy_notify ()) ++ { ++ menu->redraw |= REDRAW_FULL; ++ if (option (OPTBEEPNEW)) ++ beep (); ++ } + } + else + do_buffy_notify = 1; +@@ -545,6 +551,7 @@ + if (menu->redraw & REDRAW_FULL) + { + menu_redraw_full (menu); ++ draw_sidebar(menu->menu); + mutt_show_error (); + } + +@@ -567,10 +574,13 @@ + + if (menu->redraw & REDRAW_STATUS) + { ++ DrawFullLine = 1; + menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); ++ DrawFullLine = 0; + CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2); + SETCOLOR (MT_COLOR_STATUS); + BKGDSET (MT_COLOR_STATUS); ++ set_buffystats(Context); + mutt_paddstr (COLS, buf); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); +@@ -591,7 +601,7 @@ + menu->oldcurrent = -1; + + if (option (OPTARROWCURSOR)) +- move (menu->current - menu->top + menu->offset, 2); ++ move (menu->current - menu->top + menu->offset, SidebarWidth + 2); + else if (option (OPTBRAILLEFRIENDLY)) + move (menu->current - menu->top + menu->offset, 0); + else +@@ -1089,6 +1099,7 @@ + menu->redraw = REDRAW_FULL; + break; + ++ case OP_SIDEBAR_OPEN: + case OP_MAIN_CHANGE_FOLDER: + case OP_MAIN_NEXT_UNREAD_MAILBOX: + +@@ -1120,7 +1131,11 @@ + { + mutt_buffy (buf, sizeof (buf)); + +- if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) ++ if ( op == OP_SIDEBAR_OPEN ) { ++ if(!CurBuffy) ++ break; ++ strncpy( buf, CurBuffy->path, sizeof(buf) ); ++ } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) + { + if (menu->menu == MENU_PAGER) + { +@@ -1138,6 +1153,7 @@ + } + + mutt_expand_path (buf, sizeof (buf)); ++ set_curbuffy(buf); + if (mx_get_magic (buf) <= 0) + { + mutt_error (_("%s is not a mailbox."), buf); +@@ -2241,6 +2257,12 @@ + mutt_what_key(); + break; + ++ case OP_SIDEBAR_SCROLL_UP: ++ case OP_SIDEBAR_SCROLL_DOWN: ++ case OP_SIDEBAR_NEXT: ++ case OP_SIDEBAR_PREV: ++ scroll_sidebar(op, menu->menu); ++ break; + default: + if (menu->menu == MENU_MAIN) + km_error_key (MENU_MAIN); +--- a/flags.c ++++ b/flags.c +@@ -22,8 +22,10 @@ + + #include "mutt.h" + #include "mutt_curses.h" ++#include "mutt_menu.h" + #include "sort.h" + #include "mx.h" ++#include "sidebar.h" + + void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) + { +@@ -290,6 +292,7 @@ + */ + if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged)) + h->searched = 0; ++ draw_sidebar(0); + } + + void mutt_tag_set_flag (int flag, int bf) +--- a/functions.h ++++ b/functions.h +@@ -170,6 +170,11 @@ + { "decrypt-save", OP_DECRYPT_SAVE, NULL }, + + ++ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, ++ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, ++ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, ++ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, ++ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, + { NULL, 0, NULL } + }; + +@@ -274,6 +279,11 @@ + + { "what-key", OP_WHAT_KEY, NULL }, + ++ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, ++ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, ++ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, ++ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, ++ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, + { NULL, 0, NULL } + }; + +--- a/globals.h ++++ b/globals.h +@@ -117,6 +117,7 @@ + WHERE char *SendCharset; + WHERE char *Sendmail; + WHERE char *Shell; ++WHERE char *SidebarDelim; + WHERE char *Signature; + WHERE char *SimpleSearch; + #if USE_SMTP +@@ -210,6 +211,9 @@ + WHERE short ScoreThresholdRead; + WHERE short ScoreThresholdFlag; + ++WHERE struct buffy_t *CurBuffy INITVAL(0); ++WHERE short DrawFullLine INITVAL(0); ++WHERE short SidebarWidth; + #ifdef USE_IMAP + WHERE short ImapKeepalive; + WHERE short ImapPipelineDepth; +--- a/init.h ++++ b/init.h +@@ -1965,6 +1965,22 @@ + ** not used. + ** (PGP only) + */ ++ {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"}, ++ /* ++ ** .pp ++ ** This specifies the delimiter between the sidebar (if visible) and ++ ** other screens. ++ */ ++ { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 }, ++ /* ++ ** .pp ++ ** This specifies whether or not to show sidebar (left-side list of folders). ++ */ ++ { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 }, ++ /* ++ ** .pp ++ ** The width of the sidebar. ++ */ + { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, + /* + ** .pp +--- a/mailbox.h ++++ b/mailbox.h +@@ -27,6 +27,7 @@ + #define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses + * safe_fopen() for mbox-style folders. + */ ++#define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */ + + /* mx_open_new_message() */ + #define M_ADD_FROM 1 /* add a From_ line */ +--- a/Makefile.am ++++ b/Makefile.am +@@ -33,7 +33,8 @@ + score.c send.c sendlib.c signal.c sort.c \ + status.c system.c thread.c charset.c history.c lib.c \ + muttlib.c editmsg.c mbyte.c \ +- url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c ++ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \ ++ sidebar.c + + nodist_mutt_SOURCES = $(BUILT_SOURCES) + +--- a/mbox.c ++++ b/mbox.c +@@ -104,6 +104,7 @@ + mutt_perror (ctx->path); + return (-1); + } ++ ctx->atime = sb.st_atime; + ctx->mtime = sb.st_mtime; + ctx->size = sb.st_size; + +@@ -255,6 +256,7 @@ + + ctx->size = sb.st_size; + ctx->mtime = sb.st_mtime; ++ ctx->atime = sb.st_atime; + + #ifdef NFS_ATTRIBUTE_HACK + if (sb.st_mtime > sb.st_atime) +--- a/menu.c ++++ b/menu.c +@@ -24,6 +24,7 @@ + #include "mutt_curses.h" + #include "mutt_menu.h" + #include "mbyte.h" ++#include "sidebar.h" + + #include + #include +@@ -156,7 +157,7 @@ + { + char *scratch = safe_strdup (s); + int shift = option (OPTARROWCURSOR) ? 3 : 0; +- int cols = COLS - shift; ++ int cols = COLS - shift - SidebarWidth; + + mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1); + s[n - 1] = 0; +@@ -207,6 +208,7 @@ + char buf[LONG_STRING]; + int i; + ++ draw_sidebar(1); + for (i = menu->top; i < menu->top + menu->pagelen; i++) + { + if (i < menu->max) +@@ -217,7 +219,7 @@ + if (option (OPTARROWCURSOR)) + { + attrset (menu->color (i)); +- CLEARLINE (i - menu->top + menu->offset); ++ CLEARLINE_WIN (i - menu->top + menu->offset); + + if (i == menu->current) + { +@@ -246,14 +248,14 @@ + BKGDSET (MT_COLOR_INDICATOR); + } + +- CLEARLINE (i - menu->top + menu->offset); ++ CLEARLINE_WIN (i - menu->top + menu->offset); + print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } + } + else +- CLEARLINE (i - menu->top + menu->offset); ++ CLEARLINE_WIN (i - menu->top + menu->offset); + } + menu->redraw = 0; + } +@@ -268,7 +270,7 @@ + return; + } + +- move (menu->oldcurrent + menu->offset - menu->top, 0); ++ move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + +@@ -283,13 +285,13 @@ + clrtoeol (); + menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); + menu_pad_string (buf, sizeof (buf)); +- move (menu->oldcurrent + menu->offset - menu->top, 3); ++ move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3); + print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); + SETCOLOR (MT_COLOR_NORMAL); + } + + /* now draw it in the new location */ +- move (menu->current + menu->offset - menu->top, 0); ++ move (menu->current + menu->offset - menu->top, SidebarWidth); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); + addstr ("->"); +@@ -310,7 +312,7 @@ + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); +- CLEARLINE (menu->current - menu->top + menu->offset); ++ CLEARLINE_WIN (menu->current - menu->top + menu->offset); + print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); +@@ -322,7 +324,7 @@ + { + char buf[LONG_STRING]; + +- move (menu->current + menu->offset - menu->top, 0); ++ move (menu->current + menu->offset - menu->top, SidebarWidth); + menu_make_entry (buf, sizeof (buf), menu, menu->current); + menu_pad_string (buf, sizeof (buf)); + +@@ -884,7 +886,7 @@ + + + if (option (OPTARROWCURSOR)) +- move (menu->current - menu->top + menu->offset, 2); ++ move (menu->current - menu->top + menu->offset, SidebarWidth + 2); + else if (option (OPTBRAILLEFRIENDLY)) + move (menu->current - menu->top + menu->offset, 0); + else +--- a/mutt_curses.h ++++ b/mutt_curses.h +@@ -64,6 +64,7 @@ + #undef lines + #endif /* lines */ + ++#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol() + #define CLEARLINE(x) move(x,0), clrtoeol() + #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) + #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0) +@@ -126,6 +127,8 @@ + MT_COLOR_BOLD, + MT_COLOR_UNDERLINE, + MT_COLOR_INDEX, ++ MT_COLOR_NEW, ++ MT_COLOR_FLAGGED, + MT_COLOR_MAX + }; + +--- a/mutt.h ++++ b/mutt.h +@@ -431,6 +431,7 @@ + OPTSAVEEMPTY, + OPTSAVENAME, + OPTSCORE, ++ OPTSIDEBAR, + OPTSIGDASHES, + OPTSIGONTOP, + OPTSORTRE, +@@ -874,6 +875,7 @@ + { + char *path; + FILE *fp; ++ time_t atime; + time_t mtime; + off_t size; + off_t vsize; +@@ -914,6 +916,7 @@ + unsigned int quiet : 1; /* inhibit status messages? */ + unsigned int collapsed : 1; /* are all threads collapsed? */ + unsigned int closing : 1; /* mailbox is being closed */ ++ unsigned int peekonly : 1; /* just taking a glance, revert atime */ + + /* driver hooks */ + void *data; /* driver specific data */ +--- a/muttlib.c ++++ b/muttlib.c +@@ -1286,6 +1286,8 @@ + pl = pw = 1; + + /* see if there's room to add content, else ignore */ ++ if ( DrawFullLine ) ++ { + if ((col < COLS && wlen < destlen) || soft) + { + int pad; +@@ -1329,6 +1331,52 @@ + col += wid; + src += pl; + } ++ } ++ else ++ { ++ if ((col < COLS-SidebarWidth && wlen < destlen) || soft) ++ { ++ int pad; ++ ++ /* get contents after padding */ ++ mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags); ++ len = mutt_strlen (buf); ++ wid = mutt_strwidth (buf); ++ ++ /* try to consume as many columns as we can, if we don't have ++ * memory for that, use as much memory as possible */ ++ pad = (COLS - SidebarWidth - col - wid) / pw; ++ if (pad > 0 && wlen + (pad * pl) + len > destlen) ++ pad = ((signed)(destlen - wlen - len)) / pl; ++ if (pad > 0) ++ { ++ while (pad--) ++ { ++ memcpy (wptr, src, pl); ++ wptr += pl; ++ wlen += pl; ++ col += pw; ++ } ++ } ++ else if (soft && pad < 0) ++ { ++ /* \0-terminate dest for length computation in mutt_wstr_trunc() */ ++ *wptr = 0; ++ /* make sure right part is at most as wide as display */ ++ len = mutt_wstr_trunc (buf, destlen, COLS, &wid); ++ /* truncate left so that right part fits completely in */ ++ wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col); ++ wptr = dest + wlen; ++ } ++ if (len + wlen > destlen) ++ len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL); ++ memcpy (wptr, buf, len); ++ wptr += len; ++ wlen += len; ++ col += wid; ++ src += pl; ++ } ++ } + break; /* skip rest of input */ + } + else if (ch == '|') +--- a/mx.c ++++ b/mx.c +@@ -595,6 +595,7 @@ + * M_APPEND open mailbox for appending + * M_READONLY open mailbox in read-only mode + * M_QUIET only print error messages ++ * M_PEEK revert atime where applicable + * ctx if non-null, context struct to use + */ + CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx) +@@ -617,6 +618,8 @@ + ctx->quiet = 1; + if (flags & M_READONLY) + ctx->readonly = 1; ++ if (flags & M_PEEK) ++ ctx->peekonly = 1; + + if (flags & (M_APPEND|M_NEWFOLDER)) + { +@@ -721,9 +724,21 @@ + void mx_fastclose_mailbox (CONTEXT *ctx) + { + int i; ++#ifndef BUFFY_SIZE ++ struct utimbuf ut; ++#endif + + if(!ctx) + return; ++#ifndef BUFFY_SIZE ++ /* fix up the times so buffy won't get confused */ ++ if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime) ++ { ++ ut.actime = ctx->atime; ++ ut.modtime = ctx->mtime; ++ utime (ctx->path, &ut); ++ } ++#endif + + /* never announce that a mailbox we've just left has new mail. #3290 + * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */ +--- a/OPS ++++ b/OPS +@@ -180,3 +180,8 @@ + OP_MAIN_SHOW_LIMIT "show currently active limit pattern" + OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread" + OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads" ++OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page" ++OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page" ++OP_SIDEBAR_NEXT "go down to next mailbox" ++OP_SIDEBAR_PREV "go to previous mailbox" ++OP_SIDEBAR_OPEN "open hilighted mailbox" +--- a/pager.c ++++ b/pager.c +@@ -29,6 +29,7 @@ + #include "pager.h" + #include "attach.h" + #include "mbyte.h" ++#include "sidebar.h" + + #include "mutt_crypt.h" + +@@ -1099,6 +1100,7 @@ + if (check_attachment_marker ((char *)buf) == 0) + wrap_cols = COLS; + ++ wrap_cols -= SidebarWidth; + /* FIXME: this should come from lineInfo */ + memset(&mbstate, 0, sizeof(mbstate)); + +@@ -1745,7 +1747,7 @@ + if ((redraw & REDRAW_BODY) || topline != oldtopline) + { + do { +- move (bodyoffset, 0); ++ move (bodyoffset, SidebarWidth); + curline = oldtopline = topline; + lines = 0; + force_redraw = 0; +@@ -1758,6 +1760,7 @@ + &QuoteList, &q_level, &force_redraw, &SearchRE) > 0) + lines++; + curline++; ++ move(lines + bodyoffset, SidebarWidth); + } + last_offset = lineInfo[curline].offset; + } while (force_redraw); +@@ -1771,6 +1774,7 @@ + addch ('~'); + addch ('\n'); + lines++; ++ move(lines + bodyoffset, SidebarWidth); + } + /* We are going to update the pager status bar, so it isn't + * necessary to reset to normal color now. */ +@@ -1794,11 +1798,11 @@ + /* print out the pager status bar */ + SETCOLOR (MT_COLOR_STATUS); + BKGDSET (MT_COLOR_STATUS); +- CLEARLINE (statusoffset); ++ CLEARLINE_WIN (statusoffset); + + if (IsHeader (extra) || IsMsgAttach (extra)) + { +- size_t l1 = COLS * MB_LEN_MAX; ++ size_t l1 = (COLS-SidebarWidth) * MB_LEN_MAX; + size_t l2 = sizeof (buffer); + hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr; + mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT); +@@ -1808,7 +1812,7 @@ + { + char bn[STRING]; + snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str); +- mutt_paddstr (COLS, bn); ++ mutt_paddstr (COLS, IsHeader (extra) || IsMsgAttach (extra) ? buffer : banner); + } + BKGDSET (MT_COLOR_NORMAL); + SETCOLOR (MT_COLOR_NORMAL); +@@ -1826,18 +1830,23 @@ + /* redraw the pager_index indicator, because the + * flags for this message might have changed. */ + menu_redraw_current (index); ++ draw_sidebar(MENU_PAGER); + + /* print out the index status bar */ + menu_status_line (buffer, sizeof (buffer), index, NONULL(Status)); + +- move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0); ++ move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SidebarWidth); + SETCOLOR (MT_COLOR_STATUS); + BKGDSET (MT_COLOR_STATUS); +- mutt_paddstr (COLS, buffer); ++ mutt_paddstr (COLS-SidebarWidth, buffer); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } + ++ /* if we're not using the index, update every time */ ++ if ( index == 0 ) ++ draw_sidebar(MENU_PAGER); ++ + redraw = 0; + + if (option(OPTBRAILLEFRIENDLY)) { +@@ -2769,6 +2778,13 @@ + mutt_what_key (); + break; + ++ case OP_SIDEBAR_SCROLL_UP: ++ case OP_SIDEBAR_SCROLL_DOWN: ++ case OP_SIDEBAR_NEXT: ++ case OP_SIDEBAR_PREV: ++ scroll_sidebar(ch, MENU_PAGER); ++ break; ++ + default: + ch = -1; + break; +--- /dev/null ++++ b/sidebar.c +@@ -0,0 +1,333 @@ ++/* ++ * Copyright (C) ????-2004 Justin Hibbits ++ * Copyright (C) 2004 Thomer M. Gil ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. ++ */ ++ ++ ++#if HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include "mutt.h" ++#include "mutt_menu.h" ++#include "mutt_curses.h" ++#include "sidebar.h" ++#include "buffy.h" ++#include ++#include "keymap.h" ++#include ++ ++/*BUFFY *CurBuffy = 0;*/ ++static BUFFY *TopBuffy = 0; ++static BUFFY *BottomBuffy = 0; ++static int known_lines = 0; ++ ++static int quick_log10(int n) ++{ ++ char string[32]; ++ sprintf(string, "%d", n); ++ return strlen(string); ++} ++ ++void calc_boundaries (int menu) ++{ ++ BUFFY *tmp = Incoming; ++ ++ if ( known_lines != LINES ) { ++ TopBuffy = BottomBuffy = 0; ++ known_lines = LINES; ++ } ++ for ( ; tmp->next != 0; tmp = tmp->next ) ++ tmp->next->prev = tmp; ++ ++ if ( TopBuffy == 0 && BottomBuffy == 0 ) ++ TopBuffy = Incoming; ++ if ( BottomBuffy == 0 ) { ++ int count = LINES - 2 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); ++ BottomBuffy = TopBuffy; ++ while ( --count && BottomBuffy->next ) ++ BottomBuffy = BottomBuffy->next; ++ } ++ else if ( TopBuffy == CurBuffy->next ) { ++ int count = LINES - 2 - (menu != MENU_PAGER); ++ BottomBuffy = CurBuffy; ++ tmp = BottomBuffy; ++ while ( --count && tmp->prev) ++ tmp = tmp->prev; ++ TopBuffy = tmp; ++ } ++ else if ( BottomBuffy == CurBuffy->prev ) { ++ int count = LINES - 2 - (menu != MENU_PAGER); ++ TopBuffy = CurBuffy; ++ tmp = TopBuffy; ++ while ( --count && tmp->next ) ++ tmp = tmp->next; ++ BottomBuffy = tmp; ++ } ++} ++ ++char *make_sidebar_entry(char *box, int size, int new, int flagged) ++{ ++ static char *entry = 0; ++ char *c; ++ int i = 0; ++ int delim_len = strlen(SidebarDelim); ++ ++ c = realloc(entry, SidebarWidth - delim_len + 2); ++ if ( c ) entry = c; ++ entry[SidebarWidth - delim_len + 1] = 0; ++ for (; i < SidebarWidth - delim_len + 1; entry[i++] = ' ' ); ++ i = strlen(box); ++ strncpy( entry, box, i < (SidebarWidth - delim_len + 1) ? i : (SidebarWidth - delim_len + 1) ); ++ ++ if (size == -1) ++ sprintf(entry + SidebarWidth - delim_len - 3, "?"); ++ else if ( new ) { ++ if (flagged > 0) { ++ sprintf( ++ entry + SidebarWidth - delim_len - 5 - quick_log10(size) - quick_log10(new) - quick_log10(flagged), ++ "% d(%d)[%d]", size, new, flagged); ++ } else { ++ sprintf( ++ entry + SidebarWidth - delim_len - 3 - quick_log10(size) - quick_log10(new), ++ "% d(%d)", size, new); ++ } ++ } else if (flagged > 0) { ++ sprintf( entry + SidebarWidth - delim_len - 3 - quick_log10(size) - quick_log10(flagged), "% d[%d]", size, flagged); ++ } else { ++ sprintf( entry + SidebarWidth - delim_len - 1 - quick_log10(size), "% d", size); ++ } ++ return entry; ++} ++ ++void set_curbuffy(char buf[LONG_STRING]) ++{ ++ BUFFY* tmp = CurBuffy = Incoming; ++ ++ if (!Incoming) ++ return; ++ ++ while(1) { ++ if(!strcmp(tmp->path, buf)) { ++ CurBuffy = tmp; ++ break; ++ } ++ ++ if(tmp->next) ++ tmp = tmp->next; ++ else ++ break; ++ } ++} ++ ++int draw_sidebar(int menu) { ++ ++ int lines = option(OPTHELP) ? 1 : 0; ++ BUFFY *tmp; ++#ifndef USE_SLANG_CURSES ++ attr_t attrs; ++#endif ++ short delim_len = strlen(SidebarDelim); ++ short color_pair; ++ ++ static bool initialized = false; ++ static int prev_show_value; ++ static short saveSidebarWidth; ++ ++ /* initialize first time */ ++ if(!initialized) { ++ prev_show_value = option(OPTSIDEBAR); ++ saveSidebarWidth = SidebarWidth; ++ if(!option(OPTSIDEBAR)) SidebarWidth = 0; ++ initialized = true; ++ } ++ ++ /* save or restore the value SidebarWidth */ ++ if(prev_show_value != option(OPTSIDEBAR)) { ++ if(prev_show_value && !option(OPTSIDEBAR)) { ++ saveSidebarWidth = SidebarWidth; ++ SidebarWidth = 0; ++ } else if(!prev_show_value && option(OPTSIDEBAR)) { ++ SidebarWidth = saveSidebarWidth; ++ } ++ prev_show_value = option(OPTSIDEBAR); ++ } ++ ++ ++// if ( SidebarWidth == 0 ) return 0; ++ if (SidebarWidth > 0 && option (OPTSIDEBAR) ++ && delim_len >= SidebarWidth) { ++ unset_option (OPTSIDEBAR); ++ /* saveSidebarWidth = SidebarWidth; */ ++ if (saveSidebarWidth > delim_len) { ++ SidebarWidth = saveSidebarWidth; ++ mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar.")); ++ sleep (2); ++ } else { ++ SidebarWidth = 0; ++ mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value.")); ++ sleep (4); /* the advise to set a sane value should be seen long enough */ ++ } ++ saveSidebarWidth = 0; ++ return (0); ++ } ++ ++ if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) { ++ if (SidebarWidth > 0) { ++ saveSidebarWidth = SidebarWidth; ++ SidebarWidth = 0; ++ } ++ unset_option(OPTSIDEBAR); ++ return 0; ++ } ++ ++ /* get attributes for divider */ ++ SETCOLOR(MT_COLOR_STATUS); ++#ifndef USE_SLANG_CURSES ++ attr_get(&attrs, &color_pair, 0); ++#else ++ color_pair = attr_get(); ++#endif ++ SETCOLOR(MT_COLOR_NORMAL); ++ ++ /* draw the divider */ ++ ++ for ( ; lines < LINES-1-(menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) { ++ move(lines, SidebarWidth - delim_len); ++ addstr(NONULL(SidebarDelim)); ++#ifndef USE_SLANG_CURSES ++ mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL); ++#endif ++ } ++ ++ if ( Incoming == 0 ) return 0; ++ lines = option(OPTHELP) ? 1 : 0; /* go back to the top */ ++ ++ if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) ++ calc_boundaries(menu); ++ if ( CurBuffy == 0 ) CurBuffy = Incoming; ++ ++ tmp = TopBuffy; ++ ++ SETCOLOR(MT_COLOR_NORMAL); ++ ++ for ( ; tmp && lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); tmp = tmp->next ) { ++ if ( tmp == CurBuffy ) ++ SETCOLOR(MT_COLOR_INDICATOR); ++ else if ( tmp->msg_unread > 0 ) ++ SETCOLOR(MT_COLOR_NEW); ++ else if ( tmp->msg_flagged > 0 ) ++ SETCOLOR(MT_COLOR_FLAGGED); ++ else ++ SETCOLOR(MT_COLOR_NORMAL); ++ ++ move( lines, 0 ); ++ if ( Context && !strcmp( tmp->path, Context->path ) ) { ++ tmp->msg_unread = Context->unread; ++ tmp->msgcount = Context->msgcount; ++ tmp->msg_flagged = Context->flagged; ++ } ++ // check whether Maildir is a prefix of the current folder's path ++ short maildir_is_prefix = 0; ++ if ( (strlen(tmp->path) > strlen(Maildir)) && ++ (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) ) ++ maildir_is_prefix = 1; ++ // calculate depth of current folder and generate its display name with indented spaces ++ int sidebar_folder_depth = 0; ++ char *sidebar_folder_name; ++ sidebar_folder_name = basename(tmp->path); ++ if ( maildir_is_prefix ) { ++ char *tmp_folder_name; ++ int i; ++ tmp_folder_name = tmp->path + strlen(Maildir); ++ for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) { ++ if (tmp_folder_name[i] == '/') sidebar_folder_depth++; ++ } ++ if (sidebar_folder_depth > 0) { ++ sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1); ++ for (i=0; i < sidebar_folder_depth; i++) ++ sidebar_folder_name[i]=' '; ++ sidebar_folder_name[i]=0; ++ strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth); ++ } ++ } ++ printw( "%.*s", SidebarWidth - delim_len + 1, ++ make_sidebar_entry(sidebar_folder_name, tmp->msgcount, ++ tmp->msg_unread, tmp->msg_flagged)); ++ if (sidebar_folder_depth > 0) ++ free(sidebar_folder_name); ++ lines++; ++ } ++ SETCOLOR(MT_COLOR_NORMAL); ++ for ( ; lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) { ++ int i = 0; ++ move( lines, 0 ); ++ for ( ; i < SidebarWidth - delim_len; i++ ) ++ addch(' '); ++ } ++ return 0; ++} ++ ++ ++void set_buffystats(CONTEXT* Context) ++{ ++ BUFFY *tmp = Incoming; ++ while(tmp) { ++ if(Context && !strcmp(tmp->path, Context->path)) { ++ tmp->msg_unread = Context->unread; ++ tmp->msgcount = Context->msgcount; ++ break; ++ } ++ tmp = tmp->next; ++ } ++} ++ ++void scroll_sidebar(int op, int menu) ++{ ++ if(!SidebarWidth) return; ++ if(!CurBuffy) return; ++ ++ switch (op) { ++ case OP_SIDEBAR_NEXT: ++ if ( CurBuffy->next == NULL ) return; ++ CurBuffy = CurBuffy->next; ++ break; ++ case OP_SIDEBAR_PREV: ++ if ( CurBuffy->prev == NULL ) return; ++ CurBuffy = CurBuffy->prev; ++ break; ++ case OP_SIDEBAR_SCROLL_UP: ++ CurBuffy = TopBuffy; ++ if ( CurBuffy != Incoming ) { ++ calc_boundaries(menu); ++ CurBuffy = CurBuffy->prev; ++ } ++ break; ++ case OP_SIDEBAR_SCROLL_DOWN: ++ CurBuffy = BottomBuffy; ++ if ( CurBuffy->next ) { ++ calc_boundaries(menu); ++ CurBuffy = CurBuffy->next; ++ } ++ break; ++ default: ++ return; ++ } ++ calc_boundaries(menu); ++ draw_sidebar(menu); ++} ++ +--- /dev/null ++++ b/sidebar.h +@@ -0,0 +1,36 @@ ++/* ++ * Copyright (C) ????-2004 Justin Hibbits ++ * Copyright (C) 2004 Thomer M. Gil ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. ++ */ ++ ++#ifndef SIDEBAR_H ++#define SIDEBAR_H ++ ++struct MBOX_LIST { ++ char *path; ++ int msgcount; ++ int new; ++} MBLIST; ++ ++/* parameter is whether or not to go to the status line */ ++/* used for omitting the last | that covers up the status bar in the index */ ++int draw_sidebar(int); ++void scroll_sidebar(int, int); ++void set_curbuffy(char*); ++void set_buffystats(CONTEXT*); ++ ++#endif /* SIDEBAR_H */ +--- a/doc/Muttrc ++++ b/doc/Muttrc +@@ -657,6 +657,26 @@ + # $crypt_autosign, $crypt_replysign and $smime_is_default. + # + # ++# set sidebar_visible=no ++# ++# Name: sidebar_visible ++# Type: boolean ++# Default: no ++# ++# ++# This specifies whether or not to show sidebar (left-side list of folders). ++# ++# ++# set sidebar_width=0 ++# ++# Name: sidebar_width ++# Type: number ++# Default: 0 ++# ++# ++# The width of the sidebar. ++# ++# + # set crypt_autosign=no + # + # Name: crypt_autosign +--- a/imap/imap.c ++++ b/imap/imap.c +@@ -1521,7 +1521,7 @@ + + imap_munge_mbox_name (munged, sizeof (munged), name); + snprintf (command, sizeof (command), +- "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged); ++ "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged); + + if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0) + { +--- a/imap/command.c ++++ b/imap/command.c +@@ -1011,6 +1011,13 @@ + opened */ + status->uidnext = oldun; + ++ /* Added to make the sidebar show the correct numbers */ ++ if (status->messages) ++ { ++ inc->msgcount = status->messages; ++ inc->msg_unread = status->unseen; ++ } ++ + FREE (&value); + return; + } --- mutt-1.5.21.orig/debian/patches/mutt-patched/sidebar-newonly +++ mutt-1.5.21/debian/patches/mutt-patched/sidebar-newonly @@ -0,0 +1,161 @@ +patches written by Steve Kemp, it adds two new functionalities to the sidebar, +so only the mailbox with new messages will be shown (and/or) selected +See Debian bug http://bugs.debian.org/532510 + +--- a/OPS ++++ b/OPS +@@ -184,3 +184,5 @@ + OP_SIDEBAR_NEXT "go down to next mailbox" + OP_SIDEBAR_PREV "go to previous mailbox" + OP_SIDEBAR_OPEN "open hilighted mailbox" ++OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail" ++OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail" +--- a/curs_main.c ++++ b/curs_main.c +@@ -2236,6 +2236,8 @@ + case OP_SIDEBAR_SCROLL_DOWN: + case OP_SIDEBAR_NEXT: + case OP_SIDEBAR_PREV: ++ case OP_SIDEBAR_NEXT_NEW: ++ case OP_SIDEBAR_PREV_NEW: + scroll_sidebar(op, menu->menu); + break; + default: +--- a/functions.h ++++ b/functions.h +@@ -173,6 +173,10 @@ + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, + { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, + { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, ++ { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, ++ { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, ++ { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, ++ { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, + { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, + { NULL, 0, NULL } + }; +--- a/init.h ++++ b/init.h +@@ -1956,6 +1956,11 @@ + {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"}, + /* + ** .pp ++ ** Show only new mail in the sidebar. ++ */ ++ {"sidebar_newmail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, "no" }, ++ /* ++ ** .pp + ** This specifies the delimiter between the sidebar (if visible) and + ** other screens. + */ +--- a/mutt.h ++++ b/mutt.h +@@ -518,6 +518,8 @@ + OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */ + OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */ + ++ OPTSIDEBARNEWMAILONLY, ++ + OPTMAX + }; + +--- a/pager.c ++++ b/pager.c +@@ -2756,6 +2756,8 @@ + case OP_SIDEBAR_SCROLL_DOWN: + case OP_SIDEBAR_NEXT: + case OP_SIDEBAR_PREV: ++ case OP_SIDEBAR_NEXT_NEW: ++ case OP_SIDEBAR_PREV_NEW: + scroll_sidebar(ch, MENU_PAGER); + break; + +--- a/sidebar.c ++++ b/sidebar.c +@@ -261,8 +261,20 @@ + SETCOLOR(MT_COLOR_NEW); + else if ( tmp->msg_flagged > 0 ) + SETCOLOR(MT_COLOR_FLAGGED); +- else +- SETCOLOR(MT_COLOR_NORMAL); ++ else { ++ /* make sure the path is either: ++ 1. Containing new mail. ++ 2. The inbox. ++ 3. The current box. ++ */ ++ if ((option (OPTSIDEBARNEWMAILONLY)) && ++ ( (tmp->msg_unread <= 0) && ++ ( tmp != Incoming ) && ++ ( strcmp( tmp->path, Context->path ) != 0 ) ) ) ++ continue; ++ else ++ SETCOLOR(MT_COLOR_NORMAL); ++ } + + move( lines, 0 ); + if ( Context && !strcmp( tmp->path, Context->path ) ) { +@@ -320,6 +332,29 @@ + return 0; + } + ++BUFFY * exist_next_new() ++{ ++ BUFFY *tmp = CurBuffy; ++ if(tmp == NULL) return NULL; ++ while (tmp->next != NULL) ++ { ++ tmp = tmp->next; ++ if(tmp->msg_unread) return tmp; ++ } ++ return NULL; ++} ++ ++BUFFY * exist_prev_new() ++{ ++ BUFFY *tmp = CurBuffy; ++ if(tmp == NULL) return NULL; ++ while (tmp->prev != NULL) ++ { ++ tmp = tmp->prev; ++ if(tmp->msg_unread) return tmp; ++ } ++ return NULL; ++} + + void set_buffystats(CONTEXT* Context) + { +@@ -336,18 +371,33 @@ + + void scroll_sidebar(int op, int menu) + { ++ BUFFY *tmp; + if(!SidebarWidth) return; + if(!CurBuffy) return; + + switch (op) { + case OP_SIDEBAR_NEXT: ++ if (!option (OPTSIDEBARNEWMAILONLY)) { + if ( CurBuffy->next == NULL ) return; + CurBuffy = CurBuffy->next; + break; ++ } ++ case OP_SIDEBAR_NEXT_NEW: ++ if ( (tmp = exist_next_new()) == NULL) ++ return; ++ else CurBuffy = tmp; ++ break; + case OP_SIDEBAR_PREV: ++ if (!option (OPTSIDEBARNEWMAILONLY)) { + if ( CurBuffy->prev == NULL ) return; + CurBuffy = CurBuffy->prev; + break; ++ } ++ case OP_SIDEBAR_PREV_NEW: ++ if ( (tmp = exist_prev_new()) == NULL) ++ return; ++ else CurBuffy = tmp; ++ break; + case OP_SIDEBAR_SCROLL_UP: + CurBuffy = TopBuffy; + if ( CurBuffy != Incoming ) { --- mutt-1.5.21.orig/debian/patches/mutt-patched/nntp +++ mutt-1.5.21/debian/patches/mutt-patched/nntp @@ -0,0 +1,7607 @@ +WARNING: Run the following script before configure: + +aclocal -I m4 +autoheader +automake --foreign +autoconf + +-- +Vsevolod Volkov + + +diff -udprP mutt-1.5.20.orig/ChangeLog.nntp mutt-1.5.20/ChangeLog.nntp +--- mutt-1.5.20.orig/ChangeLog.nntp 1970-01-01 03:00:00.000000000 +0300 ++++ mutt-1.5.20/ChangeLog.nntp 2009-06-15 21:56:06.000000000 +0300 +@@ -0,0 +1,369 @@ ++* Tue Jun 15 2009 Vsevolod Volkov ++- update to 1.5.20 ++ ++* Tue Mar 20 2009 Vsevolod Volkov ++- save Date: header of recorded outgoing articles ++ ++* Tue Jan 6 2009 Vsevolod Volkov ++- update to 1.5.19 ++ ++* Mon May 19 2008 Vsevolod Volkov ++- update to 1.5.18 ++- fixed SIGSEGV when followup or forward to newsgroup ++ ++* Sun Nov 4 2007 Vsevolod Volkov ++- update to 1.5.17 ++ ++* Tue Jul 3 2007 Vsevolod Volkov ++- fixed arguments of nntp_format_str() ++ ++* Fri Jun 15 2007 Vsevolod Volkov ++- fixed error selecting news group ++ ++* Tue Jun 12 2007 Vsevolod Volkov ++- update to 1.5.16 ++ ++* Wed Apr 11 2007 Vsevolod Volkov ++- fixed posting error if $smtp_url is set ++- added support of print-style sequence %R (x-comment-to) ++ ++* Sun Apr 8 2007 Vsevolod Volkov ++- update to 1.5.15 ++- nntp://... url changed to news://... ++- added indicator of fetching descriptions progress ++ ++* Tue Feb 28 2007 Vsevolod Volkov ++- update to 1.5.14 ++ ++* Tue Aug 15 2006 Vsevolod Volkov ++- update to 1.5.13 ++ ++* Mon Jul 17 2006 Vsevolod Volkov ++- update to 1.5.12 ++- fixed reading empty .newsrc ++ ++* Sat Sep 17 2005 Vsevolod Volkov ++- update to 1.5.11 ++ ++* Sat Aug 13 2005 Vsevolod Volkov ++- update to 1.5.10 ++ ++* Sun Mar 13 2005 Vsevolod Volkov ++- update to 1.5.9 ++ ++* Sun Feb 13 2005 Vsevolod Volkov ++- update to 1.5.8 ++ ++* Sat Feb 5 2005 Vsevolod Volkov ++- update to 1.5.7 ++- function mutt_update_list_file() moved to newsrc.c and changed algorithm ++ ++* Thu Jul 8 2004 Vsevolod Volkov ++- fixed error in nntp_logout_all() ++ ++* Sat Apr 3 2004 Vsevolod Volkov ++- fixed debug output in mutt_newsrc_update() ++- added optional support of LISTGROUP command ++- fixed typo in nntp_parse_xref() ++ ++* Tue Feb 3 2004 Vsevolod Volkov ++- update to 1.5.6 ++ ++* Thu Dec 18 2003 Vsevolod Volkov ++- fixed compose menu ++ ++* Thu Nov 6 2003 Vsevolod Volkov ++- update to 1.5.5.1 ++ ++* Wed Nov 5 2003 Vsevolod Volkov ++- update to 1.5.5 ++- added space after newsgroup name in .newsrc file ++ ++* Sun May 18 2003 Vsevolod Volkov ++- nntp patch: fixed SIGSEGV when posting article ++ ++* Sat Mar 22 2003 Vsevolod Volkov ++- update to 1.5.4 ++ ++* Sat Dec 21 2002 Vsevolod Volkov ++- update to 1.5.3 ++- replace safe_free calls by the FREE macro ++ ++* Fri Dec 6 2002 Vsevolod Volkov ++- update to 1.5.2 ++- nntp authentication can be passed after any command ++ ++* Sat May 4 2002 Vsevolod Volkov ++- update to 1.5.1 ++ ++* Thu May 2 2002 Vsevolod Volkov ++- update to 1.3.99 ++ ++* Wed Mar 13 2002 Vsevolod Volkov ++- update to 1.3.28 ++- fixed SIGSEGV in , , , ++ functions ++- fixed message about nntp reconnect ++- fixed function using browser ++- added support of Followup-To: poster ++- added %n (new articles) in group_index_format ++- posting articles without inews by default ++ ++* Wed Jan 23 2002 Vsevolod Volkov ++- update to 1.3.27 ++ ++* Fri Jan 18 2002 Vsevolod Volkov ++- update to 1.3.26 ++ ++* Thu Jan 3 2002 Vsevolod Volkov ++- update to 1.3.25 ++- accelerated speed of access to news->newsgroups hash (by ) ++- added default content disposition ++ ++* Mon Dec 3 2001 Vsevolod Volkov ++- update to 1.3.24 ++ ++* Fri Nov 9 2001 Vsevolod Volkov ++- update to 1.3.23.2 ++- fixed segfault if mutt_conn_find() returns null ++ ++* Wed Oct 31 2001 Vsevolod Volkov ++- update to 1.3.23.1 ++- added support of LISTGROUP command ++- added support for servers with broken overview ++- disabled function on news server ++- fixed error storing bad authentication information ++ ++* Wed Oct 10 2001 Vsevolod Volkov ++- update to 1.3.23 ++- fixed typo in buffy.c ++- added substitution of %s parameter in $inews variable ++ ++* Fri Aug 31 2001 Vsevolod Volkov ++- update to 1.3.22.1 ++- update to 1.3.22 ++ ++* Thu Aug 23 2001 Vsevolod Volkov ++- update to 1.3.21 ++ ++* Wed Jul 25 2001 Vsevolod Volkov ++- update to 1.3.20 ++- removed 'server-hook', use 'account-hook' instead ++- fixed error opening NNTP server without newsgroup using -f option ++ ++* Fri Jun 8 2001 Vsevolod Volkov ++- update to 1.3.19 ++ ++* Sat May 5 2001 Vsevolod Volkov ++- update to 1.3.18 ++- fixed typo in nntp_attempt_features() ++- changed algorithm of XGTITLE command testing ++- disabled writing of NNTP password in debug file ++- fixed reading and writing of long newsrc lines ++- changed checking of last line while reading lines from server ++- fixed possible buffer overrun in nntp_parse_newsrc_line() ++- removed checking of XHDR command ++- compare NNTP return codes without trailing space ++ ++* Thu Mar 29 2001 Vsevolod Volkov ++- update to 1.3.17 ++- support for 'LIST NEWSGROUPS' command to read descriptions ++ ++* Fri Mar 2 2001 Vsevolod Volkov ++- update to 1.3.16 ++ ++* Wed Feb 14 2001 Vsevolod Volkov ++- update to 1.3.15 ++ ++* Sun Jan 28 2001 Vsevolod Volkov ++- update to 1.3.14 ++- show number of tagged messages patch from Felix von Leitner ++ ++* Sun Dec 31 2000 Vsevolod Volkov ++- update to 1.3.13 ++ ++* Sat Dec 30 2000 Vsevolod Volkov ++- Fixed problem if last article in group is deleted ++ ++* Fri Dec 22 2000 Vsevolod Volkov ++- Fixed checking of XGTITLE command on some servers ++ ++* Mon Dec 18 2000 Vsevolod Volkov ++- Added \r in AUTHINFO commands ++ ++* Mon Nov 27 2000 Vsevolod Volkov ++- update to 1.3.12 ++ ++* Wed Nov 1 2000 Vsevolod Volkov ++- update to 1.3.11 ++- fixed error opening newsgroup from mutt started with -g or -G ++ ++* Thu Oct 12 2000 Vsevolod Volkov ++- update to 1.3.10 ++- hotkey 'G' (get-message) replaced with '^G' ++ ++* Thu Sep 21 2000 Vsevolod Volkov ++- update to 1.3.9 ++- changed delay displaying error messages from 1 to 2 seconds ++- fixed error compiling with nntp and without imap ++ ++* Wed Sep 6 2000 Vsevolod Volkov ++- fixed catchup in index ++- fixed nntp_open_mailbox() ++ ++* Sat Sep 2 2000 Vsevolod Volkov ++- functions and disabled ++- format of news mailbox names changed to url form ++- option nntp_attempts removed ++- option reconnect_news renamed to nntp_reconnect ++- default value of nntp_poll changed from 30 to 60 ++- error handling improved ++ ++* Wed Aug 30 2000 Vsevolod Volkov ++- update to 1.3.8 ++- new option show_only_unread ++- add newsgroup completion ++ ++* Fri Aug 4 2000 Vsevolod Volkov ++- update to 1.3.7 ++ ++* Sat Jul 29 2000 Vsevolod Volkov ++- update to 1.3.6 ++ ++* Sun Jul 9 2000 Vsevolod Volkov ++- update to 1.3.5 ++- authentication code update ++- fix for changing to newsgroup from mailbox with read messages ++- socket code optimization ++ ++* Wed Jun 21 2000 Vsevolod Volkov ++- update to 1.3.4 ++ ++* Wed Jun 14 2000 Vsevolod Volkov ++- don't substitute current newsgroup with deleted new messages ++ ++* Mon Jun 12 2000 Vsevolod Volkov ++- update to 1.3.3 ++- fix for substitution of newsgroup after reconnection ++- fix for loading newsgroups with very long names ++- fix for loading more than 32768 newsgroups ++ ++* Wed May 24 2000 Vsevolod Volkov ++- update to 1.3.2 ++ ++* Sat May 20 2000 Vsevolod Volkov ++- update to 1.3.1 ++ ++* Fri May 12 2000 Vsevolod Volkov ++- update to 1.3 ++ ++* Thu May 11 2000 Vsevolod Volkov ++- update to 1.2 ++ ++* Thu May 4 2000 Vsevolod Volkov ++- update to 1.1.14 ++ ++* Sun Apr 23 2000 Vsevolod Volkov ++- update to 1.1.12 ++ ++* Fri Apr 7 2000 Vsevolod Volkov ++- add substitution of newsgroup with new messages by default ++ ++* Wed Apr 5 2000 Vsevolod Volkov ++- add attach message from newsgroup ++- add one-line help in newsreader mode ++- disable 'change-dir' command in newsgroups browser ++- add -G option ++ ++* Tue Apr 4 2000 Vsevolod Volkov ++- get default newsserver name from file /etc/nntpserver ++- use case insensitive server names ++- add print-style sequence %s to $newsrc ++- add -g option ++ ++* Sat Apr 1 2000 Vsevolod Volkov ++- remove 'X-FTN-Origin' header processing ++ ++* Thu Mar 30 2000 Vsevolod Volkov ++- update to 1.1.11 ++- update to 1.1.10 ++ ++* Thu Mar 23 2000 Vsevolod Volkov ++- fix mutt_select_newsserver() ++- remove 'toggle-mode' function ++- add 'change-newsgroup' function ++ ++* Wed Mar 22 2000 Vsevolod Volkov ++- fix server-hook ++ ++* Tue Mar 21 2000 Vsevolod Volkov ++- fix error 'bounce' function after 'post' ++- add 'forward to newsgroup' function ++ ++* Mon Mar 20 2000 Vsevolod Volkov ++- 'forward' function works in newsreader mode ++- add 'post' and 'followup' functions to pager and attachment menu ++- fix active descriptions and allowed flag reload ++ ++* Tue Mar 14 2000 Vsevolod Volkov ++- update to 1.1.9 ++- remove deleted newsgroups from list ++ ++* Mon Mar 13 2000 Vsevolod Volkov ++- update .newsrc in browser ++ ++* Sun Mar 12 2000 Vsevolod Volkov ++- reload .newsrc if externally modified ++- fix active cache update ++ ++* Sun Mar 5 2000 Vsevolod Volkov ++- update to 1.1.8 ++ ++* Sat Mar 4 2000 Vsevolod Volkov ++- patch *.update_list_file is not required ++- count lines when loading descriptions ++- remove cache of unsubscribed newsgroups ++ ++* Thu Mar 2 2000 Vsevolod Volkov ++- load list of newsgroups from cache faster ++ ++* Wed Mar 1 2000 Vsevolod Volkov ++- update to 1.1.7 ++ ++* Tue Feb 29 2000 Vsevolod Volkov ++- fix unread messages in browser ++- fix newsrc_gen_entries() ++ ++* Mon Feb 28 2000 Vsevolod Volkov ++- fix mutt_newsgroup_stat() ++- fix nntp_delete_cache() ++- fix nntp_get_status() ++- fix check_children() ++- fix nntp_fetch_headers() ++ ++* Fri Feb 25 2000 Vsevolod Volkov ++- update to 1.1.5 ++ ++* Thu Feb 24 2000 Vsevolod Volkov ++- fix updating new messages in cache ++ ++* Mon Feb 21 2000 Vsevolod Volkov ++- change default cache filenames ++- fix updating new messages in cache ++ ++* Fri Feb 18 2000 Vsevolod Volkov ++- fix segmentation fault in news groups browser ++ ++* Tue Feb 15 2000 Vsevolod Volkov ++- update to 1.1.4 ++ ++* Thu Feb 10 2000 Vsevolod Volkov ++- update to 1.1.3 ++ ++* Sun Jan 30 2000 Vsevolod Volkov ++- add X-Comment-To editing ++- add my_hdr support for Newsgroups:, Followup-To: and X-Comment-To: headers ++- add variables $ask_followup_to and $ask_x_comment_to ++ ++* Fri Jan 28 2000 Vsevolod Volkov ++- update to 1.1.2 +diff -udprP mutt-1.5.20.orig/OPS mutt-1.5.20/OPS +--- mutt-1.5.20.orig/OPS 2009-05-13 08:01:13.000000000 +0300 ++++ mutt-1.5.20/OPS 2009-06-15 21:05:24.000000000 +0300 +@@ -8,14 +8,16 @@ OP_BOUNCE_MESSAGE "remail a message to a + OP_BROWSER_NEW_FILE "select a new file in this directory" + OP_BROWSER_VIEW_FILE "view file" + OP_BROWSER_TELL "display the currently selected file's name" +-OP_BROWSER_SUBSCRIBE "subscribe to current mailbox (IMAP only)" +-OP_BROWSER_UNSUBSCRIBE "unsubscribe from current mailbox (IMAP only)" ++OP_BROWSER_SUBSCRIBE "subscribe to current mbox (IMAP/NNTP only)" ++OP_BROWSER_UNSUBSCRIBE "unsubscribe from current mbox (IMAP/NNTP only)" + OP_BROWSER_TOGGLE_LSUB "toggle view all/subscribed mailboxes (IMAP only)" + OP_BUFFY_LIST "list mailboxes with new mail" ++OP_CATCHUP "mark all articles in newsgroup as read" + OP_CHANGE_DIRECTORY "change directories" + OP_CHECK_NEW "check mailboxes for new mail" + OP_COMPOSE_ATTACH_FILE "attach file(s) to this message" + OP_COMPOSE_ATTACH_MESSAGE "attach message(s) to this message" ++OP_COMPOSE_ATTACH_NEWS_MESSAGE "attach newsmessage(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" +@@ -26,7 +28,10 @@ OP_COMPOSE_EDIT_FROM "edit the from fiel + OP_COMPOSE_EDIT_HEADERS "edit the message with headers" + OP_COMPOSE_EDIT_MESSAGE "edit the message" + OP_COMPOSE_EDIT_MIME "edit attachment using mailcap entry" ++OP_COMPOSE_EDIT_NEWSGROUPS "edit the newsgroups list" + OP_COMPOSE_EDIT_REPLY_TO "edit the Reply-To field" ++OP_COMPOSE_EDIT_FOLLOWUP_TO "edit the Followup-To field" ++OP_COMPOSE_EDIT_X_COMMENT_TO "edit the X-Comment-To field" + OP_COMPOSE_EDIT_SUBJECT "edit the subject of this message" + OP_COMPOSE_EDIT_TO "edit the TO list" + OP_CREATE_MAILBOX "create a new mailbox (IMAP only)" +@@ -85,8 +90,13 @@ OP_EXIT "exit this menu" + OP_FILTER "filter attachment through a shell command" + OP_FIRST_ENTRY "move to the first entry" + OP_FLAG_MESSAGE "toggle a message's 'important' flag" ++OP_FOLLOWUP "followup to newsgroup" ++OP_FORWARD_TO_GROUP "forward to newsgroup" + OP_FORWARD_MESSAGE "forward a message with comments" + OP_GENERIC_SELECT_ENTRY "select the current entry" ++OP_GET_CHILDREN "get all children of the current message" ++OP_GET_MESSAGE "get message with Message-Id" ++OP_GET_PARENT "get parent of the current message" + OP_GROUP_REPLY "reply to all recipients" + OP_HALF_DOWN "scroll down 1/2 page" + OP_HALF_UP "scroll up 1/2 page" +@@ -94,11 +104,14 @@ OP_HELP "this screen" + OP_JUMP "jump to an index number" + OP_LAST_ENTRY "move to the last entry" + OP_LIST_REPLY "reply to specified mailing list" ++OP_LOAD_ACTIVE "load active file from NNTP server" + OP_MACRO "execute a macro" + OP_MAIL "compose a new mail message" + OP_MAIN_BREAK_THREAD "break the thread in two" + OP_MAIN_CHANGE_FOLDER "open a different folder" + OP_MAIN_CHANGE_FOLDER_READONLY "open a different folder in read only mode" ++OP_MAIN_CHANGE_GROUP "open a different newsgroup" ++OP_MAIN_CHANGE_GROUP_READONLY "open a different newsgroup in read only mode" + OP_MAIN_CLEAR_FLAG "clear a status flag from a message" + OP_MAIN_DELETE_PATTERN "delete messages matching a pattern" + OP_MAIN_IMAP_FETCH "force retrieval of mail from IMAP server" +@@ -137,6 +150,7 @@ OP_PAGER_HIDE_QUOTED "toggle display of + OP_PAGER_SKIP_QUOTED "skip beyond quoted text" + OP_PAGER_TOP "jump to the top of the message" + OP_PIPE "pipe message/attachment to a shell command" ++OP_POST "post message to newsgroup" + OP_PREV_ENTRY "move to the previous entry" + OP_PREV_LINE "scroll up one line" + OP_PREV_PAGE "move to the previous page" +@@ -145,6 +159,7 @@ OP_QUERY "query external program for add + OP_QUERY_APPEND "append new query results to current results" + OP_QUIT "save changes to mailbox and quit" + OP_RECALL_MESSAGE "recall a postponed message" ++OP_RECONSTRUCT_THREAD "reconstruct thread containing current message" + OP_REDRAW "clear and redraw the screen" + OP_REFORMAT_WINCH "{internal}" + OP_RENAME_MAILBOX "rename the current mailbox (IMAP only)" +@@ -159,18 +174,22 @@ OP_SEARCH_TOGGLE "toggle search pattern + OP_SHELL_ESCAPE "invoke a command in a subshell" + OP_SORT "sort messages" + OP_SORT_REVERSE "sort messages in reverse order" ++OP_SUBSCRIBE_PATTERN "subscribe to newsgroups matching a pattern" + OP_TAG "tag the current entry" + OP_TAG_PREFIX "apply next function to tagged messages" + OP_TAG_PREFIX_COND "apply next function ONLY to tagged messages" + OP_TAG_SUBTHREAD "tag the current subthread" + OP_TAG_THREAD "tag the current thread" + OP_TOGGLE_NEW "toggle a message's 'new' flag" ++OP_TOGGLE_READ "toggle view of read messages" + OP_TOGGLE_WRITE "toggle whether the mailbox will be rewritten" + OP_TOGGLE_MAILBOXES "toggle whether to browse mailboxes or all files" + OP_TOP_PAGE "move to the top of the page" ++OP_UNCATCHUP "mark all articles in newsgroup as unread" + OP_UNDELETE "undelete the current entry" + OP_UNDELETE_THREAD "undelete all messages in thread" + OP_UNDELETE_SUBTHREAD "undelete all messages in subthread" ++OP_UNSUBSCRIBE_PATTERN "unsubscribe from newsgroups matching a pattern" + OP_VERSION "show the Mutt version number and date" + OP_VIEW_ATTACH "view attachment using mailcap entry if necessary" + OP_VIEW_ATTACHMENTS "show MIME attachments" +diff -udprP mutt-1.5.20.orig/account.c mutt-1.5.20/account.c +--- mutt-1.5.20.orig/account.c 2008-11-11 21:55:46.000000000 +0200 ++++ mutt-1.5.20/account.c 2009-06-15 21:05:24.000000000 +0300 +@@ -51,6 +51,11 @@ int mutt_account_match (const ACCOUNT* a + user = PopUser; + #endif + ++#ifdef USE_NNTP ++ if (a1->type == M_ACCT_TYPE_NNTP && NntpUser) ++ user = NntpUser; ++#endif ++ + if (a1->flags & a2->flags & M_ACCT_USER) + return (!strcmp (a1->user, a2->user)); + if (a1->flags & M_ACCT_USER) +@@ -130,6 +135,16 @@ void mutt_account_tourl (ACCOUNT* accoun + } + #endif + ++#ifdef USE_NNTP ++ if (account->type == M_ACCT_TYPE_NNTP) ++ { ++ if (account->flags & M_ACCT_SSL) ++ url->scheme = U_NNTPS; ++ else ++ url->scheme = U_NNTP; ++ } ++#endif ++ + url->host = account->host; + if (account->flags & M_ACCT_PORT) + url->port = account->port; +@@ -155,6 +170,10 @@ int mutt_account_getuser (ACCOUNT* accou + else if ((account->type == M_ACCT_TYPE_POP) && PopUser) + strfcpy (account->user, PopUser, sizeof (account->user)); + #endif ++#ifdef USE_NNTP ++ else if ((account->type == M_ACCT_TYPE_NNTP) && NntpUser) ++ strfcpy (account->user, NntpUser, sizeof (account->user)); ++#endif + /* prompt (defaults to unix username), copy into account->user */ + else + { +@@ -215,6 +234,10 @@ int mutt_account_getpass (ACCOUNT* accou + else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass) + strfcpy (account->pass, SmtpPass, sizeof (account->pass)); + #endif ++#ifdef USE_NNTP ++ else if ((account->type == M_ACCT_TYPE_NNTP) && NntpPass) ++ strfcpy (account->pass, NntpPass, sizeof (account->pass)); ++#endif + else + { + snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "), +diff -udprP mutt-1.5.20.orig/account.h mutt-1.5.20/account.h +--- mutt-1.5.20.orig/account.h 2008-11-11 21:55:46.000000000 +0200 ++++ mutt-1.5.20/account.h 2009-06-15 21:05:24.000000000 +0300 +@@ -29,7 +29,8 @@ enum + M_ACCT_TYPE_NONE = 0, + M_ACCT_TYPE_IMAP, + M_ACCT_TYPE_POP, +- M_ACCT_TYPE_SMTP ++ M_ACCT_TYPE_SMTP, ++ M_ACCT_TYPE_NNTP + }; + + /* account flags */ +diff -udprP mutt-1.5.20.orig/attach.h mutt-1.5.20/attach.h +--- mutt-1.5.20.orig/attach.h 2008-11-11 21:55:46.000000000 +0200 ++++ mutt-1.5.20/attach.h 2009-06-15 21:05:24.000000000 +0300 +@@ -50,7 +50,7 @@ void mutt_print_attachment_list (FILE *f + + void mutt_attach_bounce (FILE *, HEADER *, ATTACHPTR **, short, BODY *); + void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *); +-void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *); ++void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int); + void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int); + + #endif /* _ATTACH_H_ */ +diff -udprP mutt-1.5.20.orig/browser.c mutt-1.5.20/browser.c +--- mutt-1.5.20.orig/browser.c 2009-06-11 20:52:54.000000000 +0300 ++++ mutt-1.5.20/browser.c 2009-06-15 21:05:24.000000000 +0300 +@@ -32,6 +32,9 @@ + #ifdef USE_IMAP + #include "imap.h" + #endif ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif + + #include + #include +@@ -49,6 +52,19 @@ static struct mapping_t FolderHelp[] = { + { NULL, 0 } + }; + ++#ifdef USE_NNTP ++static struct mapping_t FolderNewsHelp[] = { ++ { N_("Exit"), OP_EXIT }, ++ { N_("List"), OP_TOGGLE_MAILBOXES }, ++ { N_("Subscribe"), OP_BROWSER_SUBSCRIBE }, ++ { N_("Unsubscribe"), OP_BROWSER_UNSUBSCRIBE }, ++ { N_("Catchup"), OP_CATCHUP }, ++ { N_("Mask"), OP_ENTER_MASK }, ++ { N_("Help"), OP_HELP }, ++ { NULL } ++}; ++#endif ++ + typedef struct folder_t + { + struct folder_file *ff; +@@ -114,9 +130,17 @@ static void browser_sort (struct browser + case SORT_ORDER: + return; + case SORT_DATE: ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ return; ++#endif + f = browser_compare_date; + break; + case SORT_SIZE: ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ return; ++#endif + f = browser_compare_size; + break; + case SORT_SUBJECT: +@@ -307,8 +331,106 @@ folder_format_str (char *dest, size_t de + return (src); + } + ++#ifdef USE_NNTP ++static const char * ++newsgroup_format_str (char *dest, size_t destlen, size_t col, char op, const char *src, ++ const char *fmt, const char *ifstring, const char *elsestring, ++ unsigned long data, format_flag flags) ++{ ++ char fn[SHORT_STRING], tmp[SHORT_STRING]; ++ FOLDER *folder = (FOLDER *) data; ++ ++ switch (op) ++ { ++ case 'C': ++ snprintf (tmp, sizeof (tmp), "%%%sd", fmt); ++ snprintf (dest, destlen, tmp, folder->num + 1); ++ break; ++ ++ case 'f': ++ strncpy (fn, folder->ff->name, sizeof(fn) - 1); ++ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); ++ snprintf (dest, destlen, tmp, fn); ++ break; ++ ++ case 'N': ++ snprintf (tmp, sizeof (tmp), "%%%sc", fmt); ++ if (folder->ff->nd->subscribed) ++ snprintf (dest, destlen, tmp, ' '); ++ else ++ snprintf (dest, destlen, tmp, folder->ff->new ? 'N' : 'u'); ++ break; ++ ++ case 'M': ++ snprintf (tmp, sizeof (tmp), "%%%sc", fmt); ++ if (folder->ff->nd->deleted) ++ snprintf (dest, destlen, tmp, 'D'); ++ else ++ snprintf (dest, destlen, tmp, folder->ff->nd->allowed ? ' ' : '-'); ++ break; ++ ++ case 's': ++ if (flags & M_FORMAT_OPTIONAL) ++ { ++ if (folder->ff->nd->unread != 0) ++ mutt_FormatString (dest, destlen, col, ifstring, newsgroup_format_str, ++ data, flags); ++ else ++ mutt_FormatString (dest, destlen, col, elsestring, newsgroup_format_str, ++ data, flags); ++ } ++ else if (Context && Context->data == folder->ff->nd) ++ { ++ snprintf (tmp, sizeof (tmp), "%%%sd", fmt); ++ snprintf (dest, destlen, tmp, Context->unread); ++ } ++ else ++ { ++ snprintf (tmp, sizeof (tmp), "%%%sd", fmt); ++ snprintf (dest, destlen, tmp, folder->ff->nd->unread); ++ } ++ break; ++ ++ case 'n': ++ if (Context && Context->data == folder->ff->nd) ++ { ++ snprintf (tmp, sizeof (tmp), "%%%sd", fmt); ++ snprintf (dest, destlen, tmp, Context->new); ++ } ++ else if (option (OPTMARKOLD) && ++ folder->ff->nd->lastCached >= folder->ff->nd->firstMessage && ++ folder->ff->nd->lastCached <= folder->ff->nd->lastMessage) ++ { ++ snprintf (tmp, sizeof (tmp), "%%%sd", fmt); ++ snprintf (dest, destlen, tmp, folder->ff->nd->lastMessage - folder->ff->nd->lastCached); ++ } ++ else ++ { ++ snprintf (tmp, sizeof (tmp), "%%%sd", fmt); ++ snprintf (dest, destlen, tmp, folder->ff->nd->unread); ++ } ++ break; ++ ++ case 'd': ++ if (folder->ff->nd->desc != NULL) ++ { ++ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); ++ snprintf (dest, destlen, tmp, folder->ff->nd->desc); ++ } ++ else ++ { ++ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); ++ snprintf (dest, destlen, tmp, ""); ++ } ++ break; ++ } ++ return (src); ++} ++#endif /* USE_NNTP */ ++ + static void add_folder (MUTTMENU *m, struct browser_state *state, +- const char *name, const struct stat *s, int new) ++ const char *name, const struct stat *s, ++ void *data, int new) + { + if (state->entrylen == state->entrymax) + { +@@ -337,6 +459,10 @@ static void add_folder (MUTTMENU *m, str + #ifdef USE_IMAP + (state->entry)[state->entrylen].imap = 0; + #endif ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ (state->entry)[state->entrylen].nd = (NNTP_DATA *) data; ++#endif + (state->entrylen)++; + } + +@@ -352,9 +478,35 @@ static void init_state (struct browser_s + menu->data = state->entry; + } + ++/* get list of all files/newsgroups with mask */ + static int examine_directory (MUTTMENU *menu, struct browser_state *state, + char *d, const char *prefix) + { ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ LIST *tmp; ++ NNTP_DATA *data; ++ NNTP_SERVER *news = CurrentNewsSrv; ++ ++/* mutt_buffy_check (0); */ ++ init_state (state, menu); ++ ++ for (tmp = news->list; tmp; tmp = tmp->next) ++ { ++ if (!(data = (NNTP_DATA *)tmp->data)) ++ continue; ++ if (prefix && *prefix && strncmp (prefix, data->group, ++ strlen (prefix)) != 0) ++ continue; ++ if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not)) ++ continue; ++ add_folder (menu, state, data->group, NULL, data, data->new); ++ } ++ } ++ else ++#endif /* USE_NNTP */ ++ { + struct stat s; + DIR *dp; + struct dirent *de; +@@ -415,17 +567,40 @@ static int examine_directory (MUTTMENU * + tmp = Incoming; + while (tmp && mutt_strcmp (buffer, tmp->path)) + tmp = tmp->next; +- add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0); ++ add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0); ++ } ++ closedir (dp); + } +- closedir (dp); + browser_sort (state); + return 0; + } + ++/* get list of mailboxes/subscribed newsgroups */ + static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state) + { + struct stat s; + char buffer[LONG_STRING]; ++ ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ LIST *tmp; ++ NNTP_DATA *data; ++ NNTP_SERVER *news = CurrentNewsSrv; ++ ++/* mutt_buffy_check (0); */ ++ init_state (state, menu); ++ ++ for (tmp = news->list; tmp; tmp = tmp->next) ++ { ++ if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new || ++ (data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread)))) ++ add_folder (menu, state, data->group, NULL, data, data->new); ++ } ++ } ++ else ++#endif ++ { + BUFFY *tmp = Incoming; + #ifdef USE_IMAP + struct mailbox_state mbox; +@@ -443,14 +618,21 @@ static int examine_mailboxes (MUTTMENU * + if (mx_is_imap (tmp->path)) + { + imap_mailbox_state (tmp->path, &mbox); +- add_folder (menu, state, tmp->path, NULL, mbox.new); ++ add_folder (menu, state, tmp->path, NULL, NULL, mbox.new); + continue; + } + #endif + #ifdef USE_POP + if (mx_is_pop (tmp->path)) + { +- add_folder (menu, state, tmp->path, NULL, tmp->new); ++ add_folder (menu, state, tmp->path, NULL, NULL, tmp->new); ++ continue; ++ } ++#endif ++#ifdef USE_NNTP ++ if (mx_is_nntp (tmp->path)) ++ { ++ add_folder (menu, state, tmp->path, NULL, NULL, tmp->new); + continue; + } + #endif +@@ -479,15 +661,20 @@ static int examine_mailboxes (MUTTMENU * + strfcpy (buffer, NONULL(tmp->path), sizeof (buffer)); + mutt_pretty_mailbox (buffer, sizeof (buffer)); + +- add_folder (menu, state, buffer, &s, tmp->new); ++ add_folder (menu, state, buffer, &s, NULL, tmp->new); + } + while ((tmp = tmp->next)); ++ } + browser_sort (state); + return 0; + } + + static int select_file_search (MUTTMENU *menu, regex_t *re, int n) + { ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ return (regexec (re, ((struct folder_file *) menu->data)[n].desc, 0, NULL, 0)); ++#endif + return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0)); + } + +@@ -498,6 +685,12 @@ static void folder_entry (char *s, size_ + folder.ff = &((struct folder_file *) menu->data)[num]; + folder.num = num; + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ mutt_FormatString (s, slen, 0, NONULL(GroupFormat), newsgroup_format_str, ++ (unsigned long) &folder, M_FORMAT_ARROWCURSOR); ++ else ++#endif + mutt_FormatString (s, slen, 0, NONULL(FolderFormat), folder_format_str, + (unsigned long) &folder, M_FORMAT_ARROWCURSOR); + } +@@ -518,6 +711,17 @@ static void init_menu (struct browser_st + + menu->tagged = 0; + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ if (buffy) ++ snprintf (title, titlelen, _("Subscribed newsgroups")); ++ else ++ snprintf (title, titlelen, _("Newsgroups on server [%s]"), ++ CurrentNewsSrv->conn->account.host); ++ } ++ else ++#endif + if (buffy) + snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0)); + else +@@ -573,6 +777,31 @@ void _mutt_select_file (char *f, size_t + if (!folder) + strfcpy (LastDirBackup, LastDir, sizeof (LastDirBackup)); + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ if (*f) ++ strfcpy (prefix, f, sizeof (prefix)); ++ else ++ { ++ LIST *list; ++ ++ /* default state for news reader mode is browse subscribed newsgroups */ ++ buffy = 0; ++ for (list = CurrentNewsSrv->list; list; list = list->next) ++ { ++ NNTP_DATA *data = (NNTP_DATA *) list->data; ++ ++ if (data && data->subscribed) ++ { ++ buffy = 1; ++ break; ++ } ++ } ++ } ++ } ++ else ++#endif + if (*f) + { + mutt_expand_path (f, flen); +@@ -669,6 +898,9 @@ void _mutt_select_file (char *f, size_t + menu->tag = file_tag; + + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER, ++#ifdef USE_NNTP ++ (option (OPTNEWS)) ? FolderNewsHelp : ++#endif + FolderHelp); + + init_menu (&state, menu, title, sizeof (title), buffy); +@@ -807,7 +1039,11 @@ void _mutt_select_file (char *f, size_t + } + } + ++#ifdef USE_NNTP ++ if (buffy || option (OPTNEWS)) /* news have not path */ ++#else + if (buffy) ++#endif + { + strfcpy (f, state.entry[menu->current].name, flen); + mutt_expand_path (f, flen); +@@ -865,14 +1101,6 @@ void _mutt_select_file (char *f, size_t + break; + + #ifdef USE_IMAP +- case OP_BROWSER_SUBSCRIBE: +- imap_subscribe (state.entry[menu->current].name, 1); +- break; +- +- case OP_BROWSER_UNSUBSCRIBE: +- imap_subscribe (state.entry[menu->current].name, 0); +- break; +- + case OP_BROWSER_TOGGLE_LSUB: + if (option (OPTIMAPLSUB)) + unset_option (OPTIMAPLSUB); +@@ -973,6 +1201,11 @@ void _mutt_select_file (char *f, size_t + + case OP_CHANGE_DIRECTORY: + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ break; ++#endif ++ + strfcpy (buf, LastDir, sizeof (buf)); + #ifdef USE_IMAP + if (!state.imap_browse) +@@ -1239,6 +1472,190 @@ void _mutt_select_file (char *f, size_t + else + mutt_error _("Error trying to view file"); + } ++ break; ++ ++#ifdef USE_NNTP ++ case OP_CATCHUP: ++ case OP_UNCATCHUP: ++ if (option (OPTNEWS)) ++ { ++ struct folder_file *f = &state.entry[menu->current]; ++ NNTP_DATA *nd; ++ ++ if (i == OP_CATCHUP) ++ nd = mutt_newsgroup_catchup (CurrentNewsSrv, f->name); ++ else ++ nd = mutt_newsgroup_uncatchup (CurrentNewsSrv, f->name); ++ ++ if (nd) ++ { ++/* FOLDER folder; ++ struct folder_file ff; ++ char buffer[_POSIX_PATH_MAX + SHORT_STRING]; ++ ++ folder.ff = &ff; ++ folder.ff->name = f->name; ++ folder.ff->st = NULL; ++ folder.ff->is_new = nd->new; ++ folder.ff->nd = nd; ++ FREE (&f->desc); ++ mutt_FormatString (buffer, sizeof (buffer), 0, NONULL(GroupFormat), ++ newsgroup_format_str, (unsigned long) &folder, ++ M_FORMAT_ARROWCURSOR); ++ f->desc = safe_strdup (buffer); */ ++ if (menu->current + 1 < menu->max) ++ menu->current++; ++ menu->redraw = REDRAW_MOTION_RESYNCH; ++ } ++ } ++ break; ++ ++ case OP_LOAD_ACTIVE: ++ if (!option (OPTNEWS)) ++ break; ++ ++ { ++ LIST *tmp; ++ NNTP_DATA *data; ++ ++ for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next) ++ { ++ if ((data = (NNTP_DATA *)tmp->data)) ++ data->deleted = 1; ++ } ++ } ++ nntp_get_active (CurrentNewsSrv); ++ ++ destroy_state (&state); ++ if (buffy) ++ examine_mailboxes (menu, &state); ++ else ++ examine_directory (menu, &state, NULL, NULL); ++ init_menu (&state, menu, title, sizeof (title), buffy); ++ break; ++#endif /* USE_NNTP */ ++ ++#if defined USE_IMAP || defined USE_NNTP ++ case OP_BROWSER_SUBSCRIBE: ++ case OP_BROWSER_UNSUBSCRIBE: ++#endif ++#ifdef USE_NNTP ++ case OP_SUBSCRIBE_PATTERN: ++ case OP_UNSUBSCRIBE_PATTERN: ++ if (option (OPTNEWS)) ++ { ++ regex_t *rx = (regex_t *) safe_malloc (sizeof (regex_t)); ++ char *s = buf; ++ int j = menu->current; ++ NNTP_DATA *nd; ++ NNTP_SERVER *news = CurrentNewsSrv; ++ ++ if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN) ++ { ++ char tmp[STRING]; ++ int err; ++ ++ buf[0] = 0; ++ if (i == OP_SUBSCRIBE_PATTERN) ++ snprintf (tmp, sizeof (tmp), _("Subscribe pattern: ")); ++ else ++ snprintf (tmp, sizeof (tmp), _("Unsubscribe pattern: ")); ++ if (mutt_get_field (tmp, buf, sizeof (buf), 0) != 0 || !buf[0]) ++ { ++ FREE (&rx); ++ break; ++ } ++ ++ if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0) ++ { ++ regerror (err, rx, buf, sizeof (buf)); ++ regfree (rx); ++ FREE (&rx); ++ mutt_error ("%s", buf); ++ break; ++ } ++ menu->redraw = REDRAW_FULL; ++ j = 0; ++ } ++ else if (!state.entrylen) ++ { ++ mutt_error _("No newsgroups match the mask"); ++ break; ++ } ++ ++ for ( ; j < state.entrylen; j++) ++ { ++ struct folder_file *f = &state.entry[j]; ++ ++ if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE || ++ regexec (rx, f->name, 0, NULL, 0) == 0) ++ { ++ if (i == OP_BROWSER_SUBSCRIBE || i == OP_SUBSCRIBE_PATTERN) ++ nd = mutt_newsgroup_subscribe (news, f->name); ++ else ++ nd = mutt_newsgroup_unsubscribe (news, f->name); ++/* if (nd) ++ { ++ FOLDER folder; ++ char buffer[_POSIX_PATH_MAX + SHORT_STRING]; ++ ++ folder.name = f->name; ++ folder.f = NULL; ++ folder.new = nd->new; ++ folder.nd = nd; ++ FREE (&f->desc); ++ mutt_FormatString (buffer, sizeof (buffer), 0, NONULL(GroupFormat), ++ newsgroup_format_str, (unsigned long) &folder, ++ M_FORMAT_ARROWCURSOR); ++ f->desc = safe_strdup (buffer); ++ } */ ++ } ++ if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE) ++ { ++ if (menu->current + 1 < menu->max) ++ menu->current++; ++ menu->redraw = REDRAW_MOTION_RESYNCH; ++ break; ++ } ++ } ++ if (i == OP_SUBSCRIBE_PATTERN) ++ { ++ LIST *grouplist = NULL; ++ ++ if (news) ++ grouplist = news->list; ++ for (; grouplist; grouplist = grouplist->next) ++ { ++ nd = (NNTP_DATA *) grouplist->data; ++ if (nd && nd->group && !nd->subscribed) ++ { ++ if (regexec (rx, nd->group, 0, NULL, 0) == 0) ++ { ++ mutt_newsgroup_subscribe (news, nd->group); ++ add_folder (menu, &state, nd->group, NULL, nd, nd->new); ++ } ++ } ++ } ++ init_menu (&state, menu, title, sizeof (title), buffy); ++ } ++ mutt_newsrc_update (news); ++ nntp_clear_cacheindex (news); ++ if (i != OP_BROWSER_SUBSCRIBE && i != OP_BROWSER_UNSUBSCRIBE) ++ regfree (rx); ++ FREE (&rx); ++ } ++#ifdef USE_IMAP ++ else ++#endif /* USE_IMAP && USE_NNTP */ ++#endif /* USE_NNTP */ ++#ifdef USE_IMAP ++ { ++ if (i == OP_BROWSER_SUBSCRIBE) ++ imap_subscribe (state.entry[menu->current].name, 1); ++ else ++ imap_subscribe (state.entry[menu->current].name, 0); ++ } ++#endif /* USE_IMAP */ + } + } + +diff -udprP mutt-1.5.20.orig/browser.h mutt-1.5.20/browser.h +--- mutt-1.5.20.orig/browser.h 2009-01-05 00:34:12.000000000 +0200 ++++ mutt-1.5.20/browser.h 2009-06-15 21:05:24.000000000 +0300 +@@ -19,6 +19,10 @@ + #ifndef _BROWSER_H + #define _BROWSER_H 1 + ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif ++ + struct folder_file + { + mode_t mode; +@@ -37,6 +41,9 @@ struct folder_file + unsigned selectable : 1; + unsigned inferiors : 1; + #endif ++#ifdef USE_NNTP ++ NNTP_DATA *nd; ++#endif + unsigned tagged : 1; + }; + +diff -udprP mutt-1.5.20.orig/buffy.c mutt-1.5.20/buffy.c +--- mutt-1.5.20.orig/buffy.c 2009-06-02 20:16:26.000000000 +0300 ++++ mutt-1.5.20/buffy.c 2009-06-15 21:05:24.000000000 +0300 +@@ -320,6 +320,9 @@ int mutt_buffy_check (int force) + #ifdef USE_POP + if (!Context || Context->magic != M_POP) + #endif ++#ifdef USE_NNTP ++ if (!Context || Context->magic != M_NNTP) ++#endif + /* check device ID and serial number instead of comparing paths */ + if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0) + { +@@ -343,6 +346,11 @@ int mutt_buffy_check (int force) + tmp->magic = M_POP; + else + #endif ++#ifdef USE_NNTP ++ if ((tmp->magic == M_NNTP) || mx_is_nntp (tmp->path)) ++ tmp->magic = M_NNTP; ++ else ++#endif + if (stat (tmp->path, &sb) != 0 || (S_ISREG(sb.st_mode) && sb.st_size == 0) || + (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) + { +@@ -360,25 +368,21 @@ int mutt_buffy_check (int force) + /* check to see if the folder is the currently selected folder + * before polling */ + if (!Context || !Context->path || +-#if defined USE_IMAP || defined USE_POP +- (( ++ ( ++ (0 + #ifdef USE_IMAP +- tmp->magic == M_IMAP ++ || tmp->magic == M_IMAP + #endif + #ifdef USE_POP +-#ifdef USE_IMAP +- || +-#endif +- tmp->magic == M_POP +-#endif +- ) ? mutt_strcmp (tmp->path, Context->path) : ++ || tmp->magic == M_POP + #endif +- (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino) +-#if defined USE_IMAP || defined USE_POP +- ) ++#ifdef USE_NNTP ++ || tmp->magic == M_NNTP + #endif +- ) +- ++ ) ? mutt_strcmp (tmp->path, Context->path) : ++ (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino) ++ ) ++ ) + { + switch (tmp->magic) + { +diff -udprP mutt-1.5.20.orig/complete.c mutt-1.5.20/complete.c +--- mutt-1.5.20.orig/complete.c 2009-01-05 00:38:16.000000000 +0200 ++++ mutt-1.5.20/complete.c 2009-06-15 21:05:24.000000000 +0300 +@@ -25,6 +25,9 @@ + #include "mailbox.h" + #include "imap.h" + #endif ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif + + #include + #include +@@ -48,9 +51,71 @@ int mutt_complete (char *s, size_t slen) + char filepart[_POSIX_PATH_MAX]; + #ifdef USE_IMAP + char imap_path[LONG_STRING]; ++#endif + + dprint (2, (debugfile, "mutt_complete: completing %s\n", s)); + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ LIST *l = CurrentNewsSrv->list; ++ ++ strfcpy (filepart, s, sizeof (filepart)); ++ ++ /* ++ * special case to handle when there is no filepart yet. ++ * find the first subscribed newsgroup ++ */ ++ if ((len = mutt_strlen (filepart)) == 0) ++ { ++ for (; l; l = l->next) ++ { ++ NNTP_DATA *data = (NNTP_DATA *)l->data; ++ ++ if (data && data->subscribed) ++ { ++ strfcpy (filepart, data->group, sizeof (filepart)); ++ init++; ++ l = l->next; ++ break; ++ } ++ } ++ } ++ ++ for (; l; l = l->next) ++ { ++ NNTP_DATA *data = (NNTP_DATA *)l->data; ++ ++ if (data && data->subscribed && ++ mutt_strncmp (data->group, filepart, len) == 0) ++ { ++ if (init) ++ { ++ for (i = 0; filepart[i] && data->group[i]; i++) ++ { ++ if (filepart[i] != data->group[i]) ++ { ++ filepart[i] = 0; ++ break; ++ } ++ } ++ filepart[i] = 0; ++ } ++ else ++ { ++ strfcpy (filepart, data->group, sizeof (filepart)); ++ init = 1; ++ } ++ } ++ } ++ ++ strcpy (s, filepart); ++ ++ return (init ? 0 : -1); ++ } ++#endif ++ ++#ifdef USE_IMAP + /* we can use '/' as a delimiter, imap_complete rewrites it */ + if (*s == '=' || *s == '+' || *s == '!') + { +diff -udprP mutt-1.5.20.orig/compose.c mutt-1.5.20/compose.c +--- mutt-1.5.20.orig/compose.c 2009-03-31 09:52:43.000000000 +0300 ++++ mutt-1.5.20/compose.c 2009-06-15 21:05:24.000000000 +0300 +@@ -32,10 +32,15 @@ + #include "mailbox.h" + #include "sort.h" + #include "charset.h" ++#include "mx.h" + + #ifdef MIXMASTER + #include "remailer.h" + #endif ++ ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif + + #include + #include +@@ -60,18 +65,21 @@ enum + HDR_REPLYTO, + HDR_FCC, + +-#ifdef MIXMASTER +- HDR_MIX, +-#endif + + HDR_CRYPT, + HDR_CRYPTINFO, + ++#ifdef USE_NNTP ++ HDR_NEWSGROUPS, ++ HDR_FOLLOWUPTO, ++ HDR_XCOMMENTTO, ++#endif ++ + HDR_ATTACH = (HDR_FCC + 5) /* where to start printing the attachments */ + }; + +-#define HDR_XOFFSET 10 +-#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ ++#define HDR_XOFFSET 14 ++#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */ + #define W (COLS - HDR_XOFFSET) + + static char *Prompts[] = +@@ -83,6 +91,16 @@ static char *Prompts[] = + "Subject: ", + "Reply-To: ", + "Fcc: " ++#ifdef USE_NNTP ++#ifdef MIXMASTER ++ ,"" ++#endif ++ ,"" ++ ,"" ++ ,"Newsgroups: " ++ ,"Followup-To: " ++ ,"X-Comment-To: " ++#endif + }; + + static struct mapping_t ComposeHelp[] = { +@@ -97,6 +115,19 @@ static struct mapping_t ComposeHelp[] = + { NULL, 0 } + }; + ++#ifdef USE_NNTP ++static struct mapping_t ComposeNewsHelp[] = { ++ { N_("Send"), OP_COMPOSE_SEND_MESSAGE }, ++ { N_("Abort"), OP_EXIT }, ++ { "Newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS }, ++ { "Subj", OP_COMPOSE_EDIT_SUBJECT }, ++ { N_("Attach file"), OP_COMPOSE_ATTACH_FILE }, ++ { N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION }, ++ { N_("Help"), OP_HELP }, ++ { NULL } ++}; ++#endif ++ + static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num) + { + mutt_FormatString (b, blen, 0, NONULL (AttachFormat), mutt_attach_fmt, +@@ -115,16 +146,16 @@ static void redraw_crypt_lines (HEADER * + if ((WithCrypto & APPLICATION_PGP) && (WithCrypto & APPLICATION_SMIME)) + { + if (!msg->security) +- mvaddstr (HDR_CRYPT, 0, "Security: "); ++ mvaddstr (HDR_CRYPT, 0, " Security: "); + else if (msg->security & APPLICATION_SMIME) +- mvaddstr (HDR_CRYPT, 0, " S/MIME: "); ++ mvaddstr (HDR_CRYPT, 0, " S/MIME: "); + else if (msg->security & APPLICATION_PGP) +- mvaddstr (HDR_CRYPT, 0, " PGP: "); ++ mvaddstr (HDR_CRYPT, 0, " PGP: "); + } + else if ((WithCrypto & APPLICATION_SMIME)) +- mvaddstr (HDR_CRYPT, 0, " S/MIME: "); ++ mvaddstr (HDR_CRYPT, 0, " S/MIME: "); + else if ((WithCrypto & APPLICATION_PGP)) +- mvaddstr (HDR_CRYPT, 0, " PGP: "); ++ mvaddstr (HDR_CRYPT, 0, " PGP: "); + else + return; + +@@ -252,9 +283,28 @@ static void draw_envelope_addr (int line + static void draw_envelope (HEADER *msg, char *fcc) + { + draw_envelope_addr (HDR_FROM, msg->env->from); ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++ { ++#endif + draw_envelope_addr (HDR_TO, msg->env->to); + draw_envelope_addr (HDR_CC, msg->env->cc); + draw_envelope_addr (HDR_BCC, msg->env->bcc); ++#ifdef USE_NNTP ++ } ++ else ++ { ++ mvprintw (HDR_TO, 0, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]); ++ mutt_paddstr (W, NONULL (msg->env->newsgroups)); ++ mvprintw (HDR_CC, 0, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]); ++ mutt_paddstr (W, NONULL (msg->env->followup_to)); ++ if (option (OPTXCOMMENTTO)) ++ { ++ mvprintw (HDR_BCC, 0, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]); ++ mutt_paddstr (W, NONULL (msg->env->x_comment_to)); ++ } ++ } ++#endif + mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); + mutt_paddstr (W, NONULL (msg->env->subject)); + draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); +@@ -507,6 +557,12 @@ int mutt_compose_menu (HEADER *msg, /* + /* Sort, SortAux could be changed in mutt_index_menu() */ + int oldSort, oldSortAux; + struct stat st; ++#ifdef USE_NNTP ++ int news = 0; /* is it a news article ? */ ++ ++ if (option (OPTNEWSSEND)) ++ news++; ++#endif + + mutt_attach_init (msg->content); + idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1); +@@ -517,10 +573,18 @@ int mutt_compose_menu (HEADER *msg, /* + menu->make_entry = snd_entry; + menu->tag = mutt_tag_attach; + menu->data = idx; ++#ifdef USE_NNTP ++ if (news) ++ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeNewsHelp); ++ else ++#endif + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp); + + while (loop) + { ++#ifdef USE_NNTP ++ unset_option (OPTNEWS); /* for any case */ ++#endif + switch (op = mutt_menuLoop (menu)) + { + case OP_REDRAW: +@@ -533,17 +597,87 @@ int mutt_compose_menu (HEADER *msg, /* + mutt_message_hook (NULL, msg, M_SEND2HOOK); + break; + case OP_COMPOSE_EDIT_TO: ++#ifdef USE_NNTP ++ if (news) ++ break; ++#endif + menu->redraw = edit_address_list (HDR_TO, &msg->env->to); + mutt_message_hook (NULL, msg, M_SEND2HOOK); + break; + case OP_COMPOSE_EDIT_BCC: ++#ifdef USE_NNTP ++ if (news) ++ break; ++#endif + menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc); + mutt_message_hook (NULL, msg, M_SEND2HOOK); + break; + case OP_COMPOSE_EDIT_CC: ++#ifdef USE_NNTP ++ if (news) ++ break; ++#endif + menu->redraw = edit_address_list (HDR_CC, &msg->env->cc); + mutt_message_hook (NULL, msg, M_SEND2HOOK); + break; ++#ifdef USE_NNTP ++ case OP_COMPOSE_EDIT_NEWSGROUPS: ++ if (news) ++ { ++ if (msg->env->newsgroups) ++ strfcpy (buf, msg->env->newsgroups, sizeof (buf)); ++ else ++ buf[0] = 0; ++ if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0 && buf[0]) ++ { ++ FREE (&msg->env->newsgroups); ++ mutt_remove_trailing_ws (buf); ++ msg->env->newsgroups = safe_strdup (mutt_skip_whitespace (buf)); ++ move (HDR_TO, HDR_XOFFSET); ++ clrtoeol (); ++ if (msg->env->newsgroups) ++ printw ("%-*.*s", W, W, msg->env->newsgroups); ++ } ++ } ++ break; ++ ++ case OP_COMPOSE_EDIT_FOLLOWUP_TO: ++ if (news) ++ { ++ buf[0] = 0; ++ if (msg->env->followup_to) ++ strfcpy (buf, msg->env->followup_to, sizeof (buf)); ++ if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0 && buf[0]) ++ { ++ FREE (&msg->env->followup_to); ++ mutt_remove_trailing_ws (buf); ++ msg->env->followup_to = safe_strdup (mutt_skip_whitespace (buf)); ++ move (HDR_CC, HDR_XOFFSET); ++ clrtoeol(); ++ if (msg->env->followup_to) ++ printw ("%-*.*s", W, W, msg->env->followup_to); ++ } ++ } ++ break; ++ ++ case OP_COMPOSE_EDIT_X_COMMENT_TO: ++ if (news && option (OPTXCOMMENTTO)) ++ { ++ buf[0] = 0; ++ if (msg->env->x_comment_to) ++ strfcpy (buf, msg->env->x_comment_to, sizeof (buf)); ++ if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0 && buf[0]) ++ { ++ FREE (&msg->env->x_comment_to); ++ msg->env->x_comment_to = safe_strdup (buf); ++ move (HDR_BCC, HDR_XOFFSET); ++ clrtoeol(); ++ if (msg->env->x_comment_to) ++ printw ("%-*.*s", W, W, msg->env->x_comment_to); ++ } ++ } ++ break; ++#endif + case OP_COMPOSE_EDIT_SUBJECT: + if (msg->env->subject) + strfcpy (buf, msg->env->subject, sizeof (buf)); +@@ -706,6 +840,9 @@ int mutt_compose_menu (HEADER *msg, /* + break; + + case OP_COMPOSE_ATTACH_MESSAGE: ++#ifdef USE_NNTP ++ case OP_COMPOSE_ATTACH_NEWS_MESSAGE: ++#endif + { + char *prompt; + HEADER *h; +@@ -713,7 +850,22 @@ int mutt_compose_menu (HEADER *msg, /* + fname[0] = 0; + prompt = _("Open mailbox to attach message from"); + ++#ifdef USE_NNTP ++ unset_option (OPTNEWS); ++ if (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE) ++ { ++ if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer))) ++ break; ++ ++ prompt = _("Open newsgroup to attach message from"); ++ set_option (OPTNEWS); ++ } ++#endif ++ + if (Context) ++#ifdef USE_NNTP ++ if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == M_NNTP)) ++#endif + { + strfcpy (fname, NONULL (Context->path), sizeof (fname)); + mutt_pretty_mailbox (fname, sizeof (fname)); +@@ -722,6 +874,11 @@ int mutt_compose_menu (HEADER *msg, /* + if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 1) == -1 || !fname[0]) + break; + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ nntp_expand_path (fname, sizeof (fname), &CurrentNewsSrv->conn->account); ++ else ++#endif + mutt_expand_path (fname, sizeof (fname)); + #ifdef USE_IMAP + if (!mx_is_imap (fname)) +@@ -729,6 +886,9 @@ int mutt_compose_menu (HEADER *msg, /* + #ifdef USE_POP + if (!mx_is_pop (fname)) + #endif ++#ifdef USE_NNTP ++ if (!mx_is_nntp (fname) && !option (OPTNEWS)) ++#endif + /* check to make sure the file exists and is readable */ + if (access (fname, R_OK) == -1) + { +diff -udprP mutt-1.5.20.orig/config.h.in mutt-1.5.20/config.h.in +--- mutt-1.5.20.orig/config.h.in 2009-06-09 09:51:15.000000000 +0300 ++++ mutt-1.5.20/config.h.in 2009-06-15 21:05:24.000000000 +0300 +@@ -37,6 +37,9 @@ + significant more memory when defined. */ + #undef EXACT_ADDRESS + ++/* Compiling with newsreading support with NNTP */ ++#undef USE_NNTP ++ + /* program to use for shell commands */ + #undef EXECSHELL + +diff -udprP mutt-1.5.20.orig/configure.ac mutt-1.5.20/configure.ac +--- mutt-1.5.20.orig/configure.ac 2009-06-09 09:50:33.000000000 +0300 ++++ mutt-1.5.20/configure.ac 2009-06-15 21:05:24.000000000 +0300 +@@ -599,6 +599,14 @@ if test x"$need_imap" = xyes -o x"$need_ + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS bcache.o" + fi + ++AC_ARG_ENABLE(nntp, [ --enable-nntp Enable NNTP support], ++[ if test x$enableval = xyes ; then ++ AC_DEFINE(USE_NNTP,1,[ Define if you want support for the NNTP protocol. ]) ++ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS nntp.o newsrc.o" ++ need_socket="yes" ++ fi ++]) ++ + dnl -- end socket dependencies -- + + if test "$need_socket" = "yes" +diff -udprP mutt-1.5.20.orig/curs_main.c mutt-1.5.20/curs_main.c +--- mutt-1.5.20.orig/curs_main.c 2009-06-14 05:48:36.000000000 +0300 ++++ mutt-1.5.20/curs_main.c 2009-06-15 21:47:09.000000000 +0300 +@@ -22,6 +22,7 @@ + + #include "mutt.h" + #include "mutt_curses.h" ++#include "mx.h" + #include "mutt_menu.h" + #include "mailbox.h" + #include "mapping.h" +@@ -38,6 +39,10 @@ + + #include "mutt_crypt.h" + ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif ++ + + #include + #include +@@ -413,12 +418,27 @@ static struct mapping_t IndexHelp[] = { + { NULL, 0 } + }; + ++#ifdef USE_NNTP ++struct mapping_t IndexNewsHelp[] = { ++ { N_("Quit"), OP_QUIT }, ++ { N_("Del"), OP_DELETE }, ++ { N_("Undel"), OP_UNDELETE }, ++ { N_("Save"), OP_SAVE }, ++ { N_("Post"), OP_POST }, ++ { N_("Followup"), OP_FOLLOWUP }, ++ { N_("Catchup"), OP_CATCHUP }, ++ { N_("Help"), OP_HELP }, ++ { NULL } ++}; ++#endif ++ + /* This function handles the message index window as well as commands returned + * from the pager (MENU_PAGER). + */ + int mutt_index_menu (void) + { + char buf[LONG_STRING], helpstr[LONG_STRING]; ++ int flags; + int op = OP_NULL; + int done = 0; /* controls when to exit the "event" loop */ + int i = 0, j; +@@ -439,7 +459,11 @@ int mutt_index_menu (void) + menu->make_entry = index_make_entry; + menu->color = index_color; + menu->current = ci_first_message (); +- menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, IndexHelp); ++ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, ++#ifdef USE_NNTP ++ (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp : ++#endif ++ IndexHelp); + + if (!attach_msg) + mutt_buffy_check(1); /* force the buffy check after we enter the folder */ +@@ -690,6 +714,9 @@ int mutt_index_menu (void) + imap_disallow_reopen (Context); + #endif + ++#ifdef USE_NNTP ++ unset_option (OPTNEWS); /* for any case */ ++#endif + switch (op) + { + +@@ -740,6 +767,120 @@ int mutt_index_menu (void) + menu_current_bottom (menu); + break; + ++#ifdef USE_NNTP ++ case OP_GET_MESSAGE: ++ case OP_GET_PARENT: ++ CHECK_MSGCOUNT; ++ if (Context->magic == M_NNTP) ++ { ++ HEADER *h; ++ ++ if (op == OP_GET_MESSAGE) ++ { ++ buf[0] = 0; ++ if (mutt_get_field (_("Enter Message-Id: "), buf, sizeof (buf), 0) != 0 ++ || !buf[0]) ++ break; ++ } ++ else ++ { ++ LIST *ref = CURHDR->env->references; ++ if (!ref) ++ { ++ mutt_error _("Article has no parent reference!"); ++ break; ++ } ++ strfcpy (buf, ref->data, sizeof (buf)); ++ } ++ if (!Context->id_hash) ++ Context->id_hash = mutt_make_id_hash (Context); ++ if ((h = hash_find (Context->id_hash, buf))) ++ { ++ if (h->virtual != -1) ++ { ++ menu->current = h->virtual; ++ menu->redraw = REDRAW_MOTION_RESYNCH; ++ } ++ else if (h->collapsed) ++ { ++ mutt_uncollapse_thread (Context, h); ++ mutt_set_virtual (Context); ++ menu->current = h->virtual; ++ menu->redraw = REDRAW_MOTION_RESYNCH; ++ } ++ else ++ mutt_error _("Message not visible in limited view."); ++ } ++ else ++ { ++ if (nntp_check_msgid (Context, buf) == 0) ++ { ++ h = Context->hdrs[Context->msgcount-1]; ++ mutt_sort_headers (Context, 0); ++ menu->current = h->virtual; ++ menu->redraw = REDRAW_FULL; ++ } ++ else ++ mutt_error (_("Article %s not found on server"), buf); ++ } ++ } ++ break; ++ ++ case OP_GET_CHILDREN: ++ case OP_RECONSTRUCT_THREAD: ++ CHECK_MSGCOUNT; ++ if (Context->magic == M_NNTP) ++ { ++ HEADER *h; ++ int old = CURHDR->index, i; ++ ++ if (!CURHDR->env->message_id) ++ { ++ mutt_error _("No Message-Id. Unable to perform operation"); ++ break; ++ } ++ ++ if (!Context->id_hash) ++ Context->id_hash = mutt_make_id_hash (Context); ++ strfcpy (buf, CURHDR->env->message_id, sizeof (buf)); ++ ++ if (op == OP_RECONSTRUCT_THREAD) ++ { ++ LIST *ref = CURHDR->env->references; ++ while (ref) ++ { ++ nntp_check_msgid (Context, ref->data); ++ /* the last msgid in References is the root message */ ++ if (!ref->next) ++ strfcpy (buf, ref->data, sizeof (buf)); ++ ref = ref->next; ++ } ++ } ++ mutt_message _("Check for children of message..."); ++ if (nntp_check_children (Context, buf) == 0) ++ { ++ mutt_sort_headers (Context, (op == OP_RECONSTRUCT_THREAD)); ++ h = hash_find (Context->id_hash, buf); ++ /* if the root message was retrieved, move to it */ ++ if (h) ++ menu->current = h->virtual; ++ else /* try to restore old position */ ++ for (i = 0; i < Context->msgcount; i++) ++ if (Context->hdrs[i]->index == old) ++ { ++ menu->current = Context->hdrs[i]->virtual; ++ /* As an added courtesy, recenter the menu ++ * with the current entry at the middle of the screen */ ++ menu_check_recenter (menu); ++ menu_current_middle (menu); ++ } ++ } ++ menu->redraw = REDRAW_FULL; ++ mutt_clear_error (); ++ } ++ break; ++#endif ++ + case OP_JUMP: + + CHECK_MSGCOUNT; +@@ -836,11 +977,33 @@ int mutt_index_menu (void) + break; + + case OP_MAIN_LIMIT: ++ case OP_TOGGLE_READ: + + CHECK_IN_MAILBOX; + menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ? + CURHDR->index : -1; +- if (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0) ++ if (op == OP_TOGGLE_READ) ++ { ++ char buf[LONG_STRING]; ++ ++ if (!Context->pattern || strncmp (Context->pattern, "!~R!~D~s", 8) != 0) ++ { ++ snprintf (buf, sizeof (buf), "!~R!~D~s%s", ++ Context->pattern ? Context->pattern : ".*"); ++ set_option (OPTHIDEREAD); ++ } ++ else ++ { ++ strfcpy (buf, Context->pattern + 8, sizeof(buf)); ++ if (!*buf || strncmp (buf, ".*", 2) == 0) ++ snprintf (buf, sizeof(buf), "~A"); ++ unset_option (OPTHIDEREAD); ++ } ++ FREE (&Context->pattern); ++ Context->pattern = safe_strdup (buf); ++ } ++ if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) || ++ mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0) + { + if (menu->oldcurrent >= 0) + { +@@ -1057,15 +1220,22 @@ int mutt_index_menu (void) + + case OP_MAIN_CHANGE_FOLDER: + case OP_MAIN_NEXT_UNREAD_MAILBOX: +- +- if (attach_msg) +- op = OP_MAIN_CHANGE_FOLDER_READONLY; +- +- /* fallback to the readonly case */ +- + case OP_MAIN_CHANGE_FOLDER_READONLY: ++#ifdef USE_NNTP ++ case OP_MAIN_CHANGE_GROUP: ++ case OP_MAIN_CHANGE_GROUP_READONLY: ++ unset_option (OPTNEWS); ++#endif ++ if (attach_msg || option (OPTREADONLY) || ++#ifdef USE_NNTP ++ op == OP_MAIN_CHANGE_GROUP_READONLY || ++#endif ++ op == OP_MAIN_CHANGE_FOLDER_READONLY) ++ flags = M_READONLY; ++ else ++ flags = 0; + +- if ((op == OP_MAIN_CHANGE_FOLDER_READONLY) || option (OPTREADONLY)) ++ if (flags) + cp = _("Open mailbox in read-only mode"); + else + cp = _("Open mailbox"); +@@ -1084,6 +1254,21 @@ int mutt_index_menu (void) + } + else + { ++#ifdef USE_NNTP ++ if (op == OP_MAIN_CHANGE_GROUP || ++ op == OP_MAIN_CHANGE_GROUP_READONLY) ++ { ++ set_option (OPTNEWS); ++ if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer))) ++ break; ++ if (flags) ++ cp = _("Open newsgroup in read-only mode"); ++ else ++ cp = _("Open newsgroup"); ++ nntp_buffy (buf); ++ } ++ else ++#endif + mutt_buffy (buf, sizeof (buf)); + + if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) +@@ -1103,6 +1288,14 @@ int mutt_index_menu (void) + } + } + ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ unset_option (OPTNEWS); ++ nntp_expand_path (buf, sizeof (buf), &CurrentNewsSrv->conn->account); ++ } ++ else ++#endif + mutt_expand_path (buf, sizeof (buf)); + if (mx_get_magic (buf) <= 0) + { +@@ -1140,15 +1333,18 @@ int mutt_index_menu (void) + CurrentMenu = MENU_MAIN; + mutt_folder_hook (buf); + +- if ((Context = mx_open_mailbox (buf, +- (option (OPTREADONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ? +- M_READONLY : 0, NULL)) != NULL) ++ if ((Context = mx_open_mailbox (buf, flags, NULL)) != NULL) + { + menu->current = ci_first_message (); + } + else + menu->current = 0; + ++#ifdef USE_NNTP ++ /* mutt_buffy_check() must be done with mail-reader mode! */ ++ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, ++ (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp : IndexHelp); ++#endif + mutt_clear_error (); + mutt_buffy_check(1); /* force the buffy check after we have changed + the folder */ +@@ -1519,6 +1715,15 @@ int mutt_index_menu (void) + CHECK_READONLY; + CHECK_ACL(M_ACL_WRITE, _("flag message")); + ++#ifdef USE_NNTP ++ if (Context->magic == M_NNTP) ++ { ++ mutt_flushinp (); ++ mutt_error _("Can't change 'important' flag on NNTP server."); ++ break; ++ } ++#endif ++ + if (tag) + { + for (j = 0; j < Context->vcount; j++) +@@ -1866,6 +2071,17 @@ int mutt_index_menu (void) + } + break; + ++#ifdef USE_NNTP ++ case OP_CATCHUP: ++ if (Context && Context->magic == M_NNTP) ++ { ++ if (mutt_newsgroup_catchup (CurrentNewsSrv, ++ ((NNTP_DATA *)Context->data)->group)) ++ menu->redraw = REDRAW_INDEX | REDRAW_STATUS; ++ } ++ break; ++#endif ++ + case OP_DISPLAY_ADDRESS: + + CHECK_MSGCOUNT; +@@ -1993,6 +2209,15 @@ int mutt_index_menu (void) + menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS; + } + #endif ++ ++#ifdef USE_NNTP ++ if (Context->magic == M_NNTP) ++ { ++ mutt_flushinp (); ++ mutt_error _("Can't edit message on newsserver."); ++ break; ++ } ++#endif + + MAYBE_REDRAW (menu->redraw); + break; +@@ -2065,6 +2290,41 @@ int mutt_index_menu (void) + menu->redraw = REDRAW_FULL; + break; + ++#ifdef USE_NNTP ++ case OP_FOLLOWUP: ++ case OP_FORWARD_TO_GROUP: ++ ++ CHECK_MSGCOUNT; ++ CHECK_VISIBLE; ++ ++ case OP_POST: ++ ++ CHECK_ATTACH; ++ if (op != OP_FOLLOWUP || !CURHDR->env->followup_to || ++ mutt_strcasecmp (CURHDR->env->followup_to, "poster") || ++ query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES) ++ { ++ if (Context && Context->magic == M_NNTP && ++ !((NNTP_DATA *)Context->data)->allowed && ++ query_quadoption (OPT_TOMODERATED, _("Posting to this group not allowed, may be moderated. Continue?")) != M_YES) ++ break; ++ if (op == OP_POST) ++ ci_send_message (SENDNEWS, NULL, NULL, Context, NULL); ++ else ++ { ++ CHECK_MSGCOUNT; ++ if (op == OP_FOLLOWUP) ++ ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL, Context, ++ tag ? NULL : CURHDR); ++ else ++ ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, Context, ++ tag ? NULL : CURHDR); ++ } ++ menu->redraw = REDRAW_FULL; ++ break; ++ } ++#endif ++ + case OP_REPLY: + + CHECK_ATTACH; +@@ -2140,6 +2400,12 @@ int mutt_index_menu (void) + CHECK_READONLY; + CHECK_ACL(M_ACL_DELETE, _("undelete message(s)")); + ++#ifdef USE_NNTP ++ /* Close all open NNTP connections */ ++ if (!attach_msg) ++ nntp_logout_all (); ++#endif ++ + rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0, + op == OP_UNDELETE_THREAD ? 0 : 1); + +diff -udprP mutt-1.5.20.orig/doc/manual.xml.head mutt-1.5.20/doc/manual.xml.head +--- mutt-1.5.20.orig/doc/manual.xml.head 2009-05-30 20:20:08.000000000 +0300 ++++ mutt-1.5.20/doc/manual.xml.head 2009-06-15 21:05:24.000000000 +0300 +@@ -1568,6 +1568,22 @@ fo-table for details. + + + ++ ++Reading news via NNTP ++ ++ ++If compiled with --enable-nntp option, Mutt can ++read news from newsserver via NNTP. You can open a newsgroup with ++function ``change-newsgroup'' (default: ``i''). Default newsserver ++can be obtained from NNTPSERVER environment ++variable. Like other news readers, info about subscribed newsgroups ++is saved in file by $newsrc ++variable. Article headers are cached and can be loaded from file when ++newsgroup entered instead loading from newsserver. ++ ++ ++ ++ + + + +diff -udprP mutt-1.5.20.orig/doc/mutt.man mutt-1.5.20/doc/mutt.man +--- mutt-1.5.20.orig/doc/mutt.man 2009-06-07 03:32:44.000000000 +0300 ++++ mutt-1.5.20/doc/mutt.man 2009-06-15 21:07:47.000000000 +0300 +@@ -23,8 +23,8 @@ mutt \- The Mutt Mail User Agent + .SH SYNOPSIS + .PP + .B mutt +-[-nRyzZ] +-[\-e \fIcmd\fP] [\-F \fIfile\fP] [\-m \fItype\fP] [\-f \fIfile\fP] ++[-GnRyzZ] ++[\-e \fIcmd\fP] [\-F \fIfile\fP] [\-g \fIserver\fP] [\-m \fItype\fP] [\-f \fIfile\fP] + .PP + .B mutt + [\-nx] +@@ -101,6 +101,10 @@ files. + Specify which mailbox to load. + .IP "-F \fImuttrc\fP" + Specify an initialization file to read instead of ~/.muttrc ++.IP "-g \fIserver\fP" ++Start Mutt with a listing of subscribed newsgroups at specified newsserver. ++.IP "-G" ++Start Mutt with a listing of subscribed newsgroups. + .IP "-h" + Display help. + .IP "-H \fIdraft\fP" +diff -udprP mutt-1.5.20.orig/functions.h mutt-1.5.20/functions.h +--- mutt-1.5.20.orig/functions.h 2009-04-30 08:36:17.000000000 +0300 ++++ mutt-1.5.20/functions.h 2009-06-15 21:05:24.000000000 +0300 +@@ -88,6 +88,10 @@ struct binding_t OpMain[] = { /* map: in + { "break-thread", OP_MAIN_BREAK_THREAD, "#" }, + { "change-folder", OP_MAIN_CHANGE_FOLDER, "c" }, + { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" }, ++#ifdef USE_NNTP ++ { "change-newsgroup", OP_MAIN_CHANGE_GROUP, "i" }, ++ { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, "\033i" }, ++#endif + { "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL }, + { "collapse-thread", OP_MAIN_COLLAPSE_THREAD, "\033v" }, + { "collapse-all", OP_MAIN_COLLAPSE_ALL, "\033V" }, +@@ -101,7 +105,15 @@ struct binding_t OpMain[] = { /* map: in + { "edit", OP_EDIT_MESSAGE, "e" }, + { "edit-type", OP_EDIT_TYPE, "\005" }, + { "forward-message", OP_FORWARD_MESSAGE, "f" }, +- { "flag-message", OP_FLAG_MESSAGE, "F" }, ++#ifdef USE_NNTP ++ { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" }, ++ { "followup-message", OP_FOLLOWUP, "F" }, ++ { "get-children", OP_GET_CHILDREN, NULL }, ++ { "get-message", OP_GET_MESSAGE, "\007" }, ++ { "get-parent", OP_GET_PARENT, "\033G" }, ++ { "reconstruct-thread", OP_RECONSTRUCT_THREAD, NULL }, ++#endif ++ { "flag-message", OP_FLAG_MESSAGE, "\033f" }, + { "group-reply", OP_GROUP_REPLY, "g" }, + #ifdef USE_POP + { "fetch-mail", OP_MAIN_FETCH_MAIL, "G" }, +@@ -127,6 +139,9 @@ struct binding_t OpMain[] = { /* map: in + { "sort-mailbox", OP_SORT, "o" }, + { "sort-reverse", OP_SORT_REVERSE, "O" }, + { "print-message", OP_PRINT, "p" }, ++#ifdef USE_NNTP ++ { "post-message", OP_POST, "P" }, ++#endif + { "previous-thread", OP_MAIN_PREV_THREAD, "\020" }, + { "previous-subthread", OP_MAIN_PREV_SUBTHREAD, "\033p" }, + { "recall-message", OP_RECALL_MESSAGE, "R" }, +@@ -146,6 +161,10 @@ struct binding_t OpMain[] = { /* map: in + { "show-version", OP_VERSION, "V" }, + { "set-flag", OP_MAIN_SET_FLAG, "w" }, + { "clear-flag", OP_MAIN_CLEAR_FLAG, "W" }, ++ { "toggle-read", OP_TOGGLE_READ, "X" }, ++#ifdef USE_NNTP ++ { "catchup", OP_CATCHUP, "y" }, ++#endif + { "display-message", OP_DISPLAY_MESSAGE, M_ENTER_S }, + { "buffy-list", OP_BUFFY_LIST, "." }, + { "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" }, +@@ -157,7 +176,7 @@ struct binding_t OpMain[] = { /* map: in + { "previous-new-then-unread", OP_MAIN_PREV_NEW_THEN_UNREAD, "\033\t" }, + { "next-unread", OP_MAIN_NEXT_UNREAD, NULL }, + { "previous-unread", OP_MAIN_PREV_UNREAD, NULL }, +- { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" }, ++ { "parent-message", OP_MAIN_PARENT_MESSAGE, NULL }, + + + { "extract-keys", OP_EXTRACT_KEYS, "\013" }, +@@ -177,6 +196,10 @@ struct binding_t OpPager[] = { /* map: p + { "bounce-message", OP_BOUNCE_MESSAGE, "b" }, + { "change-folder", OP_MAIN_CHANGE_FOLDER, "c" }, + { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" }, ++#ifdef USE_NNTP ++ { "change-newsgroup", OP_MAIN_CHANGE_GROUP, "i" }, ++ { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, "\033i" }, ++#endif + { "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL }, + { "copy-message", OP_COPY_MESSAGE, "C" }, + { "decode-copy", OP_DECODE_COPY, "\033C" }, +@@ -187,8 +210,12 @@ struct binding_t OpPager[] = { /* map: p + { "clear-flag", OP_MAIN_CLEAR_FLAG, "W" }, + { "edit", OP_EDIT_MESSAGE, "e" }, + { "edit-type", OP_EDIT_TYPE, "\005" }, ++#ifdef USE_NNTP ++ { "followup-message", OP_FOLLOWUP, "F" }, ++ { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" }, ++#endif + { "forward-message", OP_FORWARD_MESSAGE, "f" }, +- { "flag-message", OP_FLAG_MESSAGE, "F" }, ++ { "flag-message", OP_FLAG_MESSAGE, "\033f" }, + { "group-reply", OP_GROUP_REPLY, "g" }, + #ifdef USE_IMAP + { "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL }, +@@ -207,6 +234,9 @@ struct binding_t OpPager[] = { /* map: p + { "next-thread", OP_MAIN_NEXT_THREAD, "\016" }, + { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" }, + { "print-message", OP_PRINT, "p" }, ++#ifdef USE_NNTP ++ { "post-message", OP_POST, "P" }, ++#endif + { "previous-thread", OP_MAIN_PREV_THREAD, "\020" }, + { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" }, + { "quit", OP_QUIT, "Q" }, +@@ -254,7 +284,7 @@ struct binding_t OpPager[] = { /* map: p + { "half-down", OP_HALF_DOWN, NULL }, + { "previous-line", OP_PREV_LINE, NULL }, + { "bottom", OP_PAGER_BOTTOM, NULL }, +- { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" }, ++ { "parent-message", OP_MAIN_PARENT_MESSAGE, NULL }, + + + +@@ -275,6 +305,10 @@ struct binding_t OpAttach[] = { /* map: + { "bounce-message", OP_BOUNCE_MESSAGE, "b" }, + { "display-toggle-weed", OP_DISPLAY_HEADERS, "h" }, + { "edit-type", OP_EDIT_TYPE, "\005" }, ++#ifdef USE_NNTP ++ { "followup-message", OP_FOLLOWUP, "F" }, ++ { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" }, ++#endif + { "print-entry", OP_PRINT, "p" }, + { "save-entry", OP_SAVE, "s" }, + { "pipe-entry", OP_PIPE, "|" }, +@@ -300,6 +334,7 @@ struct binding_t OpAttach[] = { /* map: + struct binding_t OpCompose[] = { /* map: compose */ + { "attach-file", OP_COMPOSE_ATTACH_FILE, "a" }, + { "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" }, ++ { "attach-news-message",OP_COMPOSE_ATTACH_NEWS_MESSAGE,"\033a" }, + { "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" }, + { "edit-cc", OP_COMPOSE_EDIT_CC, "c" }, + { "copy-file", OP_SAVE, "C" }, +@@ -319,6 +354,11 @@ struct binding_t OpCompose[] = { /* map: + { "print-entry", OP_PRINT, "l" }, + { "edit-mime", OP_COMPOSE_EDIT_MIME, "m" }, + { "new-mime", OP_COMPOSE_NEW_MIME, "n" }, ++#ifdef USE_NNTP ++ { "edit-newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS, "N" }, ++ { "edit-followup-to", OP_COMPOSE_EDIT_FOLLOWUP_TO, "o" }, ++ { "edit-x-comment-to",OP_COMPOSE_EDIT_X_COMMENT_TO, "x" }, ++#endif + { "postpone-message", OP_COMPOSE_POSTPONE_MESSAGE, "P" }, + { "edit-reply-to", OP_COMPOSE_EDIT_REPLY_TO, "r" }, + { "rename-file", OP_COMPOSE_RENAME_FILE, "R" }, +@@ -370,14 +410,25 @@ struct binding_t OpBrowser[] = { /* map: + { "select-new", OP_BROWSER_NEW_FILE, "N" }, + { "check-new", OP_CHECK_NEW, NULL }, + { "toggle-mailboxes", OP_TOGGLE_MAILBOXES, "\t" }, ++#ifdef USE_NNTP ++ { "reload-active", OP_LOAD_ACTIVE, "g" }, ++ { "subscribe-pattern", OP_SUBSCRIBE_PATTERN, "S" }, ++ { "unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN, "U" }, ++ { "catchup", OP_CATCHUP, "y" }, ++ { "uncatchup", OP_UNCATCHUP, "Y" }, ++#endif + { "view-file", OP_BROWSER_VIEW_FILE, " " }, + { "buffy-list", OP_BUFFY_LIST, "." }, + #ifdef USE_IMAP + { "create-mailbox", OP_CREATE_MAILBOX, "C" }, + { "delete-mailbox", OP_DELETE_MAILBOX, "d" }, + { "rename-mailbox", OP_RENAME_MAILBOX, "r" }, ++#endif ++#if defined USE_IMAP || defined USE_NNTP + { "subscribe", OP_BROWSER_SUBSCRIBE, "s" }, + { "unsubscribe", OP_BROWSER_UNSUBSCRIBE, "u" }, ++#endif ++#ifdef USE_IMAP + { "toggle-subscribed", OP_BROWSER_TOGGLE_LSUB, "T" }, + #endif + { NULL, 0, NULL } +diff -udprP mutt-1.5.20.orig/globals.h mutt-1.5.20/globals.h +--- mutt-1.5.20.orig/globals.h 2009-06-03 23:48:31.000000000 +0300 ++++ mutt-1.5.20/globals.h 2009-06-15 21:05:24.000000000 +0300 +@@ -95,6 +95,15 @@ WHERE char *MixEntryFormat; + #endif + + WHERE char *Muttrc INITVAL (NULL); ++#ifdef USE_NNTP ++WHERE char *NewsCacheDir; ++WHERE char *GroupFormat; ++WHERE char *Inews; ++WHERE char *NewsServer; ++WHERE char *NntpUser; ++WHERE char *NntpPass; ++WHERE char *NewsRc; ++#endif + WHERE char *Outbox; + WHERE char *Pager; + WHERE char *PagerFmt; +@@ -188,6 +197,11 @@ extern unsigned char QuadOptions[]; + + WHERE unsigned short Counter INITVAL (0); + ++#ifdef USE_NNTP ++WHERE short NewsPollTimeout; ++WHERE short NntpContext; ++#endif ++ + WHERE short ConnectTimeout; + WHERE short HistSize; + WHERE short MenuContext; +diff -udprP mutt-1.5.20.orig/hash.c mutt-1.5.20/hash.c +--- mutt-1.5.20.orig/hash.c 2009-03-31 09:52:43.000000000 +0300 ++++ mutt-1.5.20/hash.c 2009-06-15 21:19:59.000000000 +0300 +@@ -57,6 +57,7 @@ HASH *hash_create (int nelem, int lower) + if (nelem == 0) + nelem = 2; + table->nelem = nelem; ++ table->curnelem = 0; + table->table = safe_calloc (nelem, sizeof (struct hash_elem *)); + if (lower) + { +@@ -71,6 +72,29 @@ HASH *hash_create (int nelem, int lower) + return table; + } + ++HASH *hash_resize (HASH *ptr, int nelem, int lower) ++{ ++ HASH *table; ++ struct hash_elem *elem, *tmp; ++ int i; ++ ++ table = hash_create (nelem, lower); ++ ++ for (i = 0; i < ptr->nelem; i++) ++ { ++ for (elem = ptr->table[i]; elem; ) ++ { ++ tmp = elem; ++ elem = elem->next; ++ hash_insert (table, tmp->key, tmp->data, 1); ++ FREE (&tmp); ++ } ++ } ++ FREE (&ptr->table); ++ FREE (&ptr); ++ return table; ++} ++ + /* table hash table to update + * key key to hash on + * data data to associate with `key' +@@ -90,6 +114,7 @@ int hash_insert (HASH * table, const cha + { + ptr->next = table->table[h]; + table->table[h] = ptr; ++ table->curnelem++; + } + else + { +@@ -112,6 +137,7 @@ int hash_insert (HASH * table, const cha + else + table->table[h] = ptr; + ptr->next = tmp; ++ table->curnelem++; + } + return h; + } +@@ -142,6 +168,7 @@ void hash_delete_hash (HASH * table, int + if (destroy) + destroy (ptr->data); + FREE (&ptr); ++ table->curnelem--; + + ptr = *last; + } +diff -udprP mutt-1.5.20.orig/hash.h mutt-1.5.20/hash.h +--- mutt-1.5.20.orig/hash.h 2009-03-31 09:52:43.000000000 +0300 ++++ mutt-1.5.20/hash.h 2009-06-15 21:05:24.000000000 +0300 +@@ -28,7 +28,7 @@ struct hash_elem + + typedef struct + { +- int nelem; ++ int nelem, curnelem; + struct hash_elem **table; + unsigned int (*hash_string)(const unsigned char *, unsigned int); + int (*cmp_string)(const char *, const char *); +@@ -41,6 +41,7 @@ HASH; + + HASH *hash_create (int nelem, int lower); + int hash_insert (HASH * table, const char *key, void *data, int allow_dup); ++HASH *hash_resize (HASH * table, int nelem, int lower); + void *hash_find_hash (const HASH * table, int hash, const char *key); + void hash_delete_hash (HASH * table, int hash, const char *key, const void *data, + void (*destroy) (void *)); +diff -udprP mutt-1.5.20.orig/hdrline.c mutt-1.5.20/hdrline.c +--- mutt-1.5.20.orig/hdrline.c 2009-04-13 19:24:55.000000000 +0300 ++++ mutt-1.5.20/hdrline.c 2009-06-15 21:05:24.000000000 +0300 +@@ -211,6 +211,7 @@ int mutt_user_is_recipient (HEADER *h) + * %E = number of messages in current thread + * %f = entire from line + * %F = like %n, unless from self ++ * %g = newsgroup name (if compiled with nntp support) + * %i = message-id + * %l = number of lines in the message + * %L = like %F, except `lists' are displayed first +@@ -219,12 +220,14 @@ int mutt_user_is_recipient (HEADER *h) + * %N = score + * %O = like %L, except using address instead of name + * %P = progress indicator for builtin pager ++ * %R = `x-comment-to:' field (if present and compiled with nntp support) + * %s = subject + * %S = short message status (e.g., N/O/D/!/r/-) + * %t = `to:' field (recipients) + * %T = $to_chars + * %u = user (login) name of author + * %v = first name of author, unless from self ++ * %W = where user is (organization) + * %X = number of MIME attachments + * %y = `x-label:' field (if present) + * %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label) +@@ -457,6 +460,12 @@ hdr_format_str (char *dest, + + break; + ++#ifdef USE_NNTP ++ case 'g': ++ mutt_format_s (dest, destlen, prefix, hdr->env->newsgroups ? hdr->env->newsgroups : ""); ++ break; ++#endif ++ + case 'i': + mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : ""); + break; +@@ -548,6 +557,15 @@ hdr_format_str (char *dest, + strfcpy(dest, NONULL(hfi->pager_progress), destlen); + break; + ++#ifdef USE_NNTP ++ case 'R': ++ if (!optional) ++ mutt_format_s (dest, destlen, prefix, hdr->env->x_comment_to ? hdr->env->x_comment_to : ""); ++ else if (!hdr->env->x_comment_to) ++ optional = 0; ++ break; ++#endif ++ + case 's': + + if (flags & M_FORMAT_TREE && !hdr->collapsed) +@@ -637,6 +655,13 @@ hdr_format_str (char *dest, + mutt_format_s (dest, destlen, prefix, buf2); + break; + ++ case 'W': ++ if (!optional) ++ mutt_format_s (dest, destlen, prefix, hdr->env->organization ? hdr->env->organization : ""); ++ else if (!hdr->env->organization) ++ optional = 0; ++ break; ++ + case 'Z': + + ch = ' '; +diff -udprP mutt-1.5.20.orig/headers.c mutt-1.5.20/headers.c +--- mutt-1.5.20.orig/headers.c 2009-04-30 08:36:17.000000000 +0300 ++++ mutt-1.5.20/headers.c 2009-06-15 21:17:07.000000000 +0300 +@@ -114,6 +114,9 @@ void mutt_edit_headers (const char *edit + $edit_headers set, we remove References: as they're likely invalid; + we can simply compare strings as we don't generate References for + multiple Message-Ids in IRT anyways */ ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++#endif + if (!n->in_reply_to || (msg->env->in_reply_to && + mutt_strcmp (n->in_reply_to->data, + msg->env->in_reply_to->data) != 0)) +diff -udprP mutt-1.5.20.orig/init.c mutt-1.5.20/init.c +--- mutt-1.5.20.orig/init.c 2009-06-01 19:29:32.000000000 +0300 ++++ mutt-1.5.20/init.c 2009-06-15 21:05:24.000000000 +0300 +@@ -2966,6 +2966,28 @@ void mutt_init (int skip_sys_rc, LIST *c + else + Fqdn = safe_strdup(NONULL(Hostname)); + ++#ifdef USE_NNTP ++ { ++ FILE *f; ++ char *i; ++ ++ if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) ++ { ++ buffer[0] = '\0'; ++ fgets (buffer, sizeof (buffer), f); ++ p = &buffer; ++ SKIPWS (p); ++ i = p; ++ while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') && (*i != '\n')) i++; ++ *i = '\0'; ++ NewsServer = safe_strdup (p); ++ fclose (f); ++ } ++ } ++ if ((p = getenv ("NNTPSERVER"))) ++ NewsServer = safe_strdup (p); ++#endif ++ + if ((p = getenv ("MAIL"))) + Spoolfile = safe_strdup (p); + else if ((p = getenv ("MAILDIR"))) +diff -udprP mutt-1.5.20.orig/init.h mutt-1.5.20/init.h +--- mutt-1.5.20.orig/init.h 2009-06-14 00:35:21.000000000 +0300 ++++ mutt-1.5.20/init.h 2009-06-15 21:15:03.000000000 +0300 +@@ -176,6 +176,20 @@ struct option_t MuttVars[] = { + ** If \fIset\fP, Mutt will prompt you for carbon-copy (Cc) recipients before + ** editing the body of an outgoing message. + */ ++#ifdef USE_NNTP ++ { "ask_follow_up", DT_BOOL, R_NONE, OPTASKFOLLOWUP, 0 }, ++ /* ++ ** .pp ++ ** If set, Mutt will prompt you for follow-up groups before editing ++ ** the body of an outgoing message. ++ */ ++ { "ask_x_comment_to", DT_BOOL, R_NONE, OPTASKXCOMMENTTO, 0 }, ++ /* ++ ** .pp ++ ** If set, Mutt will prompt you for x-comment-to field before editing ++ ** the body of an outgoing message. ++ */ ++#endif + { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL 0}, + /* + ** .pp +@@ -322,6 +336,14 @@ struct option_t MuttVars[] = { + ** follow these menus. The option is \fIunset\fP by default because many + ** visual terminals don't permit making the cursor invisible. + */ ++#ifdef USE_NNTP ++ { "catchup_newsgroup", DT_QUAD, R_NONE, OPT_CATCHUP, M_ASKYES }, ++ /* ++ ** .pp ++ ** If this variable is \fIset\fP, Mutt will mark all articles in newsgroup ++ ** as read when you quit the newsgroup (catchup newsgroup). ++ */ ++#endif + #if defined(USE_SSL) + { "certificate_file", DT_PATH, R_NONE, UL &SslCertFile, UL "~/.mutt_certificates" }, + /* +@@ -797,6 +819,16 @@ struct option_t MuttVars[] = { + ** sent to both the list and your address, resulting in two copies + ** of the same email for you. + */ ++#ifdef USE_NNTP ++ { "followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, M_ASKYES }, ++ /* ++ ** .pp ++ ** If this variable is \fIset\fP and the keyword "poster" is present in ++ ** \fIFollowup-To\fP header, follow-up to newsgroup function is not ++ ** permitted. The message will be mailed to the submitter of the ++ ** message via mail. ++ */ ++#endif + { "force_name", DT_BOOL, R_NONE, OPTFORCENAME, 0 }, + /* + ** .pp +@@ -879,6 +911,27 @@ struct option_t MuttVars[] = { + ** a regular expression that will match the whole name so mutt will expand + ** ``Franklin'' to ``Franklin, Steve''. + */ ++#ifdef USE_NNTP ++ { "group_index_format", DT_STR, R_BOTH, UL &GroupFormat, UL "%4C %M%N %5s %-45.45f %d" }, ++ /* ++ ** .pp ++ ** This variable allows you to customize the newsgroup browser display to ++ ** your personal taste. This string is similar to ``$index_format'', but ++ ** has its own set of printf()-like sequences: ++ ** .pp ++ ** .ts ++ ** %C current newsgroup number ++ ** %d description of newsgroup (becomes from server) ++ ** %f newsgroup name ++ ** %M - if newsgroup not allowed for direct post (moderated for example) ++ ** %N N if newsgroup is new, u if unsubscribed, blank otherwise ++ ** %n number of new articles in newsgroup ++ ** %s number of unread articles in newsgroup ++ ** %>X right justify the rest of the string and pad with character "X" ++ ** %|X pad to the end of the line with character "X" ++ ** .te ++ */ ++#endif + { "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 }, + /* + */ +@@ -1255,6 +1308,7 @@ struct option_t MuttVars[] = { + ** .dt %E .dd number of messages in current thread + ** .dt %f .dd sender (address + real name), either From: or Return-Path: + ** .dt %F .dd author name, or recipient name if the message is from you ++ ** .dt %g .dd newsgroup name (if compiled with nntp support) + ** .dt %H .dd spam attribute(s) of this message + ** .dt %i .dd message-id of the current message + ** .dt %l .dd number of lines in the message (does not work with maildir, +@@ -1270,12 +1324,14 @@ struct option_t MuttVars[] = { + ** stashed the message: list name or recipient name + ** if not sent to a list + ** .dt %P .dd progress indicator for the builtin pager (how much of the file has been displayed) ++ ** .dt %R .dd `x-comment-to:' field (if present and compiled with nntp support) + ** .dt %s .dd subject of the message + ** .dt %S .dd status of the message (``N''/``D''/``d''/``!''/``r''/\(as) + ** .dt %t .dd ``To:'' field (recipients) + ** .dt %T .dd the appropriate character from the $$to_chars string + ** .dt %u .dd user (login) name of the author + ** .dt %v .dd first name of the author, or the recipient if the message is from you ++ ** .dt %W .dd name of organization of author (`organization:' field) + ** .dt %X .dd number of attachments + ** (please see the ``$attachments'' section for possible speed effects) + ** .dt %y .dd ``X-Label:'' field, if present +@@ -1310,6 +1366,21 @@ struct option_t MuttVars[] = { + ** Note that these expandos are supported in + ** ``$save-hook'', ``$fcc-hook'' and ``$fcc-save-hook'', too. + */ ++#ifdef USE_NNTP ++ { "inews", DT_PATH, R_NONE, UL &Inews, UL "" }, ++ /* ++ ** .pp ++ ** If set, specifies the program and arguments used to deliver news posted ++ ** by Mutt. Otherwise, mutt posts article using current connection to ++ ** news server. The following printf-style sequence is understood: ++ ** .pp ++ ** .ts ++ ** %s newsserver name ++ ** .te ++ ** .pp ++ ** Example: set inews="/usr/local/bin/inews -hS" ++ */ ++#endif + { "ispell", DT_PATH, R_NONE, UL &Ispell, UL ISPELL }, + /* + ** .pp +@@ -1533,6 +1604,15 @@ struct option_t MuttVars[] = { + ** menu, attachments which cannot be decoded in a reasonable manner will + ** be attached to the newly composed message if this option is \fIset\fP. + */ ++#ifdef USE_NNTP ++ { "mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, 1 }, ++ /* ++ ** .pp ++ ** If \fIunset\fP, 8-bit ``subject:'' line in article header will not be ++ ** encoded according to RFC2047 to base64. This is useful when message ++ ** is Usenet article, because MIME for news is nonstandard feature. ++ */ ++#endif + #ifdef MIXMASTER + { "mix_entry_format", DT_STR, R_NONE, UL &MixEntryFormat, UL "%4n %c %-16s %a" }, + /* +@@ -1580,6 +1660,77 @@ struct option_t MuttVars[] = { + ** See also $$read_inc, $$write_inc and $$net_inc. + */ + #endif ++#ifdef USE_NNTP ++ { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" }, ++ /* ++ ** .pp ++ ** This variable pointing to directory where Mutt will save cached news ++ ** articles headers in. If \fIunset\fP, headers will not be saved at all ++ ** and will be reloaded each time when you enter to newsgroup. ++ */ ++ { "news_server", DT_STR, R_NONE, UL &NewsServer, 0 }, ++ /* ++ ** .pp ++ ** This variable specifies domain name or address of NNTP server. It ++ ** defaults to the newsserver specified in the environment variable ++ ** $$$NNTPSERVER or contained in the file /etc/nntpserver. You can also ++ ** specify username and an alternative port for each newsserver, ie: ++ ** .pp ++ ** [news[s]://][username[:password]@]newsserver[:port] ++ */ ++ { "newsrc", DT_PATH, R_NONE, UL &NewsRc, UL "~/.newsrc" }, ++ /* ++ ** .pp ++ ** The file, containing info about subscribed newsgroups - names and ++ ** indexes of read articles. The following printf-style sequence ++ ** is understood: ++ ** .pp ++ ** .ts ++ ** %s newsserver name ++ ** .te ++ */ ++ { "nntp_context", DT_NUM, R_NONE, UL &NntpContext, 1000 }, ++ /* ++ ** .pp ++ ** This variable defines number of articles which will be in index when ++ ** newsgroup entered. If active newsgroup have more articles than this ++ ** number, oldest articles will be ignored. Also controls how many ++ ** articles headers will be saved in cache when you quit newsgroup. ++ */ ++ { "nntp_load_description", DT_BOOL, R_NONE, OPTLOADDESC, 1 }, ++ /* ++ ** .pp ++ ** This variable controls whether or not descriptions for each newsgroup ++ ** must be loaded when newsgroup is added to list (first time list ++ ** loading or new newsgroup adding). ++ */ ++ { "nntp_user", DT_STR, R_NONE, UL &NntpUser, UL "" }, ++ /* ++ ** .pp ++ ** Your login name on the NNTP server. If \fIunset\fP and NNTP server requires ++ ** authentification, Mutt will prompt you for your account name when you ++ ** connect to newsserver. ++ */ ++ { "nntp_pass", DT_STR, R_NONE, UL &NntpPass, UL "" }, ++ /* ++ ** .pp ++ ** Your password for NNTP account. ++ */ ++ { "nntp_poll", DT_NUM, R_NONE, UL &NewsPollTimeout, 60 }, ++ /* ++ ** .pp ++ ** The time in seconds until any operations on newsgroup except post new ++ ** article will cause recheck for new news. If set to 0, Mutt will ++ ** recheck newsgroup on each operation in index (stepping, read article, ++ ** etc.). ++ */ ++ { "nntp_reconnect", DT_QUAD, R_NONE, OPT_NNTPRECONNECT, M_ASKYES }, ++ /* ++ ** .pp ++ ** Controls whether or not Mutt will try to reconnect to newsserver when ++ ** connection lost. ++ */ ++#endif + { "pager", DT_PATH, R_NONE, UL &Pager, UL "builtin" }, + /* + ** .pp +@@ -2079,6 +2230,16 @@ struct option_t MuttVars[] = { + { "post_indent_str", DT_SYN, R_NONE, UL "post_indent_string", 0 }, + /* + */ ++#ifdef USE_NNTP ++ { "post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, M_ASKYES }, ++ /* ++ ** .pp ++ ** If set to \fIyes\fP, Mutt will post article to newsgroup that have ++ ** not permissions to posting (e.g. moderated). \fBNote:\fP if newsserver ++ ** does not support posting to that newsgroup or totally read-only, that ++ ** posting will not have an effect. ++ */ ++#endif + { "postpone", DT_QUAD, R_NONE, OPT_POSTPONE, M_ASKYES }, + /* + ** .pp +@@ -2479,6 +2640,28 @@ struct option_t MuttVars[] = { + ** Command to use when spawning a subshell. By default, the user's login + ** shell from \fC/etc/passwd\fP is used. + */ ++#ifdef USE_NNTP ++ { "save_unsubscribed",DT_BOOL, R_NONE, OPTSAVEUNSUB, 0 }, ++ /* ++ ** .pp ++ ** When \fIset\fP, info about unsubscribed newsgroups will be saved into ++ ** ``newsrc'' file and into cache. ++ */ ++ { "show_new_news", DT_BOOL, R_NONE, OPTSHOWNEWNEWS, 1 }, ++ /* ++ ** .pp ++ ** If \fIset\fP, newsserver will be asked for new newsgroups on entering ++ ** the browser. Otherwise, it will be done only once for a newsserver. ++ ** Also controls whether or not number of new articles of subscribed ++ ** newsgroups will be then checked. ++ */ ++ { "show_only_unread", DT_BOOL, R_NONE, OPTSHOWONLYUNREAD, 0 }, ++ /* ++ ** .pp ++ ** If \fIset\fP, only subscribed newsgroups that contain unread articles ++ ** will be displayed in browser. ++ */ ++#endif + { "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 }, + /* + ** .pp +@@ -3337,6 +3520,14 @@ struct option_t MuttVars[] = { + ** Also see the $$read_inc, $$net_inc and $$time_inc variables and the + ** ``$tuning'' section of the manual for performance considerations. + */ ++#ifdef USE_NNTP ++ { "x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 }, ++ /* ++ ** .pp ++ ** If \fIset\fP, Mutt will add ``X-Comment-To:'' field (that contains full ++ ** name of original article author) to article that followuped to newsgroup. ++ */ ++#endif + /*--*/ + { NULL, 0, 0, 0, 0 } + }; +diff -udprP mutt-1.5.20.orig/keymap.c mutt-1.5.20/keymap.c +--- mutt-1.5.20.orig/keymap.c 2008-11-29 23:09:10.000000000 +0200 ++++ mutt-1.5.20/keymap.c 2009-06-15 21:05:24.000000000 +0300 +@@ -654,7 +654,6 @@ void km_init (void) + km_bindkey ("", MENU_MAIN, OP_DISPLAY_MESSAGE); + + km_bindkey ("x", MENU_PAGER, OP_EXIT); +- km_bindkey ("i", MENU_PAGER, OP_EXIT); + km_bindkey ("", MENU_PAGER, OP_PREV_LINE); + km_bindkey ("", MENU_PAGER, OP_NEXT_PAGE); + km_bindkey ("", MENU_PAGER, OP_PREV_PAGE); +diff -udprP mutt-1.5.20.orig/mailbox.h mutt-1.5.20/mailbox.h +--- mutt-1.5.20.orig/mailbox.h 2009-04-30 08:36:17.000000000 +0300 ++++ mutt-1.5.20/mailbox.h 2009-06-15 21:05:24.000000000 +0300 +@@ -74,6 +74,9 @@ int mx_is_imap (const char *); + #ifdef USE_POP + int mx_is_pop (const char *); + #endif ++#ifdef USE_NNTP ++int mx_is_nntp (const char *); ++#endif + + int mx_access (const char*, int); + int mx_check_empty (const char *); +diff -udprP mutt-1.5.20.orig/main.c mutt-1.5.20/main.c +--- mutt-1.5.20.orig/main.c 2009-06-01 19:29:32.000000000 +0300 ++++ mutt-1.5.20/main.c 2009-06-15 21:05:24.000000000 +0300 +@@ -60,6 +60,10 @@ + #include + #endif + ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif ++ + static const char *ReachingUs = N_("\ + To contact the developers, please mail to .\n\ + To report a bug, please visit http://bugs.mutt.org/.\n"); +@@ -133,6 +137,8 @@ options:\n\ + " -e \tspecify a command to be executed after initialization\n\ + -f \tspecify which mailbox to read\n\ + -F \tspecify an alternate muttrc file\n\ ++ -g \tspecify a newsserver (if compiled with NNTP)\n\ ++ -G\t\tselect a newsgroup (if compiled with NNTP)\n\ + -H \tspecify a draft file to read header and body from\n\ + -i \tspecify a file which Mutt should include in the body\n\ + -m \tspecify a default mailbox type\n\ +@@ -255,6 +261,12 @@ static void show_version (void) + "-USE_POP " + #endif + ++#ifdef USE_NNTP ++ "+USE_NNTP " ++#else ++ "-USE_NNTP " ++#endif ++ + #ifdef USE_IMAP + "+USE_IMAP " + #else +@@ -522,6 +534,9 @@ static void start_curses (void) + #define M_NOSYSRC (1<<2) /* -n */ + #define M_RO (1<<3) /* -R */ + #define M_SELECT (1<<4) /* -y */ ++#ifdef USE_NNTP ++#define M_NEWS (1<<5) /* -g and -G */ ++#endif + + int main (int argc, char **argv) + { +@@ -594,7 +609,11 @@ int main (int argc, char **argv) + argv[nargc++] = argv[optind]; + } + ++#ifdef USE_NNTP ++ if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:g:GH:s:i:hm:npQ:RvxyzZ")) != EOF) ++#else + if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:H:s:i:hm:npQ:RvxyzZ")) != EOF) ++#endif + switch (i) + { + case 'A': +@@ -691,6 +710,20 @@ int main (int argc, char **argv) + flags |= M_SELECT; + break; + ++#ifdef USE_NNTP ++ case 'g': /* Specify a newsserver */ ++ { ++ char buf[LONG_STRING]; ++ ++ snprintf (buf, sizeof (buf), "set news_server=%s", optarg); ++ commands = mutt_add_list (commands, buf); ++ } ++ ++ case 'G': /* List of newsgroups */ ++ flags |= M_SELECT | M_NEWS; ++ break; ++#endif ++ + case 'z': + flags |= M_IGNORE; + break; +@@ -978,6 +1011,18 @@ int main (int argc, char **argv) + } + else if (flags & M_SELECT) + { ++#ifdef USE_NNTP ++ if (flags & M_NEWS) ++ { ++ set_option (OPTNEWS); ++ if(!(CurrentNewsSrv = mutt_select_newsserver (NewsServer))) ++ { ++ mutt_endwin (Errorbuf); ++ exit (1); ++ } ++ } ++ else ++#endif + if (!Incoming) { + mutt_endwin _("No incoming mailboxes defined."); + exit (1); +@@ -993,6 +1038,15 @@ int main (int argc, char **argv) + + if (!folder[0]) + strfcpy (folder, NONULL(Spoolfile), sizeof (folder)); ++ ++#ifdef USE_NNTP ++ if (option (OPTNEWS)) ++ { ++ unset_option (OPTNEWS); ++ nntp_expand_path (folder, sizeof (folder), &CurrentNewsSrv->conn->account); ++ } ++ else ++#endif + mutt_expand_path (folder, sizeof (folder)); + + mutt_str_replace (&CurrentFolder, folder); +diff -udprP mutt-1.5.20.orig/mutt.h mutt-1.5.20/mutt.h +--- mutt-1.5.20.orig/mutt.h 2009-06-13 01:15:42.000000000 +0300 ++++ mutt-1.5.20/mutt.h 2009-06-15 21:05:24.000000000 +0300 +@@ -229,6 +229,9 @@ enum + M_PGP_KEY, + M_XLABEL, + M_MIMEATTACH, ++#ifdef USE_NNTP ++ M_NEWSGROUPS, ++#endif + + /* Options for Mailcap lookup */ + M_EDIT, +@@ -285,6 +288,12 @@ enum + #endif + OPT_SUBJECT, + OPT_VERIFYSIG, /* verify PGP signatures */ ++#ifdef USE_NNTP ++ OPT_TOMODERATED, ++ OPT_NNTPRECONNECT, ++ OPT_CATCHUP, ++ OPT_FOLLOWUPTOPOSTER, ++#endif /* USE_NNTP */ + + /* THIS MUST BE THE LAST VALUE. */ + OPT_MAX +@@ -300,6 +309,7 @@ enum + #define SENDMAILX (1<<6) + #define SENDKEY (1<<7) + #define SENDRESEND (1<<8) ++#define SENDNEWS (1<<9) + + /* flags to _mutt_select_file() */ + #define M_SEL_BUFFY (1<<0) +@@ -319,6 +329,8 @@ enum + OPTASCIICHARS, + OPTASKBCC, + OPTASKCC, ++ OPTASKFOLLOWUP, ++ OPTASKXCOMMENTTO, + OPTATTACHSPLIT, + OPTAUTOEDIT, + OPTAUTOTAG, +@@ -396,6 +408,9 @@ enum + OPTMETOO, + OPTMHPURGE, + OPTMIMEFORWDECODE, ++#ifdef USE_NNTP ++ OPTMIMESUBJECT, /* encode subject line with RFC2047 */ ++#endif + OPTNARROWTREE, + OPTPAGERSTOP, + OPTPIPEDECODE, +@@ -477,6 +492,16 @@ enum + OPTPGPAUTOINLINE, + OPTPGPREPLYINLINE, + ++ /* news options */ ++ ++#ifdef USE_NNTP ++ OPTSHOWNEWNEWS, ++ OPTSHOWONLYUNREAD, ++ OPTSAVEUNSUB, ++ OPTLOADDESC, ++ OPTXCOMMENTTO, ++#endif /* USE_NNTP */ ++ + /* pseudo options */ + + OPTAUXSORT, /* (pseudo) using auxillary sort function */ +@@ -497,6 +522,7 @@ enum + OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */ + OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */ + OPTATTACHMSG, /* (pseudo) used by attach-message */ ++ OPTHIDEREAD, /* (pseudo) whether or not hide read messages */ + OPTKEEPQUIET, /* (pseudo) shut up the message and refresh + * functions while we are executing an + * external program. +@@ -507,6 +533,12 @@ enum + OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */ + OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */ + ++#ifdef USE_NNTP ++ OPTNEWS, /* (pseudo) used to change reader mode */ ++ OPTNEWSSEND, /* (pseudo) used to change behavior when posting */ ++ OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */ ++#endif ++ + OPTMAX + }; + +@@ -585,6 +617,13 @@ typedef struct envelope + char *supersedes; + char *date; + char *x_label; ++ char *organization; ++#ifdef USE_NNTP ++ char *newsgroups; ++ char *xref; ++ char *followup_to; ++ char *x_comment_to; ++#endif + BUFFER *spam; + LIST *references; /* message references (in reverse order) */ + LIST *in_reply_to; /* in-reply-to header content */ +@@ -751,6 +790,9 @@ typedef struct header + ENVELOPE *env; /* envelope information */ + BODY *content; /* list of MIME parts */ + char *path; ++#ifdef USE_NNTP ++ int article_num; ++#endif + + char *tree; /* character string to print thread tree */ + struct thread *thread; +@@ -766,7 +808,7 @@ typedef struct header + int refno; /* message number on server */ + #endif + +-#if defined USE_POP || defined USE_IMAP ++#if defined USE_POP || defined USE_IMAP || defined USE_NNTP + void *data; /* driver-specific data */ + #endif + +diff -udprP mutt-1.5.20.orig/muttlib.c mutt-1.5.20/muttlib.c +--- mutt-1.5.20.orig/muttlib.c 2009-05-19 03:11:35.000000000 +0300 ++++ mutt-1.5.20/muttlib.c 2009-06-15 21:05:24.000000000 +0300 +@@ -301,7 +301,7 @@ void mutt_free_header (HEADER **h) + #ifdef MIXMASTER + mutt_free_list (&(*h)->chain); + #endif +-#if defined USE_POP || defined USE_IMAP ++#if defined USE_POP || defined USE_IMAP || defined USE_NNTP + FREE (&(*h)->data); + #endif + FREE (h); /* __FREE_CHECKED__ */ +@@ -689,6 +689,13 @@ void mutt_free_envelope (ENVELOPE **p) + FREE (&(*p)->supersedes); + FREE (&(*p)->date); + FREE (&(*p)->x_label); ++ FREE (&(*p)->organization); ++#ifdef USE_NNTP ++ FREE (&(*p)->newsgroups); ++ FREE (&(*p)->xref); ++ FREE (&(*p)->followup_to); ++ FREE (&(*p)->x_comment_to); ++#endif + + mutt_buffer_free (&(*p)->spam); + +@@ -1470,6 +1477,14 @@ int mutt_save_confirm (const char *s, st + } + } + ++#ifdef USE_NNTP ++ if (magic == M_NNTP) ++ { ++ mutt_error _("Can't save message to newsserver."); ++ return 0; ++ } ++#endif ++ + if (stat (s, st) != -1) + { + if (magic == -1) +diff -udprP mutt-1.5.20.orig/mx.c mutt-1.5.20/mx.c +--- mutt-1.5.20.orig/mx.c 2009-06-11 07:29:41.000000000 +0300 ++++ mutt-1.5.20/mx.c 2009-06-15 21:05:24.000000000 +0300 +@@ -343,6 +343,22 @@ int mx_is_pop (const char *p) + } + #endif + ++#ifdef USE_NNTP ++int mx_is_nntp (const char *p) ++{ ++ url_scheme_t scheme; ++ ++ if (!p) ++ return 0; ++ ++ scheme = url_check_scheme (p); ++ if (scheme == U_NNTP || scheme == U_NNTPS) ++ return 1; ++ ++ return 0; ++} ++#endif ++ + int mx_get_magic (const char *path) + { + struct stat st; +@@ -360,6 +376,11 @@ int mx_get_magic (const char *path) + return M_POP; + #endif /* USE_POP */ + ++#ifdef USE_NNTP ++ if (mx_is_nntp (path)) ++ return M_NNTP; ++#endif /* USE_NNTP */ ++ + if (stat (path, &st) == -1) + { + dprint (1, (debugfile, "mx_get_magic(): unable to stat %s: %s (errno %d).\n", +@@ -669,6 +690,12 @@ CONTEXT *mx_open_mailbox (const char *pa + break; + #endif /* USE_POP */ + ++#ifdef USE_NNTP ++ case M_NNTP: ++ rc = nntp_open_mailbox (ctx); ++ break; ++#endif /* USE_NNTP */ ++ + default: + rc = -1; + break; +@@ -761,6 +788,12 @@ static int sync_mailbox (CONTEXT *ctx, i + rc = pop_sync_mailbox (ctx, index_hint); + break; + #endif /* USE_POP */ ++ ++#ifdef USE_NNTP ++ case M_NNTP: ++ rc = nntp_sync_mailbox (ctx); ++ break; ++#endif /* USE_NNTP */ + } + + #if 0 +@@ -787,6 +820,16 @@ int mx_close_mailbox (CONTEXT *ctx, int + + ctx->closing = 1; + ++#ifdef USE_NNTP ++ if (ctx->magic == M_NNTP) ++ { ++ int ret; ++ ++ ret = nntp_close_mailbox (ctx); ++ mx_fastclose_mailbox (ctx); ++ return ret; ++ } ++#endif + if (ctx->readonly || ctx->dontwrite) + { + /* mailbox is readonly or we don't want to write */ +@@ -1336,6 +1379,11 @@ int mx_check_mailbox (CONTEXT *ctx, int + case M_POP: + return (pop_check_mailbox (ctx, index_hint)); + #endif /* USE_POP */ ++ ++#ifdef USE_NNTP ++ case M_NNTP: ++ return (nntp_check_mailbox (ctx)); ++#endif /* USE_NNTP */ + } + } + +@@ -1396,6 +1444,15 @@ MESSAGE *mx_open_message (CONTEXT *ctx, + } + #endif /* USE_POP */ + ++#ifdef USE_NNTP ++ case M_NNTP: ++ { ++ if (nntp_fetch_message (msg, ctx, msgno) != 0) ++ FREE (&msg); ++ break; ++ } ++#endif /* USE_NNTP */ ++ + default: + dprint (1, (debugfile, "mx_open_message(): function not implemented for mailbox type %d.\n", ctx->magic)); + FREE (&msg); +@@ -1477,6 +1534,9 @@ int mx_close_message (MESSAGE **msg) + #ifdef USE_POP + || (*msg)->magic == M_POP + #endif ++#ifdef USE_NNTP ++ || (*msg)->magic == M_NNTP ++#endif + ) + { + r = safe_fclose (&(*msg)->fp); +diff -udprP mutt-1.5.20.orig/mx.h mutt-1.5.20/mx.h +--- mutt-1.5.20.orig/mx.h 2008-11-11 21:55:47.000000000 +0200 ++++ mutt-1.5.20/mx.h 2009-06-15 21:05:24.000000000 +0300 +@@ -40,6 +40,9 @@ enum + #ifdef USE_POP + , M_POP + #endif ++#ifdef USE_NNTP ++ , M_NNTP ++#endif + }; + + WHERE short DefaultMagic INITVAL (M_MBOX); +diff -udprP mutt-1.5.20.orig/newsrc.c mutt-1.5.20/newsrc.c +--- mutt-1.5.20.orig/newsrc.c 1970-01-01 03:00:00.000000000 +0300 ++++ mutt-1.5.20/newsrc.c 2009-06-15 21:05:24.000000000 +0300 +@@ -0,0 +1,1170 @@ ++/* ++ * Copyright (C) 1998 Brandon Long ++ * Copyright (C) 1999 Andrej Gritsenko ++ * Copyright (C) 2000-2009 Vsevolod Volkov ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#if HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include "mutt.h" ++#include "mutt_curses.h" ++#include "sort.h" ++#include "mx.h" ++#include "mime.h" ++#include "mailbox.h" ++#include "nntp.h" ++#include "rfc822.h" ++#include "rfc1524.h" ++#include "rfc2047.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++void nntp_add_to_list (NNTP_SERVER *s, NNTP_DATA *d) ++{ ++ LIST *l; ++ ++ if (!s || !d) ++ return; ++ ++ l = safe_calloc (1, sizeof (LIST)); ++ if (s->list) ++ s->tail->next = l; ++ else ++ s->list = l; ++ s->tail = l; ++ l->data = (void *) d; ++} ++ ++static int nntp_parse_newsrc_line (NNTP_SERVER *news, char *line) ++{ ++ NNTP_DATA *data; ++ char group[LONG_STRING]; ++ int x = 1; ++ char *p = line, *b, *h; ++ size_t len; ++ ++ while (*p) ++ { ++ if (*p++ == ',') ++ x++; ++ } ++ ++ p = line; ++ while (*p && (*p != ':' && *p != '!')) p++; ++ if (!*p) ++ return -1; ++ len = p + 1 - line; ++ if (len > sizeof (group)) ++ len = sizeof (group); ++ strfcpy (group, line, len); ++ if ((data = (NNTP_DATA *)hash_find (news->newsgroups, group)) == NULL) ++ { ++ data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1); ++ data->group = (char *) data + sizeof (NNTP_DATA); ++ strcpy (data->group, group); ++ data->nserv = news; ++ data->deleted = 1; ++ if (news->newsgroups->nelem < news->newsgroups->curnelem * 2) ++ news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0); ++ hash_insert (news->newsgroups, data->group, data, 0); ++ nntp_add_to_list (news, data); ++ } ++ else ++ FREE ((void **) &data->entries); ++ ++ data->rc = 1; ++ data->entries = safe_calloc (x*2, sizeof (NEWSRC_ENTRY)); ++ data->max = x*2; ++ ++ if (*p == ':') ++ data->subscribed = 1; ++ else ++ data->subscribed = 0; ++ ++ p++; ++ b = p; ++ x = 0; ++ while (*b) ++ { ++ while (*p && *p != ',' && *p != '\n') p++; ++ if (*p) ++ { ++ *p = '\0'; ++ p++; ++ } ++ if ((h = strchr(b, '-'))) ++ { ++ *h = '\0'; ++ h++; ++ data->entries[x].first = atoi(b); ++ data->entries[x].last = atoi(h); ++ } ++ else ++ { ++ data->entries[x].first = atoi(b); ++ data->entries[x].last = data->entries[x].first; ++ } ++ b = p; ++ if (data->entries[x].last != 0) ++ x++; ++ } ++ if (x && !data->lastMessage) ++ data->lastMessage = data->entries[x-1].last; ++ data->num = x; ++ mutt_newsgroup_stat (data); ++ dprint (2, (debugfile, "parse_line: Newsgroup %s\n", data->group)); ++ ++ return 0; ++} ++ ++static int slurp_newsrc (NNTP_SERVER *news) ++{ ++ FILE *fp; ++ char *buf; ++ struct stat sb; ++ ++ news->stat = stat (news->newsrc, &sb); ++ news->size = sb.st_size; ++ news->mtime = sb.st_mtime; ++ ++ if ((fp = safe_fopen (news->newsrc, "r")) == NULL) ++ return -1; ++ /* hmm, should we use dotlock? */ ++ if (mx_lock_file (news->newsrc, fileno (fp), 0, 0, 1)) ++ { ++ fclose (fp); ++ return -1; ++ } ++ ++ buf = safe_malloc (sb.st_size + 1); ++ while (sb.st_size && fgets (buf, sb.st_size + 1, fp)) ++ nntp_parse_newsrc_line (news, buf); ++ FREE (&buf); ++ ++ mx_unlock_file (news->newsrc, fileno (fp), 0); ++ fclose (fp); ++ return 0; ++} ++ ++void nntp_cache_expand (char *dst, const char *src) ++{ ++ snprintf (dst, _POSIX_PATH_MAX, "%s/%s", NewsCacheDir, src); ++ mutt_expand_path (dst, _POSIX_PATH_MAX); ++} ++ ++/* Loads $news_cache_dir/.index into memory, loads newsserver data ++ * and newsgroup cache names */ ++static int nntp_parse_cacheindex (NNTP_SERVER *news) ++{ ++ struct stat st; ++ char buf[HUGE_STRING], *cp; ++ char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX]; ++ FILE *index; ++ NNTP_DATA *data; ++ int l, m, t; ++ ++ /* check is server name defined or not */ ++ if (!news || !news->conn || !news->conn->account.host) ++ return -1; ++ unset_option (OPTNEWSCACHE); ++ if (!NewsCacheDir || !*NewsCacheDir) ++ return 0; ++ ++ strfcpy (dir, NewsCacheDir, sizeof (dir)); ++ mutt_expand_path (dir, sizeof(dir)); ++ ++ if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0) ++ { ++ snprintf (buf, sizeof(buf), _("Directory %s not exist. Create it?"), dir); ++ if (mutt_yesorno (buf, M_YES) != M_YES || mkdir (dir, (S_IRWXU+S_IRWXG+ ++ S_IRWXO))) ++ { ++ mutt_error _("Cache directory not created!"); ++ return -1; ++ } ++ mutt_clear_error(); ++ } ++ ++ set_option (OPTNEWSCACHE); ++ ++ FREE (&news->cache); ++ snprintf (buf, sizeof(buf), "%s/.index", dir); ++ if (!(index = safe_fopen (buf, "a+"))) ++ return 0; ++ rewind (index); ++ while (fgets (buf, sizeof(buf), index)) ++ { ++ buf[strlen(buf) - 1] = 0; /* strip ending '\n' */ ++ if (!mutt_strncmp (buf, "#: ", 3) && ++ !mutt_strcasecmp (buf+3, news->conn->account.host)) ++ break; ++ } ++ while (fgets (buf, sizeof(buf), index)) ++ { ++ cp = buf; ++ while (*cp && *cp != ' ') cp++; ++ if (!*cp) continue; ++ cp[0] = 0; ++ if (!mutt_strcmp (buf, "#:")) ++ break; ++ sscanf (cp + 1, "%s %d %d", file, &l, &m); ++ if (!mutt_strcmp (buf, "ALL")) ++ { ++ news->cache = safe_strdup (file); ++ news->newgroups_time = m; ++ } ++ else if (news->newsgroups) ++ { ++ if ((data = (NNTP_DATA *)hash_find (news->newsgroups, buf)) == NULL) ++ { ++ data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1); ++ data->group = (char *) data + sizeof (NNTP_DATA); ++ strcpy(data->group, buf); ++ data->nserv = news; ++ data->deleted = 1; ++ if (news->newsgroups->nelem < news->newsgroups->curnelem * 2) ++ news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0); ++ hash_insert (news->newsgroups, data->group, data, 0); ++ nntp_add_to_list (news, data); ++ } ++ data->cache = safe_strdup (file); ++ t = 0; ++ if (!data->firstMessage || data->lastMessage < m) ++ t = 1; ++ if (!data->firstMessage) ++ data->firstMessage = l; ++ if (data->lastMessage < m) ++ data->lastMessage = m; ++ data->lastCached = m; ++ if (t || !data->unread) ++ mutt_newsgroup_stat (data); ++ } ++ } ++ fclose (index); ++ return 0; ++} ++ ++const char * ++nntp_format_str (char *dest, size_t destlen, size_t col, char op, const char *src, ++ const char *fmt, const char *ifstring, const char *elsestring, ++ unsigned long data, format_flag flags) ++{ ++ char fn[SHORT_STRING], tmp[SHORT_STRING]; ++ ++ switch (op) ++ { ++ case 's': ++ strncpy (fn, NewsServer, sizeof(fn) - 1); ++ mutt_strlower (fn); ++ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); ++ snprintf (dest, destlen, tmp, fn); ++ break; ++ } ++ return (src); ++} ++ ++/* nntp_parse_url: given an NNPT URL, return host, port, ++ * username, password and newsgroup will recognise. */ ++int nntp_parse_url (const char *server, ACCOUNT *acct, ++ char *group, size_t group_len) ++{ ++ ciss_url_t url; ++ char *c; ++ int ret = -1; ++ ++ /* Defaults */ ++ acct->flags = 0; ++ acct->port = NNTP_PORT; ++ acct->type = M_ACCT_TYPE_NNTP; ++ ++ c = safe_strdup (server); ++ url_parse_ciss (&url, c); ++ ++ if (url.scheme == U_NNTP || url.scheme == U_NNTPS) ++ { ++ if (url.scheme == U_NNTPS) ++ { ++ acct->flags |= M_ACCT_SSL; ++ acct->port = NNTP_SSL_PORT; ++ } ++ ++ *group = '\0'; ++ if (url.path) ++ strfcpy (group, url.path, group_len); ++ ++ ret = mutt_account_fromurl (acct, &url); ++ } ++ ++ FREE (&c); ++ return ret; ++} ++ ++void nntp_expand_path (char *line, size_t len, ACCOUNT *acct) ++{ ++ ciss_url_t url; ++ ++ url.path = safe_strdup (line); ++ mutt_account_tourl (acct, &url); ++ url_ciss_tostring (&url, line, len, 0); ++ FREE (&url.path); ++} ++ ++/* ++ * Automatically loads a newsrc into memory, if necessary. ++ * Checks the size/mtime of a newsrc file, if it doesn't match, load ++ * again. Hmm, if a system has broken mtimes, this might mean the file ++ * is reloaded every time, which we'd have to fix. ++ * ++ * a newsrc file is a line per newsgroup, with the newsgroup, then a ++ * ':' denoting subscribed or '!' denoting unsubscribed, then a ++ * comma separated list of article numbers and ranges. ++ */ ++NNTP_SERVER *mutt_select_newsserver (char *server) ++{ ++ char file[_POSIX_PATH_MAX]; ++ char *buf, *p; ++ LIST *list; ++ ACCOUNT acct; ++ NNTP_SERVER *serv; ++ CONNECTION *conn; ++ ++ if (!server || !*server) ++ { ++ mutt_error _("No newsserver defined!"); ++ return NULL; ++ } ++ ++ buf = p = safe_calloc (strlen (server) + 10, sizeof (char)); ++ if (url_check_scheme (server) == U_UNKNOWN) ++ { ++ strcpy (buf, "news://"); ++ p = strchr (buf, '\0'); ++ } ++ strcpy (p, server); ++ ++ if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file) ++ { ++ FREE (&buf); ++ mutt_error (_("%s is an invalid newsserver specification!"), server); ++ return NULL; ++ } ++ FREE (&buf); ++ ++ conn = mutt_conn_find (NULL, &acct); ++ if (!conn) ++ return NULL; ++ ++ mutt_FormatString (file, sizeof (file), 0, NONULL (NewsRc), nntp_format_str, 0, 0); ++ mutt_expand_path (file, sizeof (file)); ++ ++ serv = (NNTP_SERVER *)conn->data; ++ if (serv) ++ { ++ struct stat sb; ++ ++ /* externally modified? */ ++ if (serv->stat != stat (file, &sb) || (!serv->stat && ++ (serv->size != sb.st_size || serv->mtime != sb.st_mtime))) ++ { ++ for (list = serv->list; list; list = list->next) ++ { ++ NNTP_DATA *data = (NNTP_DATA *) list->data; ++ ++ if (data) ++ { ++ data->subscribed = 0; ++ data->rc = 0; ++ data->num = 0; ++ } ++ } ++ slurp_newsrc (serv); ++ nntp_clear_cacheindex (serv); ++ } ++ ++ if (serv->status == NNTP_BYE) ++ serv->status = NNTP_NONE; ++ nntp_check_newgroups (serv, 0); ++ return serv; ++ } ++ ++ /* New newsserver */ ++ serv = safe_calloc (1, sizeof (NNTP_SERVER)); ++ serv->conn = conn; ++ serv->newsrc = safe_strdup (file); ++ serv->newsgroups = hash_create (1009, 0); ++ slurp_newsrc (serv); /* load .newsrc */ ++ nntp_parse_cacheindex (serv); /* load .index */ ++ if (option (OPTNEWSCACHE) && serv->cache && nntp_get_cache_all (serv) >= 0) ++ nntp_check_newgroups (serv, 1); ++ else if (nntp_get_active (serv) < 0) ++ { ++ hash_destroy (&serv->newsgroups, nntp_delete_data); ++ for (list = serv->list; list; list = list->next) ++ list->data = NULL; ++ mutt_free_list (&serv->list); ++ FREE (&serv->newsrc); ++ FREE (&serv->cache); ++ FREE (&serv); ++ return NULL; ++ } ++ nntp_clear_cacheindex (serv); ++ conn->data = (void *)serv; ++ ++ return serv; ++} ++ ++/* ++ * full status flags are not supported by nntp, but we can fake some ++ * of them. This is how: ++ * Read = a read message number is in the .newsrc ++ * New = a message is new since we last read this newsgroup ++ * Old = anything else ++ * So, Read is marked as such in the newsrc, old is anything that is ++ * "skipped" in the newsrc, and new is anything not in the newsrc nor ++ * in the cache. By skipped, I mean before the last unread message ++ */ ++void nntp_get_status (CONTEXT *ctx, HEADER *h, char *group, int article) ++{ ++ NNTP_DATA *data = (NNTP_DATA *) ctx->data; ++ int x; ++ ++ if (group) ++ data = (NNTP_DATA *) hash_find (data->nserv->newsgroups, group); ++ ++ if (!data) ++ { ++#ifdef DEBUG ++ if (group) ++ dprint (3, (debugfile, "newsgroup %s not found\n", group)); ++#endif ++ return; ++ } ++ ++ for (x = 0; x < data->num; x++) ++ { ++ if ((article >= data->entries[x].first) && ++ (article <= data->entries[x].last)) ++ { ++ /* we cannot use mutt_set_flag() because mx_update_context() ++ didn't called yet */ ++ h->read = 1; ++ return; ++ } ++ } ++ /* If article was not cached yet, it is new! :) */ ++ if (!data->cache || article > data->lastCached) ++ return; ++ /* Old articles are articles which aren't read but an article after them ++ * has been cached */ ++ if (option (OPTMARKOLD)) ++ h->old = 1; ++} ++ ++void mutt_newsgroup_stat (NNTP_DATA *data) ++{ ++ int i; ++ unsigned int first, last; ++ ++ data->unread = 0; ++ if (data->lastMessage == 0 || data->firstMessage > data->lastMessage) ++ return; ++ ++ data->unread = data->lastMessage - data->firstMessage + 1; ++ for (i = 0; i < data->num; i++) ++ { ++ first = data->entries[i].first; ++ if (first < data->firstMessage) ++ first = data->firstMessage; ++ last = data->entries[i].last; ++ if (last > data->lastMessage) ++ last = data->lastMessage; ++ if (first <= last) ++ data->unread -= last - first + 1; ++ } ++} ++ ++static int puti (char *line, int num) ++{ ++ char *p, s[32]; ++ ++ for (p = s; num; ) ++ { ++ *p++ = '0' + num % 10; ++ num /= 10; ++ } ++ while (p > s) ++ *line++ = *--p, num++; ++ *line = '\0'; ++ return num; ++} ++ ++static void nntp_create_newsrc_line (NNTP_DATA *data, char **buf, char **pline, size_t *buflen) ++{ ++ char *line = *pline; ++ size_t len = *buflen - (*pline - *buf); ++ int x, i; ++ ++ if (len < LONG_STRING * 10) ++ { ++ len += *buflen; ++ *buflen *= 2; ++ line = *buf; ++ safe_realloc (buf, *buflen); ++ line = *buf + (*pline - line); ++ } ++ strcpy (line, data->group); ++ len -= strlen (line) + 1; ++ line += strlen (line); ++ *line++ = data->subscribed ? ':' : '!'; ++ *line++ = ' '; ++ *line = '\0'; ++ ++ for (x = 0; x < data->num; x++) ++ { ++ if (len < LONG_STRING) ++ { ++ len += *buflen; ++ *buflen *= 2; ++ *pline = line; ++ line = *buf; ++ safe_realloc (buf, *buflen); ++ line = *buf + (*pline - line); ++ } ++ if (x) ++ { ++ *line++ = ','; ++ len--; ++ } ++ ++#if 0 ++ if (data->entries[x].first == data->entries[x].last) ++ snprintf (line, len, "%d%n", data->entries[x].first, &i); ++ else ++ snprintf (line, len, "%d-%d%n", ++ data->entries[x].first, data->entries[x].last, &i); ++ len -= i; ++ line += i; ++#else ++ i = puti (line, data->entries[x].first); ++ line +=i; len -= i; ++ if (data->entries[x].first != data->entries[x].last) ++ { ++ *line++ = '-'; ++ len--; ++ i = puti (line, data->entries[x].last); ++ line +=i; len -= i; ++ } ++#endif ++ } ++ *line++ = '\n'; ++ *line = '\0'; ++ *pline = line; ++} ++ ++void newsrc_gen_entries (CONTEXT *ctx) ++{ ++ NNTP_DATA *data = (NNTP_DATA *)ctx->data; ++ int series, x; ++ unsigned int last = 0, first = 1; ++ int save_sort = SORT_ORDER; ++ ++ if (Sort != SORT_ORDER) ++ { ++ save_sort = Sort; ++ Sort = SORT_ORDER; ++ mutt_sort_headers (ctx, 0); ++ } ++ ++ if (!data->max) ++ { ++ data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY)); ++ data->max = 5; ++ } ++ ++ /* ++ * Set up to fake initial sequence from 1 to the article before the ++ * first article in our list ++ */ ++ data->num = 0; ++ series = 1; ++ ++ for (x = 0; x < ctx->msgcount; x++) ++ { ++ if (series) /* search for first unread */ ++ { ++ /* ++ * We don't actually check sequential order, since we mark ++ * "missing" entries as read/deleted ++ */ ++ last = ctx->hdrs[x]->article_num; ++ if (last >= data->firstMessage && !ctx->hdrs[x]->deleted && ++ !ctx->hdrs[x]->read) ++ { ++ if (data->num >= data->max) ++ { ++ data->max = data->max * 2; ++ safe_realloc (&data->entries, ++ data->max * sizeof (NEWSRC_ENTRY)); ++ } ++ data->entries[data->num].first = first; ++ data->entries[data->num].last = last - 1; ++ data->num++; ++ series = 0; ++ } ++ } ++ else /* search for first read */ ++ { ++ if (ctx->hdrs[x]->deleted || ctx->hdrs[x]->read) ++ { ++ first = last + 1; ++ series = 1; ++ } ++ last = ctx->hdrs[x]->article_num; ++ } ++ } ++ if (series && first <= data->lastLoaded) ++ { ++ if (data->num >= data->max) ++ { ++ data->max = data->max * 2; ++ safe_realloc (&data->entries, ++ data->max * sizeof (NEWSRC_ENTRY)); ++ } ++ data->entries[data->num].first = first; ++ data->entries[data->num].last = data->lastLoaded; ++ data->num++; ++ } ++ ++ if (save_sort != Sort) ++ { ++ Sort = save_sort; ++ mutt_sort_headers (ctx, 0); ++ } ++} ++ ++static int mutt_update_list_file (char *filename, char *section, ++ char *key, char *line) ++{ ++ FILE *ifp; ++ FILE *ofp; ++ char buf[HUGE_STRING]; ++ char tmpfile[_POSIX_PATH_MAX]; ++ char *c; ++ int ext = 0, done = 0, r = 0; ++ ++ /* if file not exist, create it */ ++ if ((ifp = safe_fopen (filename, "a"))) ++ fclose (ifp); ++ dprint (1, (debugfile, "Opening %s\n", filename)); ++ if (!(ifp = safe_fopen (filename, "r"))) ++ { ++ mutt_error (_("Unable to open %s for reading"), filename); ++ return -1; ++ } ++ if (mx_lock_file (filename, fileno (ifp), 0, 0, 1)) ++ { ++ fclose (ifp); ++ mutt_error (_("Unable to lock %s"), filename); ++ return -1; ++ } ++ snprintf (tmpfile, sizeof(tmpfile), "%s.tmp", filename); ++ dprint (1, (debugfile, "Opening %s\n", tmpfile)); ++ if (!(ofp = fopen (tmpfile, "w"))) ++ { ++ fclose (ifp); ++ mutt_error (_("Unable to open %s for writing"), tmpfile); ++ return -1; ++ } ++ ++ if (section) ++ { ++ while (r != EOF && !done && fgets (buf, sizeof (buf), ifp)) ++ { ++ r = fputs (buf, ofp); ++ c = buf; ++ while (*c && *c != '\n') c++; ++ c[0] = 0; /* strip EOL */ ++ if (!strncmp (buf, "#: ", 3) && !mutt_strcasecmp (buf+3, section)) ++ done++; ++ } ++ if (r != EOF && !done) ++ { ++ snprintf (buf, sizeof(buf), "#: %s\n", section); ++ r = fputs (buf, ofp); ++ } ++ done = 0; ++ } ++ ++ while (r != EOF && fgets (buf, sizeof (buf), ifp)) ++ { ++ if (ext) ++ { ++ c = buf; ++ while (*c && (*c != '\r') && (*c != '\n')) c++; ++ c--; ++ if (*c != '\\') ext = 0; ++ } ++ else if ((section && !strncmp (buf, "#: ", 3))) ++ { ++ if (!done && line) ++ { ++ fputs (line, ofp); ++ fputc ('\n', ofp); ++ } ++ r = fputs (buf, ofp); ++ done++; ++ break; ++ } ++ else if (key && !strncmp (buf, key, strlen(key)) && ++ (!*key || buf[strlen(key)] == ' ')) ++ { ++ c = buf; ++ ext = 0; ++ while (*c && (*c != '\r') && (*c != '\n')) c++; ++ c--; ++ if (*c == '\\') ext = 1; ++ if (!done && line) ++ { ++ r = fputs (line, ofp); ++ if (*key) ++ r = fputc ('\n', ofp); ++ done++; ++ } ++ } ++ else ++ { ++ r = fputs (buf, ofp); ++ } ++ } ++ ++ while (r != EOF && fgets (buf, sizeof (buf), ifp)) ++ r = fputs (buf, ofp); ++ ++ /* If there wasn't a line to replace, put it on the end of the file */ ++ if (r != EOF && !done && line) ++ { ++ fputs (line, ofp); ++ r = fputc ('\n', ofp); ++ } ++ mx_unlock_file (filename, fileno (ifp), 0); ++ fclose (ofp); ++ fclose (ifp); ++ if (r == EOF) ++ { ++ unlink (tmpfile); ++ mutt_error (_("Can't write %s"), tmpfile); ++ return -1; ++ } ++ if (rename (tmpfile, filename) < 0) ++ { ++ unlink (tmpfile); ++ mutt_error (_("Can't rename %s to %s"), tmpfile, filename); ++ return -1; ++ } ++ return 0; ++} ++ ++int mutt_newsrc_update (NNTP_SERVER *news) ++{ ++ char *buf, *line; ++ NNTP_DATA *data; ++ LIST *tmp; ++ int r = -1; ++ size_t len, llen; ++ ++ if (!news) ++ return -1; ++ llen = len = 10 * LONG_STRING; ++ line = buf = safe_calloc (1, len); ++ /* we will generate full newsrc here */ ++ for (tmp = news->list; tmp; tmp = tmp->next) ++ { ++ data = (NNTP_DATA *) tmp->data; ++ if (!data || !data->rc) ++ continue; ++ nntp_create_newsrc_line (data, &buf, &line, &llen); ++ if (*line) ++ dprint (2, (debugfile, "Added to newsrc: %s\n", line)); ++ line += strlen (line); ++ } ++ /* newrc being fully rewritten */ ++ if (news->newsrc && ++ (r = mutt_update_list_file (news->newsrc, NULL, "", buf)) == 0) ++ { ++ struct stat st; ++ ++ stat (news->newsrc, &st); ++ news->size = st.st_size; ++ news->mtime = st.st_mtime; ++ } ++ FREE (&buf); ++ return r; ++} ++ ++static FILE *mutt_mkname (char *s) ++{ ++ char buf[_POSIX_PATH_MAX], *pc; ++ int fd; ++ FILE *fp; ++ ++ nntp_cache_expand (buf, s); ++ if ((fp = safe_fopen (buf, "w"))) ++ return fp; ++ ++ nntp_cache_expand (buf, "cache-XXXXXX"); ++ pc = buf + strlen (buf) - 12; /* positioning to "cache-XXXXXX" */ ++ if ((fd = mkstemp (buf)) == -1) ++ return NULL; ++ strcpy (s, pc); /* generated name */ ++ return fdopen (fd, "w"); ++} ++ ++/* Updates info into .index file: ALL or about selected newsgroup */ ++static int nntp_update_cacheindex (NNTP_SERVER *serv, NNTP_DATA *data) ++{ ++ char buf[LONG_STRING], *key = "ALL"; ++ char file[_POSIX_PATH_MAX]; ++ ++ if (!serv || !serv->conn || !serv->conn->account.host) ++ return -1; ++ ++ if (data && data->group) ++ { ++ key = data->group; ++ snprintf (buf, sizeof (buf), "%s %s %d %d", key, data->cache, ++ data->firstMessage, data->lastLoaded); ++ } ++ else ++ { ++ strfcpy (file, serv->cache, sizeof (file)); ++ snprintf (buf, sizeof (buf), "ALL %s 0 %d", file, (int)serv->newgroups_time); ++ } ++ nntp_cache_expand (file, ".index"); ++ return mutt_update_list_file (file, serv->conn->account.host, key, buf); ++} ++ ++/* Remove cache files of unsubscribed newsgroups */ ++void nntp_clear_cacheindex (NNTP_SERVER *news) ++{ ++ NNTP_DATA *data; ++ LIST *tmp; ++ ++ if (option (OPTSAVEUNSUB) || !news) ++ return; ++ ++ for (tmp = news->list; tmp; tmp = tmp->next) ++ { ++ data = (NNTP_DATA *) tmp->data; ++ if (!data || data->subscribed || !data->cache) ++ continue; ++ nntp_delete_cache (data); ++ dprint (2, (debugfile, "Removed from .index: %s\n", data->group)); ++ } ++ return; ++} ++ ++int nntp_save_cache_index (NNTP_SERVER *news) ++{ ++ char buf[HUGE_STRING]; ++ char file[_POSIX_PATH_MAX]; ++ NNTP_DATA *d; ++ FILE *f; ++ LIST *l; ++ ++ if (!news || !news->newsgroups) ++ return -1; ++ if (!option (OPTNEWSCACHE)) ++ return 0; ++ ++ if (news->cache) ++ { ++ nntp_cache_expand (file, news->cache); ++ unlink (file); ++ f = safe_fopen (file, "w"); ++ } ++ else ++ { ++ strfcpy (buf, news->conn->account.host, sizeof(buf)); ++ f = mutt_mkname (buf); ++ news->cache = safe_strdup (buf); ++ nntp_cache_expand (file, buf); ++ } ++ if (!f) ++ return -1; ++ ++ for (l = news->list; l; l = l->next) ++ { ++ if ((d = (NNTP_DATA *)l->data) && !d->deleted) ++ { ++ if (d->desc) ++ snprintf (buf, sizeof(buf), "%s %d %d %c %s\n", d->group, ++ d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n', ++ d->desc); ++ else ++ snprintf (buf, sizeof(buf), "%s %d %d %c\n", d->group, ++ d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n'); ++ if (fputs (buf, f) == EOF) ++ { ++ fclose (f); ++ unlink (file); ++ return -1; ++ } ++ } ++ } ++ fclose (f); ++ ++ if (nntp_update_cacheindex (news, NULL)) ++ { ++ unlink (file); ++ return -1; ++ } ++ return 0; ++} ++ ++int nntp_save_cache_group (CONTEXT *ctx) ++{ ++ char buf[HUGE_STRING], addr[STRING]; ++ char file[_POSIX_PATH_MAX]; ++ FILE *f; ++ HEADER *h; ++ struct tm *tm; ++ int i = 0, save = SORT_ORDER; ++ int prev = 0; ++ ++ if (!option (OPTNEWSCACHE)) ++ return 0; ++ if (!ctx || !ctx->data || ctx->magic != M_NNTP) ++ return -1; ++ ++ if (((NNTP_DATA *)ctx->data)->cache) ++ { ++ nntp_cache_expand (file, ((NNTP_DATA *)ctx->data)->cache); ++ unlink (file); ++ f = safe_fopen (file, "w"); ++ } ++ else ++ { ++ snprintf (buf, sizeof(buf), "%s-%s", ++ ((NNTP_DATA *)ctx->data)->nserv->conn->account.host, ++ ((NNTP_DATA *)ctx->data)->group); ++ f = mutt_mkname (buf); ++ ((NNTP_DATA *)ctx->data)->cache = safe_strdup (buf); ++ nntp_cache_expand (file, buf); ++ } ++ if (!f) ++ return -1; ++ ++ if (Sort != SORT_ORDER) ++ { ++ save = Sort; ++ Sort = SORT_ORDER; ++ mutt_sort_headers (ctx, 0); ++ } ++ ++ /* Save only $nntp_context messages... */ ++ ((NNTP_DATA *)ctx->data)->lastCached = 0; ++ if (NntpContext && ctx->msgcount > NntpContext) ++ i = ctx->msgcount - NntpContext; ++ for (; i < ctx->msgcount; i++) ++ { ++ if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev) ++ { ++ h = ctx->hdrs[i]; ++ addr[0] = 0; ++ rfc822_write_address (addr, sizeof(addr), h->env->from, 0); ++ tm = gmtime (&h->date_sent); ++ snprintf (buf, sizeof(buf), ++ "%d\t%s\t%s\t%d %s %d %02d:%02d:%02d GMT\t%s\t", ++ h->article_num, h->env->subject, addr, tm->tm_mday, ++ Months[tm->tm_mon], tm->tm_year+1900, tm->tm_hour, tm->tm_min, ++ tm->tm_sec, h->env->message_id); ++ fputs (buf, f); ++ if (h->env->references) ++ mutt_write_references (h->env->references, f, 10); ++ snprintf (buf, sizeof(buf), "\t%ld\t%d\tXref: %s\n", (long int) h->content->length, ++ (int) h->lines, NONULL(h->env->xref)); ++ if (fputs (buf, f) == EOF) ++ { ++ fclose (f); ++ unlink (file); ++ return -1; ++ } ++ } ++ prev = ctx->hdrs[i]->article_num; ++ } ++ ++ if (save != Sort) ++ { ++ Sort = save; ++ mutt_sort_headers (ctx, 0); ++ } ++ fclose (f); ++ ++ if (nntp_update_cacheindex (((NNTP_DATA *)ctx->data)->nserv, ++ (NNTP_DATA *)ctx->data)) ++ { ++ unlink (file); ++ return -1; ++ } ++ ((NNTP_DATA *)ctx->data)->lastCached = ((NNTP_DATA *)ctx->data)->lastLoaded; ++ return 0; ++} ++ ++void nntp_delete_cache (NNTP_DATA *data) ++{ ++ char buf[_POSIX_PATH_MAX]; ++ ++ if (!option (OPTNEWSCACHE) || !data || !data->cache || !data->nserv) ++ return; ++ ++ nntp_cache_expand (buf, data->cache); ++ unlink (buf); ++ FREE (&data->cache); ++ data->lastCached = 0; ++ nntp_cache_expand (buf, ".index"); ++ mutt_update_list_file (buf, data->nserv->conn->account.host, data->group, NULL); ++} ++ ++NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *news, char *group) ++{ ++ NNTP_DATA *data; ++ ++ if (!news || !news->newsgroups || !group || !*group) ++ return NULL; ++ if (!(data = (NNTP_DATA *)hash_find (news->newsgroups, group))) ++ { ++ data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1); ++ data->group = (char *) data + sizeof (NNTP_DATA); ++ strcpy (data->group, group); ++ data->nserv = news; ++ data->deleted = 1; ++ if (news->newsgroups->nelem < news->newsgroups->curnelem * 2) ++ news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0); ++ hash_insert (news->newsgroups, data->group, data, 0); ++ nntp_add_to_list (news, data); ++ } ++ if (!data->subscribed) ++ { ++ data->subscribed = 1; ++ data->rc = 1; ++ } ++ return data; ++} ++ ++NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *news, char *group) ++{ ++ NNTP_DATA *data; ++ ++ if (!news || !news->newsgroups || !group || !*group || ++ !(data = (NNTP_DATA *)hash_find (news->newsgroups, group))) ++ return NULL; ++ if (data->subscribed) ++ { ++ data->subscribed = 0; ++ if (!option (OPTSAVEUNSUB)) ++ data->rc = 0; ++ } ++ return data; ++} ++ ++NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *news, char *group) ++{ ++ NNTP_DATA *data; ++ ++ if (!news || !news->newsgroups || !group || !*group || ++ !(data = (NNTP_DATA *)hash_find (news->newsgroups, group))) ++ return NULL; ++ if (!data->max) ++ { ++ data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY)); ++ data->max = 5; ++ } ++ data->num = 1; ++ data->entries[0].first = 1; ++ data->unread = 0; ++ data->entries[0].last = data->lastMessage; ++ if (Context && Context->data == data) ++ { ++ int x; ++ ++ for (x = 0; x < Context->msgcount; x++) ++ mutt_set_flag (Context, Context->hdrs[x], M_READ, 1); ++ } ++ return data; ++} ++ ++NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *news, char *group) ++{ ++ NNTP_DATA *data; ++ ++ if (!news || !news->newsgroups || !group || !*group || ++ !(data = (NNTP_DATA *)hash_find (news->newsgroups, group))) ++ return NULL; ++ if (!data->max) ++ { ++ data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY)); ++ data->max = 5; ++ } ++ data->num = 1; ++ data->entries[0].first = 1; ++ data->entries[0].last = data->firstMessage - 1; ++ if (Context && Context->data == data) ++ { ++ int x; ++ ++ data->unread = Context->msgcount; ++ for (x = 0; x < Context->msgcount; x++) ++ mutt_set_flag (Context, Context->hdrs[x], M_READ, 0); ++ } ++ else ++ data->unread = data->lastMessage - data->entries[0].last; ++ return data; ++} ++ ++/* this routine gives the first newsgroup with new messages */ ++void nntp_buffy (char *s) ++{ ++ LIST *list; ++ ++ for (list = CurrentNewsSrv->list; list; list = list->next) ++ { ++ NNTP_DATA *data = (NNTP_DATA *) list->data; ++ ++ if (data && data->subscribed && data->unread) ++ { ++ if (Context && Context->magic == M_NNTP && ++ !mutt_strcmp (data->group, ((NNTP_DATA *) Context->data)->group)) ++ { ++ unsigned int i, unread = 0; ++ ++ for (i = 0; i < Context->msgcount; i++) ++ if (!Context->hdrs[i]->read && !Context->hdrs[i]->deleted) ++ unread++; ++ if (!unread) ++ continue; ++ } ++ strcpy (s, data->group); ++ break; ++ } ++ } ++} +diff -udprP mutt-1.5.20.orig/nntp.c mutt-1.5.20/nntp.c +--- mutt-1.5.20.orig/nntp.c 1970-01-01 03:00:00.000000000 +0300 ++++ mutt-1.5.20/nntp.c 2009-06-15 21:05:24.000000000 +0300 +@@ -0,0 +1,1588 @@ ++/* ++ * Copyright (C) 1998 Brandon Long ++ * Copyright (C) 1999 Andrej Gritsenko ++ * Copyright (C) 2000-2007 Vsevolod Volkov ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#if HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include "mutt.h" ++#include "mutt_curses.h" ++#include "sort.h" ++#include "mx.h" ++#include "mime.h" ++#include "rfc1524.h" ++#include "rfc2047.h" ++#include "mailbox.h" ++#include "nntp.h" ++ ++#ifdef HAVE_PGP ++#include "pgp.h" ++#endif ++ ++#ifdef HAVE_SMIME ++#include "smime.h" ++#endif ++ ++#include ++#include ++#include ++#include ++ ++static unsigned int _checked = 0; ++ ++#ifdef DEBUG ++static void nntp_error (const char *where, const char *msg) ++{ ++ dprint (1, (debugfile, "nntp_error(): unexpected response in %s: %s\n", where, msg)); ++} ++#endif /* DEBUG */ ++ ++static int nntp_auth (NNTP_SERVER *serv) ++{ ++ CONNECTION *conn = serv->conn; ++ char buf[STRING]; ++ unsigned char flags = conn->account.flags; ++ ++ if (mutt_account_getuser (&conn->account) || !conn->account.user[0] || ++ mutt_account_getpass (&conn->account) || !conn->account.pass[0]) ++ { ++ conn->account.flags = flags; ++ return -2; ++ } ++ ++ mutt_message _("Logging in..."); ++ ++ snprintf (buf, sizeof (buf), "AUTHINFO USER %s\r\n", conn->account.user); ++ mutt_socket_write (conn, buf); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ { ++ conn->account.flags = flags; ++ return -1; ++ } ++ ++#ifdef DEBUG ++ /* don't print the password unless we're at the ungodly debugging level */ ++ if (debuglevel < M_SOCK_LOG_FULL) ++ dprint (M_SOCK_LOG_CMD, (debugfile, "> AUTHINFO PASS *\n")); ++#endif ++ snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass); ++ mutt_socket_write_d (conn, buf, -1, M_SOCK_LOG_FULL); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ { ++ conn->account.flags = flags; ++ return -1; ++ } ++ ++ if (mutt_strncmp ("281", buf, 3)) ++ { ++ conn->account.flags = flags; ++ mutt_error _("Login failed."); ++ sleep (2); ++ return -3; ++ } ++ ++ return 0; ++} ++ ++static int nntp_connect_error (NNTP_SERVER *serv) ++{ ++ serv->status = NNTP_NONE; ++ mutt_socket_close (serv->conn); ++ mutt_error _("Server closed connection!"); ++ sleep (2); ++ return -1; ++} ++ ++static int nntp_connect_and_auth (NNTP_SERVER *serv) ++{ ++ CONNECTION *conn = serv->conn; ++ char buf[STRING]; ++ int rc; ++ ++ serv->status = NNTP_NONE; ++ ++ if (mutt_socket_open (conn) < 0) ++ return -1; ++ ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ ++ if (!mutt_strncmp ("200", buf, 3)) ++ mutt_message (_("Connected to %s. Posting ok."), conn->account.host); ++ else if (!mutt_strncmp ("201", buf, 3)) ++ mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host); ++ else ++ { ++ mutt_socket_close (conn); ++ mutt_remove_trailing_ws (buf); ++ mutt_error ("%s", buf); ++ sleep (2); ++ return -1; ++ } ++ ++ sleep (1); ++ ++ /* Tell INN to switch to mode reader if it isn't so. Ignore all ++ returned codes and messages. */ ++ mutt_socket_write (conn, "MODE READER\r\n"); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ ++ mutt_socket_write (conn, "STAT\r\n"); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ ++ if (!(conn->account.flags & M_ACCT_USER) && mutt_strncmp ("480", buf, 3)) ++ { ++ serv->status = NNTP_OK; ++ return 0; ++ } ++ ++ rc = nntp_auth (serv); ++ if (rc == -1) ++ return nntp_connect_error (serv); ++ if (rc == -2) ++ { ++ mutt_socket_close (conn); ++ serv->status = NNTP_BYE; ++ return -1; ++ } ++ if (rc < 0) ++ { ++ mutt_socket_close (conn); ++ mutt_error _("Login failed."); ++ sleep (2); ++ return -1; ++ } ++ serv->status = NNTP_OK; ++ return 0; ++} ++ ++static int nntp_attempt_features (NNTP_SERVER *serv) ++{ ++ char buf[LONG_STRING]; ++ CONNECTION *conn = serv->conn; ++ ++ mutt_socket_write (conn, "XOVER\r\n"); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ if (mutt_strncmp ("500", buf, 3)) ++ serv->hasXOVER = 1; ++ ++ mutt_socket_write (conn, "XPAT\r\n"); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ if (mutt_strncmp ("500", buf, 3)) ++ serv->hasXPAT = 1; ++ ++ mutt_socket_write (conn, "LISTGROUP\r\n"); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ if (mutt_strncmp ("500", buf, 3)) ++ serv->hasLISTGROUP = 1; ++ ++ mutt_socket_write (conn, "XGTITLE +\r\n"); ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ if (mutt_strncmp ("500", buf, 3)) ++ serv->hasXGTITLE = 1; ++ ++ if (!mutt_strncmp ("282", buf, 3)) ++ { ++ do ++ { ++ if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) ++ return nntp_connect_error (serv); ++ } while (!(buf[0] == '.' && buf[1] == '\0')); ++ } ++ ++ return 0; ++} ++ ++static int nntp_open_connection (NNTP_SERVER *serv) ++{ ++ if (serv->status == NNTP_OK) ++ return 0; ++ if (serv->status == NNTP_BYE) ++ return -1; ++ if (nntp_connect_and_auth (serv) < 0) ++ return -1; ++ if (nntp_attempt_features (serv) < 0) ++ return -1; ++ return 0; ++} ++ ++static int nntp_reconnect (NNTP_SERVER *serv) ++{ ++ char buf[SHORT_STRING]; ++ ++ mutt_socket_close (serv->conn); ++ ++ FOREVER ++ { ++ if (nntp_connect_and_auth (serv) == 0) ++ return 0; ++ ++ snprintf (buf, sizeof (buf), _("Connection to %s lost. Reconnect?"), ++ serv->conn->account.host); ++ if (query_quadoption (OPT_NNTPRECONNECT, buf) != M_YES) ++ { ++ serv->status = NNTP_BYE; ++ return -1; ++ } ++ } ++} ++ ++/* Send data from line[LONG_STRING] and receive answer to same line */ ++static int mutt_nntp_query (NNTP_DATA *data, char *line, size_t linelen) ++{ ++ char buf[LONG_STRING]; ++ int done = TRUE; ++ ++ if (data->nserv->status == NNTP_BYE) ++ return -1; ++ ++ do ++ { ++ if (*line) ++ { ++ mutt_socket_write (data->nserv->conn, line); ++ } ++ else if (data->group) ++ { ++ snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group); ++ mutt_socket_write (data->nserv->conn, buf); ++ } ++ ++ done = TRUE; ++ if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0) ++ { ++ if (nntp_reconnect (data->nserv) < 0) ++ return -1; ++ ++ if (data->group) ++ { ++ snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group); ++ mutt_socket_write (data->nserv->conn, buf); ++ if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0) ++ return -1; ++ } ++ if (*line) ++ done = FALSE; ++ } ++ else if ((!mutt_strncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0) ++ return -1; ++ } while (!done); ++ ++ strfcpy (line, buf, linelen); ++ return 0; ++} ++ ++/* ++ * This function calls funct(*line, *data) for each received line, ++ * funct(NULL, *data) if rewind(*data) needs, exits when fail or done. ++ * Returned codes: ++ * 0 - successful, ++ * 1 - correct but not performed (may be, have to be continued), ++ * -1 - conection lost, ++ * -2 - invalid command or execution error, ++ * -3 - error in funct(*line, *data). ++ */ ++static int mutt_nntp_fetch (NNTP_DATA *nntp_data, char *query, char *msg, ++ int (*funct) (char *, void *), void *data, int tagged) ++{ ++ char buf[LONG_STRING]; ++ char *inbuf, *p; ++ int done = FALSE; ++ int chunk, line; ++ size_t lenbuf = 0; ++ int ret; ++ ++ do ++ { ++ strfcpy (buf, query, sizeof (buf)); ++ if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) ++ return -1; ++ if (buf[0] == '5') ++ return -2; ++ if (buf[0] != '2') ++ return 1; ++ ++ ret = 0; ++ line = 0; ++ inbuf = safe_malloc (sizeof (buf)); ++ ++ FOREVER ++ { ++ chunk = mutt_socket_readln_d (buf, sizeof (buf), nntp_data->nserv->conn, ++ M_SOCK_LOG_HDR); ++ if (chunk < 0) ++ break; ++ ++ p = buf; ++ if (!lenbuf && buf[0] == '.') ++ { ++ if (buf[1] == '\0') ++ { ++ done = TRUE; ++ break; ++ } ++ if (buf[1] == '.') ++ p++; ++ } ++ ++ strfcpy (inbuf + lenbuf, p, sizeof (buf)); ++ ++ if (chunk >= sizeof (buf)) ++ { ++ lenbuf += strlen (p); ++ } ++ else ++ { ++ line++; ++ if (msg && ReadInc && (line % ReadInc == 0)) { ++ if (tagged) ++ mutt_message (_("%s (tagged: %d) %d"), msg, tagged, line); ++ else ++ mutt_message ("%s %d", msg, line); ++ } ++ ++ if (ret == 0 && funct (inbuf, data) < 0) ++ ret = -3; ++ lenbuf = 0; ++ } ++ ++ safe_realloc (&inbuf, lenbuf + sizeof (buf)); ++ } ++ FREE (&inbuf); ++ funct (NULL, data); ++ } ++ while (!done); ++ return ret; ++} ++ ++static int nntp_read_tempfile (char *line, void *file) ++{ ++ FILE *f = (FILE *)file; ++ ++ if (!line) ++ rewind (f); ++ else ++ { ++ fputs (line, f); ++ if (fputc ('\n', f) == EOF) ++ return -1; ++ } ++ return 0; ++} ++ ++static void nntp_parse_xref (CONTEXT *ctx, char *group, char *xref, HEADER *h) ++{ ++ register char *p, *b; ++ register char *colon = NULL; ++ ++ b = p = xref; ++ while (*p) ++ { ++ /* skip to next word */ ++ b = p; ++ while (*b && ((*b == ' ') || (*b == '\t'))) b++; ++ p = b; ++ colon = NULL; ++ /* skip to end of word */ ++ while (*p && (*p != ' ') && (*p != '\t')) ++ { ++ if (*p == ':') ++ colon = p; ++ p++; ++ } ++ if (*p) ++ { ++ *p = '\0'; ++ p++; ++ } ++ if (colon) ++ { ++ *colon = '\0'; ++ colon++; ++ nntp_get_status (ctx, h, b, atoi(colon)); ++ if (h && h->article_num == 0 && mutt_strcmp (group, b) == 0) ++ h->article_num = atoi(colon); ++ } ++ } ++} ++ ++/* ++ * returns: ++ * 0 on success ++ * 1 if article not found ++ * -1 if read or write error on tempfile or socket ++ */ ++static int nntp_read_header (CONTEXT *ctx, const char *msgid, int article_num) ++{ ++ NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data); ++ FILE *f; ++ char buf[LONG_STRING]; ++ char tempfile[_POSIX_PATH_MAX]; ++ int ret; ++ HEADER *h = ctx->hdrs[ctx->msgcount]; ++ ++ mutt_mktemp (tempfile); ++ if (!(f = safe_fopen (tempfile, "w+"))) ++ return -1; ++ ++ if (!msgid) ++ snprintf (buf, sizeof (buf), "HEAD %d\r\n", article_num); ++ else ++ snprintf (buf, sizeof (buf), "HEAD %s\r\n", msgid); ++ ++ ret = mutt_nntp_fetch (nntp_data, buf, NULL, nntp_read_tempfile, f, 0); ++ if (ret) ++ { ++#ifdef DEBUG ++ if (ret != -1) ++ dprint(1, (debugfile, "nntp_read_header: %s\n", buf)); ++#endif ++ fclose (f); ++ unlink (tempfile); ++ return (ret == -1 ? -1 : 1); ++ } ++ ++ h->article_num = article_num; ++ h->env = mutt_read_rfc822_header (f, h, 0, 0); ++ fclose (f); ++ unlink (tempfile); ++ ++ if (h->env->xref != NULL) ++ nntp_parse_xref (ctx, nntp_data->group, h->env->xref, h); ++ else if (h->article_num == 0 && msgid) ++ { ++ snprintf (buf, sizeof (buf), "STAT %s\r\n", msgid); ++ if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) == 0) ++ h->article_num = atoi (buf + 4); ++ } ++ ++ return 0; ++} ++ ++static int parse_description (char *line, void *n) ++{ ++#define news ((NNTP_SERVER *) n) ++ register char *d = line; ++ NNTP_DATA *data; ++ ++ if (!line) ++ return 0; ++ while (*d && *d != '\t' && *d != ' ') d++; ++ *d = 0; ++ d++; ++ while (*d && (*d == '\t' || *d == ' ')) d++; ++ dprint (2, (debugfile, "group: %s, desc: %s\n", line, d)); ++ if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL && ++ mutt_strcmp (d, data->desc)) ++ { ++ FREE (&data->desc); ++ data->desc = safe_strdup (d); ++ } ++ return 0; ++#undef news ++} ++ ++static void nntp_get_desc (NNTP_DATA *data, char *mask, char *msg) ++{ ++ char buf[STRING]; ++ ++ if (!option (OPTLOADDESC) || !data || !data->nserv) ++ return; ++ ++ /* Get newsgroup description, if we can */ ++ if (data->nserv->hasXGTITLE) ++ snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask); ++ else ++ snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask); ++ if (mutt_nntp_fetch (data, buf, msg, parse_description, data->nserv, 0) != 0) ++ { ++#ifdef DEBUG ++ nntp_error ("nntp_get_desc()", buf); ++#endif ++ } ++} ++ ++/* ++ * XOVER returns a tab separated list of: ++ * id|subject|from|date|Msgid|references|bytes|lines|xref ++ * ++ * This has to duplicate some of the functionality of ++ * mutt_read_rfc822_header(), since it replaces the call to that (albeit with ++ * a limited number of headers which are "parsed" by placement in the list) ++ */ ++static int nntp_parse_xover (CONTEXT *ctx, char *buf, HEADER *hdr) ++{ ++ NNTP_DATA *nntp_data = (NNTP_DATA *) ctx->data; ++ char *p, *b; ++ int x, done = 0; ++ ++ hdr->env = mutt_new_envelope(); ++ hdr->env->newsgroups = safe_strdup (nntp_data->group); ++ hdr->content = mutt_new_body(); ++ hdr->content->type = TYPETEXT; ++ hdr->content->subtype = safe_strdup ("plain"); ++ hdr->content->encoding = ENC7BIT; ++ hdr->content->disposition = DISPINLINE; ++ hdr->content->length = -1; ++ b = p = buf; ++ ++ for (x = 0; !done && x < 9; x++) ++ { ++ /* if from file, need to skip newline character */ ++ while (*p && *p != '\n' && *p != '\t') p++; ++ if (!*p) done++; ++ *p = '\0'; ++ p++; ++ switch (x) ++ { ++ case 0: ++ ++ hdr->article_num = atoi (b); ++ nntp_get_status (ctx, hdr, NULL, hdr->article_num); ++ break; ++ case 1: ++ hdr->env->subject = safe_strdup (b); ++ /* Now we need to do the things which would normally be done in ++ * mutt_read_rfc822_header() */ ++ if (hdr->env->subject) ++ { ++ regmatch_t pmatch[1]; ++ ++ rfc2047_decode (&hdr->env->subject); ++ ++ if (regexec (ReplyRegexp.rx, hdr->env->subject, 1, pmatch, 0) == 0) ++ hdr->env->real_subj = hdr->env->subject + pmatch[0].rm_eo; ++ else ++ hdr->env->real_subj = hdr->env->subject; ++ } ++ break; ++ case 2: ++ rfc822_free_address (&hdr->env->from); ++ hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b); ++ rfc2047_decode_adrlist (hdr->env->from); ++ break; ++ case 3: ++ hdr->date_sent = mutt_parse_date (b, hdr); ++ hdr->received = hdr->date_sent; ++ break; ++ case 4: ++ FREE (&hdr->env->message_id); ++ hdr->env->message_id = safe_strdup (b); ++ break; ++ case 5: ++ mutt_free_list (&hdr->env->references); ++ hdr->env->references = mutt_parse_references (b, 0); ++ break; ++ case 6: ++ hdr->content->length = atoi (b); ++ break; ++ case 7: ++ hdr->lines = atoi (b); ++ break; ++ case 8: ++ if (!hdr->read) ++ FREE (&hdr->env->xref); ++ b = b + 6; /* skips the "Xref: " */ ++ hdr->env->xref = safe_strdup (b); ++ nntp_parse_xref (ctx, nntp_data->group, b, hdr); ++ } ++ if (!*p) ++ return -1; ++ b = p; ++ } ++ return 0; ++} ++ ++typedef struct ++{ ++ CONTEXT *ctx; ++ unsigned int base; ++ unsigned int first; ++ unsigned int last; ++ unsigned short *messages; ++ char* msg; ++} FETCH_CONTEXT; ++ ++#define fc ((FETCH_CONTEXT *) c) ++static int nntp_fetch_numbers (char *line, void *c) ++{ ++ unsigned int num; ++ ++ if (!line) ++ return 0; ++ num = atoi (line); ++ if (num < fc->base || num > fc->last) ++ return 0; ++ fc->messages[num - fc->base] = 1; ++ return 0; ++} ++ ++static int add_xover_line (char *line, void *c) ++{ ++ unsigned int num, total; ++ CONTEXT *ctx = fc->ctx; ++ NNTP_DATA *data = (NNTP_DATA *)ctx->data; ++ ++ if (!line) ++ return 0; ++ ++ if (ctx->msgcount >= ctx->hdrmax) ++ mx_alloc_memory (ctx); ++ ctx->hdrs[ctx->msgcount] = mutt_new_header (); ++ ctx->hdrs[ctx->msgcount]->index = ctx->msgcount; ++ ++ nntp_parse_xover (ctx, line, ctx->hdrs[ctx->msgcount]); ++ num = ctx->hdrs[ctx->msgcount]->article_num; ++ ++ if (num >= fc->first && num <= fc->last && fc->messages[num - fc->base]) ++ { ++ ctx->msgcount++; ++ if (num > data->lastLoaded) ++ data->lastLoaded = num; ++ num = num - fc->first + 1; ++ total = fc->last - fc->first + 1; ++ if (!ctx->quiet && fc->msg && ReadInc && (num % ReadInc == 0)) ++ mutt_message ("%s %d/%d", fc->msg, num, total); ++ } ++ else ++ mutt_free_header (&ctx->hdrs[ctx->msgcount]); /* skip it */ ++ ++ return 0; ++} ++#undef fc ++ ++static int nntp_fetch_headers (CONTEXT *ctx, unsigned int first, ++ unsigned int last) ++{ ++ char buf[HUGE_STRING]; ++ char *msg = _("Fetching message headers..."); ++ NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data); ++ int ret; ++ int num; ++ int oldmsgcount; ++ unsigned int current; ++ FILE *f; ++ FETCH_CONTEXT fc; ++ ++ /* if empty group or nothing to do */ ++ if (!last || first > last) ++ return 0; ++ ++ /* fetch list of articles */ ++ fc.ctx = ctx; ++ fc.base = first; ++ fc.last = last; ++ fc.messages = safe_calloc (last - first + 1, sizeof (unsigned short)); ++ if (nntp_data->nserv->hasLISTGROUP) ++ { ++ mutt_message _("Fetching list of articles..."); ++ snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group); ++ if (mutt_nntp_fetch (nntp_data, buf, NULL, nntp_fetch_numbers, &fc, 0) != 0) ++ { ++ mutt_error (_("LISTGROUP command failed: %s"), buf); ++#ifdef DEBUG ++ nntp_error ("nntp_fetch_headers()", buf); ++#endif ++ FREE (&fc.messages); ++ return -1; ++ } ++ } ++ else ++ { ++ for (num = 0; num < last - first + 1; num++) ++ fc.messages[num] = 1; ++ } ++ ++ /* CACHE: must be loaded xover cache here */ ++ num = nntp_data->lastCached - first + 1; ++ if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0) ++ { ++ nntp_cache_expand (buf, nntp_data->cache); ++ mutt_message _("Fetching headers from cache..."); ++ if ((f = safe_fopen (buf, "r"))) ++ { ++ int r = 0; ++ ++ /* counting number of lines */ ++ while (fgets (buf, sizeof (buf), f) != NULL) ++ r++; ++ rewind (f); ++ while (r > num && fgets (buf, sizeof (buf), f) != NULL) ++ r--; ++ oldmsgcount = ctx->msgcount; ++ fc.first = first; ++ fc.last = first + num - 1; ++ fc.msg = NULL; ++ while (fgets (buf, sizeof (buf), f) != NULL) ++ add_xover_line (buf, &fc); ++ fclose (f); ++ nntp_data->lastLoaded = fc.last; ++ first = fc.last + 1; ++ if (ctx->msgcount > oldmsgcount) ++ mx_update_context (ctx, ctx->msgcount - oldmsgcount); ++ } ++ else ++ nntp_delete_cache (nntp_data); ++ } ++ num = last - first + 1; ++ if (num <= 0) ++ { ++ FREE (&fc.messages); ++ return 0; ++ } ++ ++ /* ++ * Without XOVER, we have to fetch each article header and parse ++ * it. With XOVER, we ask for all of them ++ */ ++ mutt_message (msg); ++ if (nntp_data->nserv->hasXOVER) ++ { ++ oldmsgcount = ctx->msgcount; ++ fc.first = first; ++ fc.last = last; ++ fc.msg = msg; ++ snprintf (buf, sizeof (buf), "XOVER %d-%d\r\n", first, last); ++ ret = mutt_nntp_fetch (nntp_data, buf, NULL, add_xover_line, &fc, 0); ++ if (ctx->msgcount > oldmsgcount) ++ mx_update_context (ctx, ctx->msgcount - oldmsgcount); ++ if (ret != 0) ++ { ++ mutt_error (_("XOVER command failed: %s"), buf); ++#ifdef DEBUG ++ nntp_error ("nntp_fetch_headers()", buf); ++#endif ++ FREE (&fc.messages); ++ return -1; ++ } ++ /* fetched OK */ ++ } ++ else ++ for (current = first; current <= last; current++) ++ { ++ HEADER *h; ++ ++ ret = current - first + 1; ++ mutt_message ("%s %d/%d", msg, ret, num); ++ ++ if (!fc.messages[current - fc.base]) ++ continue; ++ ++ if (ctx->msgcount >= ctx->hdrmax) ++ mx_alloc_memory (ctx); ++ h = ctx->hdrs[ctx->msgcount] = mutt_new_header (); ++ h->index = ctx->msgcount; ++ ++ ret = nntp_read_header (ctx, NULL, current); ++ if (ret == 0) /* Got article. Fetch next header */ ++ { ++ nntp_get_status (ctx, h, NULL, h->article_num); ++ ctx->msgcount++; ++ mx_update_context (ctx, 1); ++ } ++ else ++ mutt_free_header (&h); /* skip it */ ++ if (ret == -1) ++ { ++ FREE (&fc.messages); ++ return -1; ++ } ++ ++ if (current > nntp_data->lastLoaded) ++ nntp_data->lastLoaded = current; ++ } ++ FREE (&fc.messages); ++ nntp_data->lastLoaded = last; ++ mutt_clear_error (); ++ return 0; ++} ++ ++/* ++ * currently, nntp "mailbox" is "newsgroup" ++ */ ++int nntp_open_mailbox (CONTEXT *ctx) ++{ ++ NNTP_DATA *nntp_data; ++ NNTP_SERVER *serv; ++ char buf[HUGE_STRING]; ++ char server[LONG_STRING]; ++ int count = 0; ++ unsigned int first; ++ ACCOUNT acct; ++ ++ if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf) ++ { ++ mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path); ++ mutt_sleep (2); ++ return -1; ++ } ++ ++ server[0] = '\0'; ++ nntp_expand_path (server, sizeof (server), &acct); ++ if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK) ++ return -1; ++ ++ CurrentNewsSrv = serv; ++ ++ /* create NNTP-specific state struct if nof found in list */ ++ if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) ++ { ++ nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1); ++ nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA); ++ strcpy (nntp_data->group, buf); ++ hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0); ++ nntp_add_to_list (serv, nntp_data); ++ } ++ ctx->data = nntp_data; ++ ctx->mx_close = nntp_fastclose_mailbox; ++ nntp_data->nserv = serv; ++ ++ mutt_message (_("Selecting %s..."), nntp_data->group); ++ ++ if (!nntp_data->desc) ++ { ++ nntp_get_desc (nntp_data, nntp_data->group, NULL); ++ if (nntp_data->desc) ++ nntp_save_cache_index (serv); ++ } ++ ++ buf[0] = 0; ++ if (mutt_nntp_query (nntp_data, buf, sizeof(buf)) < 0) ++ { ++#ifdef DEBUG ++ nntp_error ("nntp_open_mailbox()", buf); ++#endif ++ return -1; ++ } ++ ++ if (mutt_strncmp ("211", buf, 3)) ++ { ++ LIST *l = serv->list; ++ ++ /* GROUP command failed */ ++ if (!mutt_strncmp ("411", buf, 3)) ++ { ++ mutt_error (_("Newsgroup %s not found on server %s"), ++ nntp_data->group, serv->conn->account.host); ++ ++ /* CACHE: delete cache and line from .index */ ++ nntp_delete_cache (nntp_data); ++ hash_delete (serv->newsgroups, nntp_data->group, NULL, nntp_delete_data); ++ while (l && l->data != (void *) nntp_data) l = l->next; ++ if (l) ++ l->data = NULL; ++ ++ sleep (2); ++ } ++ ++ return -1; ++ } ++ ++ sscanf (buf + 4, "%d %u %u %s", &count, &nntp_data->firstMessage, ++ &nntp_data->lastMessage, buf); ++ ++ nntp_data->deleted = 0; ++ ++ time (&serv->check_time); ++ ++ /* ++ * Check for max adding context. If it is greater than $nntp_context, ++ * strip off extra articles ++ */ ++ first = nntp_data->firstMessage; ++ if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext) ++ first = nntp_data->lastMessage - NntpContext + 1; ++ if (first) ++ nntp_data->lastLoaded = first - 1; ++ return nntp_fetch_headers (ctx, first, nntp_data->lastMessage); ++} ++ ++int nntp_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) ++{ ++ char buf[LONG_STRING]; ++ char path[_POSIX_PATH_MAX]; ++ NNTP_CACHE *cache; ++ char *m = _("Fetching message..."); ++ int ret; ++ ++ /* see if we already have the message in our cache */ ++ cache = &((NNTP_DATA *) ctx->data)->acache[ctx->hdrs[msgno]->index % NNTP_CACHE_LEN]; ++ ++ /* if everything is fine, assign msg->fp and return */ ++ if (cache->path && cache->index == ctx->hdrs[msgno]->index && ++ (msg->fp = fopen (cache->path, "r"))) ++ return 0; ++ ++ /* clear the previous entry */ ++ unlink (cache->path); ++ free (cache->path); ++ ++ mutt_message (m); ++ ++ cache->index = ctx->hdrs[msgno]->index; ++ mutt_mktemp (path); ++ cache->path = safe_strdup (path); ++ if (!(msg->fp = safe_fopen (path, "w+"))) ++ { ++ FREE (&cache->path); ++ return -1; ++ } ++ ++ if (ctx->hdrs[msgno]->article_num == 0) ++ snprintf (buf, sizeof (buf), "ARTICLE %s\r\n", ++ ctx->hdrs[msgno]->env->message_id); ++ else ++ snprintf (buf, sizeof (buf), "ARTICLE %d\r\n", ++ ctx->hdrs[msgno]->article_num); ++ ++ ret = mutt_nntp_fetch ((NNTP_DATA *)ctx->data, buf, m, nntp_read_tempfile, ++ msg->fp, ctx->tagged); ++ if (ret == 1) ++ { ++ mutt_error (_("Article %d not found on server"), ++ ctx->hdrs[msgno]->article_num); ++ dprint (1, (debugfile, "nntp_fetch_message: %s\n", buf)); ++ } ++ ++ if (ret) ++ { ++ fclose (msg->fp); ++ unlink (path); ++ FREE (&cache->path); ++ return -1; ++ } ++ ++ mutt_free_envelope (&ctx->hdrs[msgno]->env); ++ ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno], 0, 0); ++ /* fix content length */ ++ fseek(msg->fp, 0, SEEK_END); ++ ctx->hdrs[msgno]->content->length = ftell (msg->fp) - ++ ctx->hdrs[msgno]->content->offset; ++ ++ /* this is called in mutt before the open which fetches the message, ++ * which is probably wrong, but we just call it again here to handle ++ * the problem instead of fixing it. ++ */ ++ mutt_parse_mime_message (ctx, ctx->hdrs[msgno]); ++ ++ /* These would normally be updated in mx_update_context(), but the ++ * full headers aren't parsed with XOVER, so the information wasn't ++ * available then. ++ */ ++#if defined(HAVE_PGP) || defined(HAVE_SMIME) ++ ctx->hdrs[msgno]->security = crypt_query (ctx->hdrs[msgno]->content); ++#endif /* HAVE_PGP || HAVE_SMIME */ ++ ++ mutt_clear_error(); ++ rewind (msg->fp); ++ ++ return 0; ++} ++ ++/* Post article */ ++int nntp_post (const char *msg) { ++ char buf[LONG_STRING]; ++ size_t len; ++ FILE *f; ++ NNTP_DATA *nntp_data; ++ ++ if (Context && Context->magic == M_NNTP) ++ nntp_data = (NNTP_DATA *)Context->data; ++ else ++ { ++ if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)) || ++ !CurrentNewsSrv->list || !CurrentNewsSrv->list->data) ++ { ++ mutt_error (_("Can't post article. No connection to news server.")); ++ return -1; ++ } ++ nntp_data = (NNTP_DATA *)CurrentNewsSrv->list->data; ++ } ++ ++ if (!(f = safe_fopen (msg, "r"))) ++ { ++ mutt_error (_("Can't post article. Unable to open %s"), msg); ++ return -1; ++ } ++ ++ strfcpy (buf, "POST\r\n", sizeof (buf)); ++ if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) ++ { ++ mutt_error (_("Can't post article. Connection to %s lost."), ++ nntp_data->nserv->conn->account.host); ++ return -1; ++ } ++ if (buf[0] != '3') ++ { ++ mutt_error (_("Can't post article: %s"), buf); ++ return -1; ++ } ++ ++ buf[0] = '.'; ++ buf[1] = '\0'; ++ while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) ++ { ++ len = strlen (buf); ++ if (buf[len - 1] == '\n') ++ { ++ buf[len - 1] = '\r'; ++ buf[len] = '\n'; ++ len++; ++ buf[len] = '\0'; ++ } ++ if (buf[1] == '.') ++ mutt_socket_write_d (nntp_data->nserv->conn, buf, -1, M_SOCK_LOG_HDR); ++ else ++ mutt_socket_write_d (nntp_data->nserv->conn, buf + 1, -1, M_SOCK_LOG_HDR); ++ } ++ fclose (f); ++ ++ if (buf[strlen (buf) - 1] != '\n') ++ mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", -1, M_SOCK_LOG_HDR); ++ mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", -1, M_SOCK_LOG_HDR); ++ if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) ++ { ++ mutt_error (_("Can't post article. Connection to %s lost."), ++ nntp_data->nserv->conn->account.host); ++ return -1; ++ } ++ if (buf[0] != '2') ++ { ++ mutt_error (_("Can't post article: %s"), buf); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++/* nntp_logout_all: close all open connections. */ ++void nntp_logout_all (void) ++{ ++ char buf[LONG_STRING]; ++ CONNECTION* conn; ++ ++ conn = mutt_socket_head (); ++ ++ while (conn) ++ { ++ CONNECTION *next = conn->next; ++ ++ if (conn->account.type == M_ACCT_TYPE_NNTP) ++ { ++ mutt_message (_("Closing connection to %s..."), conn->account.host); ++ mutt_socket_write (conn, "QUIT\r\n"); ++ mutt_socket_readln (buf, sizeof (buf), conn); ++ mutt_clear_error (); ++ mutt_socket_close (conn); ++ mutt_socket_free (conn); ++ } ++ ++ conn = next; ++ } ++} ++ ++static void nntp_free_acache (NNTP_DATA *data) ++{ ++ int i; ++ ++ for (i = 0; i < NNTP_CACHE_LEN; i++) ++ { ++ if (data->acache[i].path) ++ { ++ unlink (data->acache[i].path); ++ FREE (&data->acache[i].path); ++ } ++ } ++} ++ ++void nntp_delete_data (void *p) ++{ ++ NNTP_DATA *data = (NNTP_DATA *)p; ++ ++ if (!p) ++ return; ++ FREE (&data->entries); ++ FREE (&data->desc); ++ FREE (&data->cache); ++ nntp_free_acache (data); ++ FREE (p); ++} ++ ++int nntp_sync_mailbox (CONTEXT *ctx) ++{ ++ NNTP_DATA *data = ctx->data; ++ ++ /* CACHE: update cache and .index files */ ++ if ((option (OPTSAVEUNSUB) || data->subscribed)) ++ nntp_save_cache_group (ctx); ++ nntp_free_acache (data); ++ ++ data->nserv->check_time = 0; /* next nntp_check_mailbox() will really check */ ++ return 0; ++} ++ ++int nntp_fastclose_mailbox (CONTEXT *ctx) ++{ ++ NNTP_DATA *data = (NNTP_DATA *) ctx->data, *tmp; ++ ++ if (!data) ++ return 0; ++ nntp_free_acache (data); ++ if (!data->nserv || !data->nserv->newsgroups || !data->group) ++ return 0; ++ nntp_save_cache_index (data->nserv); ++ if ((tmp = hash_find (data->nserv->newsgroups, data->group)) == NULL ++ || tmp != data) ++ nntp_delete_data (data); ++ return 0; ++} ++ ++/* commit changes and terminate connection */ ++int nntp_close_mailbox (CONTEXT *ctx) ++{ ++ if (!ctx) ++ return -1; ++ mutt_message _("Quitting newsgroup..."); ++ if (ctx->data) ++ { ++ NNTP_DATA *data = (NNTP_DATA *) ctx->data; ++ int ret; ++ ++ if (data->nserv && data->nserv->conn && ctx->unread) ++ { ++ ret = query_quadoption (OPT_CATCHUP, _("Mark all articles read?")); ++ if (ret == M_YES) ++ mutt_newsgroup_catchup (data->nserv, data->group); ++ else if (ret < 0) ++ return -1; ++ } ++ } ++ nntp_sync_mailbox (ctx); ++ if (ctx->data && ((NNTP_DATA *)ctx->data)->nserv) ++ { ++ NNTP_SERVER *news; ++ ++ news = ((NNTP_DATA *)ctx->data)->nserv; ++ newsrc_gen_entries (ctx); ++ ((NNTP_DATA *)ctx->data)->unread = ctx->unread; ++ mutt_newsrc_update (news); ++ } ++ mutt_clear_error(); ++ return 0; ++} ++ ++/* use the GROUP command to poll for new mail */ ++static int _nntp_check_mailbox (CONTEXT *ctx, NNTP_DATA *nntp_data) ++{ ++ char buf[LONG_STRING]; ++ int count = 0; ++ ++ if (nntp_data->nserv->check_time + NewsPollTimeout > time (NULL)) ++ return 0; ++ ++ buf[0] = 0; ++ if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) ++ { ++#ifdef DEBUG ++ nntp_error ("nntp_check_mailbox()", buf); ++#endif ++ return -1; ++ } ++ if (mutt_strncmp ("211", buf, 3)) ++ { ++ buf[0] = 0; ++ if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) ++ { ++#ifdef DEBUG ++ nntp_error ("nntp_check_mailbox()", buf); ++#endif ++ return -1; ++ } ++ } ++ if (!mutt_strncmp ("211", buf, 3)) ++ { ++ int first; ++ int last; ++ ++ sscanf (buf + 4, "%d %d %d", &count, &first, &last); ++ nntp_data->firstMessage = first; ++ nntp_data->lastMessage = last; ++ if (ctx && last > nntp_data->lastLoaded) ++ { ++ nntp_fetch_headers (ctx, nntp_data->lastLoaded + 1, last); ++ time (&nntp_data->nserv->check_time); ++ return 1; ++ } ++ if (!last || (!nntp_data->rc && !nntp_data->lastCached)) ++ nntp_data->unread = count; ++ else ++ mutt_newsgroup_stat (nntp_data); ++ /* active was renumbered? */ ++ if (last < nntp_data->lastLoaded) ++ { ++ if (!nntp_data->max) ++ { ++ nntp_data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY)); ++ nntp_data->max = 5; ++ } ++ nntp_data->lastCached = 0; ++ nntp_data->num = 1; ++ nntp_data->entries[0].first = 1; ++ nntp_data->entries[0].last = 0; ++ } ++ } ++ ++ time (&nntp_data->nserv->check_time); ++ return 0; ++} ++ ++int nntp_check_mailbox (CONTEXT *ctx) ++{ ++ return _nntp_check_mailbox (ctx, (NNTP_DATA *)ctx->data); ++} ++ ++static int add_group (char *buf, void *serv) ++{ ++#define s ((NNTP_SERVER *) serv) ++ char group[LONG_STRING], mod, desc[HUGE_STRING]; ++ int first, last; ++ NNTP_DATA *nntp_data; ++ static int n = 0; ++ ++ _checked = n; /* _checked have N, where N = number of groups */ ++ if (!buf) /* at EOF must be zerouth */ ++ n = 0; ++ ++ if (!s || !buf) ++ return 0; ++ ++ *desc = 0; ++ sscanf (buf, "%s %d %d %c %[^\n]", group, &last, &first, &mod, desc); ++ if (!group) ++ return 0; ++ if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL) ++ { ++ n++; ++ nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1); ++ nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA); ++ strcpy (nntp_data->group, group); ++ nntp_data->nserv = s; ++ if (s->newsgroups->nelem < s->newsgroups->curnelem * 2) ++ s->newsgroups = hash_resize (s->newsgroups, s->newsgroups->nelem * 2, 0); ++ hash_insert (s->newsgroups, nntp_data->group, nntp_data, 0); ++ nntp_add_to_list (s, nntp_data); ++ } ++ nntp_data->deleted = 0; ++ nntp_data->firstMessage = first; ++ nntp_data->lastMessage = last; ++ if (mod == 'y') ++ nntp_data->allowed = 1; ++ else ++ nntp_data->allowed = 0; ++ if (nntp_data->desc) ++ FREE (&nntp_data->desc); ++ if (*desc) ++ nntp_data->desc = safe_strdup (desc); ++ if (nntp_data->rc || nntp_data->lastCached) ++ mutt_newsgroup_stat (nntp_data); ++ else if (nntp_data->lastMessage && ++ nntp_data->firstMessage <= nntp_data->lastMessage) ++ nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1; ++ else ++ nntp_data->unread = 0; ++ ++ return 0; ++#undef s ++} ++ ++int nntp_check_newgroups (NNTP_SERVER *serv, int force) ++{ ++ char buf[LONG_STRING]; ++ char msg[SHORT_STRING]; ++ NNTP_DATA nntp_data; ++ LIST *l; ++ LIST emp; ++ time_t now; ++ struct tm *t; ++ unsigned int count = 0; ++ unsigned int total = 0; ++ ++ if (!serv || !serv->newgroups_time) ++ return -1; ++ ++ if (nntp_open_connection (serv) < 0) ++ return -1; ++ ++ /* check subscribed groups for new news */ ++ if (option (OPTSHOWNEWNEWS)) ++ { ++ mutt_message _("Checking for new messages..."); ++ for (l = serv->list; l; l = l->next) ++ { ++ serv->check_time = 0; /* really check! */ ++ if (l->data && ((NNTP_DATA *) l->data)->subscribed) ++ _nntp_check_mailbox (NULL, (NNTP_DATA *) l->data); ++ } ++ } ++ else if (!force) ++ return 0; ++ ++ mutt_message _("Checking for new newsgroups..."); ++ now = serv->newgroups_time; ++ time (&serv->newgroups_time); ++ t = gmtime (&now); ++ snprintf (buf, sizeof (buf), "NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n", ++ (t->tm_year % 100), t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, ++ t->tm_sec); ++ nntp_data.nserv = serv; ++ if (Context && Context->magic == M_NNTP) ++ nntp_data.group = ((NNTP_DATA *)Context->data)->group; ++ else ++ nntp_data.group = NULL; ++ l = serv->tail; ++ if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), ++ add_group, serv, 0) != 0) ++ { ++#ifdef DEBUG ++ nntp_error ("nntp_check_newgroups()", buf); ++#endif ++ return -1; ++ } ++ ++ strfcpy (msg, _("Loading descriptions..."), sizeof (msg)); ++ mutt_message (msg); ++ if (l) ++ emp.next = l->next; ++ else ++ emp.next = serv->list; ++ l = &emp; ++ while (l->next) ++ { ++ l = l->next; ++ ((NNTP_DATA *) l->data)->new = 1; ++ total++; ++ } ++ l = &emp; ++ while (l->next) ++ { ++ l = l->next; ++ nntp_get_desc ((NNTP_DATA *) l->data, ((NNTP_DATA *) l->data)->group, NULL); ++ count++; ++ if (ReadInc && (count % ReadInc == 0)) ++ mutt_message ("%s %d/%d", msg, count, total); ++ } ++ if (emp.next) ++ nntp_save_cache_index (serv); ++ mutt_clear_error (); ++ return _checked; ++} ++ ++/* Load list of all newsgroups from cache ALL */ ++int nntp_get_cache_all (NNTP_SERVER *serv) ++{ ++ char buf[HUGE_STRING]; ++ FILE *f; ++ ++ nntp_cache_expand (buf, serv->cache); ++ if ((f = safe_fopen (buf, "r"))) ++ { ++ int i = 0; ++ ++ while (fgets (buf, sizeof(buf), f) != NULL) ++ { ++ if (ReadInc && (i % ReadInc == 0)) ++ mutt_message (_("Loading list from cache... %d"), i); ++ add_group (buf, serv); ++ i++; ++ } ++ add_group (NULL, NULL); ++ fclose (f); ++ mutt_clear_error (); ++ return 0; ++ } ++ else ++ { ++ FREE (&serv->cache); ++ return -1; ++ } ++} ++ ++/* Load list of all newsgroups from active */ ++int nntp_get_active (NNTP_SERVER *serv) ++{ ++ char msg[SHORT_STRING]; ++ NNTP_DATA nntp_data; ++ LIST *tmp; ++ ++ if (nntp_open_connection (serv) < 0) ++ return -1; ++ ++ snprintf (msg, sizeof(msg), _("Loading list of all newsgroups on server %s..."), ++ serv->conn->account.host); ++ mutt_message (msg); ++ time (&serv->newgroups_time); ++ nntp_data.nserv = serv; ++ nntp_data.group = NULL; ++ ++ if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, add_group, serv, 0) < 0) ++ { ++#ifdef DEBUG ++ nntp_error ("nntp_get_active()", "LIST\r\n"); ++#endif ++ return -1; ++ } ++ ++ strfcpy (msg, _("Loading descriptions..."), sizeof (msg)); ++ mutt_message (msg); ++ nntp_get_desc (&nntp_data, "*", msg); ++ ++ for (tmp = serv->list; tmp; tmp = tmp->next) ++ { ++ NNTP_DATA *data = (NNTP_DATA *)tmp->data; ++ ++ if (data && data->deleted && !data->rc) ++ { ++ nntp_delete_cache (data); ++ hash_delete (serv->newsgroups, data->group, NULL, nntp_delete_data); ++ tmp->data = NULL; ++ } ++ } ++ nntp_save_cache_index (serv); ++ ++ mutt_clear_error (); ++ return _checked; ++} ++ ++/* ++ * returns -1 if error ocurred while retrieving header, ++ * number of articles which ones exist in context on success. ++ */ ++int nntp_check_msgid (CONTEXT *ctx, const char *msgid) ++{ ++ int ret; ++ ++ /* if msgid is already in context, don't reload them */ ++ if (hash_find (ctx->id_hash, msgid)) ++ return 1; ++ if (ctx->msgcount == ctx->hdrmax) ++ mx_alloc_memory (ctx); ++ ctx->hdrs[ctx->msgcount] = mutt_new_header (); ++ ctx->hdrs[ctx->msgcount]->index = ctx->msgcount; ++ ++ mutt_message (_("Fetching %s from server..."), msgid); ++ ret = nntp_read_header (ctx, msgid, 0); ++ /* since nntp_read_header() may set read flag, we must reset it */ ++ ctx->hdrs[ctx->msgcount]->read = 0; ++ if (ret != 0) ++ mutt_free_header (&ctx->hdrs[ctx->msgcount]); ++ else ++ { ++ ctx->msgcount++; ++ mx_update_context (ctx, 1); ++ ctx->changed = 1; ++ } ++ return ret; ++} ++ ++typedef struct ++{ ++ CONTEXT *ctx; ++ unsigned int num; ++ unsigned int max; ++ unsigned int *child; ++} CHILD_CONTEXT; ++ ++static int check_children (char *s, void *c) ++{ ++#define cc ((CHILD_CONTEXT *) c) ++ unsigned int i, n; ++ ++ if (!s || (n = atoi (s)) == 0) ++ return 0; ++ for (i = 0; i < cc->ctx->msgcount; i++) ++ if (cc->ctx->hdrs[i]->article_num == n) ++ return 0; ++ if (cc->num >= cc->max) ++ safe_realloc (&cc->child, sizeof (unsigned int) * (cc->max += 25)); ++ cc->child[cc->num++] = n; ++ ++ return 0; ++#undef cc ++} ++ ++int nntp_check_children (CONTEXT *ctx, const char *msgid) ++{ ++ NNTP_DATA *nntp_data = (NNTP_DATA *)ctx->data; ++ char buf[STRING]; ++ int i, ret = 0, tmp = 0; ++ CHILD_CONTEXT cc; ++ ++ if (!nntp_data || !nntp_data->nserv || !nntp_data->nserv->conn || ++ !nntp_data->nserv->conn->account.host) ++ return -1; ++ if (nntp_data->firstMessage > nntp_data->lastLoaded) ++ return 0; ++ if (!nntp_data->nserv->hasXPAT) ++ { ++ mutt_error (_("Server %s does not support this operation!"), ++ nntp_data->nserv->conn->account.host); ++ return -1; ++ } ++ ++ snprintf (buf, sizeof (buf), "XPAT References %d-%d *%s*\r\n", ++ nntp_data->firstMessage, nntp_data->lastLoaded, msgid); ++ ++ cc.ctx = ctx; ++ cc.num = 0; ++ cc.max = 25; ++ cc.child = safe_malloc (sizeof (unsigned int) * 25); ++ if (mutt_nntp_fetch (nntp_data, buf, NULL, check_children, &cc, 0)) ++ { ++ FREE (&cc.child); ++ return -1; ++ } ++ /* dont try to read the xover cache. check_children() already ++ * made sure that we dont have the article, so we need to visit ++ * the server. Reading the cache at this point is also bad ++ * because it would duplicate messages */ ++ if (option (OPTNEWSCACHE)) ++ { ++ tmp++; ++ unset_option (OPTNEWSCACHE); ++ } ++ for (i = 0; i < cc.num; i++) ++ { ++ if ((ret = nntp_fetch_headers (ctx, cc.child[i], cc.child[i]))) ++ break; ++ if (ctx->msgcount && ++ ctx->hdrs[ctx->msgcount - 1]->article_num == cc.child[i]) ++ ctx->hdrs[ctx->msgcount - 1]->read = 0; ++ } ++ if (tmp) ++ set_option (OPTNEWSCACHE); ++ FREE (&cc.child); ++ return ret; ++} +diff -udprP mutt-1.5.20.orig/nntp.h mutt-1.5.20/nntp.h +--- mutt-1.5.20.orig/nntp.h 1970-01-01 03:00:00.000000000 +0300 ++++ mutt-1.5.20/nntp.h 2009-06-15 21:05:24.000000000 +0300 +@@ -0,0 +1,136 @@ ++/* ++ * Copyright (C) 1998 Brandon Long ++ * Copyright (C) 1999 Andrej Gritsenko ++ * Copyright (C) 2000-2007 Vsevolod Volkov ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#ifndef _NNTP_H_ ++#define _NNTP_H_ 1 ++ ++#include "mutt_socket.h" ++#include "mailbox.h" ++ ++#include ++ ++#define NNTP_PORT 119 ++#define NNTP_SSL_PORT 563 ++ ++/* number of entries in the hash table */ ++#define NNTP_CACHE_LEN 10 ++ ++enum ++{ ++ NNTP_NONE = 0, ++ NNTP_OK, ++ NNTP_BYE ++}; ++ ++typedef struct ++{ ++ int first; ++ int last; ++} NEWSRC_ENTRY; ++ ++typedef struct ++{ ++ unsigned int hasXPAT : 1; ++ unsigned int hasXGTITLE : 1; ++ unsigned int hasXOVER : 1; ++ unsigned int hasLISTGROUP : 1; ++ unsigned int status : 3; ++ char *newsrc; ++ char *cache; ++ int stat; ++ off_t size; ++ time_t mtime; ++ time_t newgroups_time; ++ time_t check_time; ++ HASH *newsgroups; ++ LIST *list; /* list of newsgroups */ ++ LIST *tail; /* last entry of list */ ++ CONNECTION *conn; ++} NNTP_SERVER; ++ ++typedef struct ++{ ++ unsigned int index; ++ char *path; ++} NNTP_CACHE; ++ ++typedef struct ++{ ++ NEWSRC_ENTRY *entries; ++ unsigned int num; /* number of used entries */ ++ unsigned int max; /* number of allocated entries */ ++ unsigned int unread; ++ unsigned int firstMessage; ++ unsigned int lastMessage; ++ unsigned int lastLoaded; ++ unsigned int lastCached; ++ unsigned int subscribed : 1; ++ unsigned int rc : 1; ++ unsigned int new : 1; ++ unsigned int allowed : 1; ++ unsigned int deleted : 1; ++ char *group; ++ char *desc; ++ char *cache; ++ NNTP_SERVER *nserv; ++ NNTP_CACHE acache[NNTP_CACHE_LEN]; ++} NNTP_DATA; ++ ++/* internal functions */ ++int nntp_get_active (NNTP_SERVER *); ++int nntp_get_cache_all (NNTP_SERVER *); ++int nntp_save_cache_index (NNTP_SERVER *); ++int nntp_check_newgroups (NNTP_SERVER *, int); ++int nntp_save_cache_group (CONTEXT *); ++int nntp_parse_url (const char *, ACCOUNT *, char *, size_t); ++void newsrc_gen_entries (CONTEXT *); ++void nntp_get_status (CONTEXT *, HEADER *, char *, int); ++void mutt_newsgroup_stat (NNTP_DATA *); ++void nntp_delete_cache (NNTP_DATA *); ++void nntp_add_to_list (NNTP_SERVER *, NNTP_DATA *); ++void nntp_cache_expand (char *, const char *); ++void nntp_delete_data (void *); ++ ++/* exposed interface */ ++NNTP_SERVER *mutt_select_newsserver (char *); ++NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *, char *); ++NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *, char *); ++NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *, char *); ++NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *, char *); ++void nntp_clear_cacheindex (NNTP_SERVER *); ++int mutt_newsrc_update (NNTP_SERVER *); ++int nntp_open_mailbox (CONTEXT *); ++int nntp_sync_mailbox (CONTEXT *); ++int nntp_check_mailbox (CONTEXT *); ++int nntp_close_mailbox (CONTEXT *); ++int nntp_fastclose_mailbox (CONTEXT *); ++int nntp_fetch_message (MESSAGE *, CONTEXT *, int); ++int nntp_post (const char *); ++int nntp_check_msgid (CONTEXT *, const char *); ++int nntp_check_children (CONTEXT *, const char *); ++void nntp_buffy (char *); ++void nntp_expand_path (char *, size_t, ACCOUNT *); ++void nntp_logout_all (); ++const char *nntp_format_str (char *, size_t, size_t, char, const char *, const char *, ++ const char *, const char *, unsigned long, format_flag); ++ ++NNTP_SERVER *CurrentNewsSrv INITVAL (NULL); ++ ++#endif /* _NNTP_H_ */ +diff -udprP mutt-1.5.20.orig/pager.c mutt-1.5.20/pager.c +--- mutt-1.5.20.orig/pager.c 2009-06-03 23:48:31.000000000 +0300 ++++ mutt-1.5.20/pager.c 2009-06-15 21:05:24.000000000 +0300 +@@ -1059,6 +1059,11 @@ fill_buffer (FILE *f, LOFF_T *last_pos, + return b_read; + } + ++#ifdef USE_NNTP ++#include "mx.h" ++#include "nntp.h" ++#endif ++ + + static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, + int flags, ansi_attr *pa, int cnt, +@@ -1512,6 +1517,16 @@ static struct mapping_t PagerHelpExtra[] + { NULL, 0 } + }; + ++#ifdef USE_NNTP ++static struct mapping_t PagerNewsHelpExtra[] = { ++ { N_("Post"), OP_POST }, ++ { N_("Followup"), OP_FOLLOWUP }, ++ { N_("Del"), OP_DELETE }, ++ { N_("Next"), OP_MAIN_NEXT_UNDELETED }, ++ { NULL, 0 } ++}; ++#endif ++ + + + /* This pager is actually not so simple as it once was. It now operates in +@@ -1553,6 +1568,10 @@ mutt_pager (const char *banner, const ch + int old_PagerIndexLines; /* some people want to resize it + * while inside the pager... */ + ++#ifdef USE_NNTP ++ char *followup_to; ++#endif ++ + if (!(flags & M_SHOWCOLOR)) + flags |= M_SHOWFLAT; + +@@ -1592,7 +1611,11 @@ mutt_pager (const char *banner, const ch + if (IsHeader (extra)) + { + strfcpy (tmphelp, helpstr, sizeof (tmphelp)); +- mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER, PagerHelpExtra); ++ mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER, ++#ifdef USE_NNTP ++ (Context && (Context->magic == M_NNTP)) ? PagerNewsHelpExtra : ++#endif ++ PagerHelpExtra); + snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer); + } + if (!InHelp) +@@ -2465,6 +2488,15 @@ search_next: + CHECK_READONLY; + CHECK_ACL(M_ACL_WRITE, "flag message"); + ++#ifdef USE_NNTP ++ if (Context->magic == M_NNTP) ++ { ++ mutt_flushinp (); ++ mutt_error _("Can't change 'important' flag on NNTP server."); ++ break; ++ } ++#endif ++ + mutt_set_flag (Context, extra->hdr, M_FLAG, !extra->hdr->flagged); + redraw = REDRAW_STATUS | REDRAW_INDEX; + if (option (OPTRESOLVE)) +@@ -2498,6 +2530,60 @@ search_next: + redraw = REDRAW_FULL; + break; + ++#ifdef USE_NNTP ++ case OP_POST: ++ CHECK_MODE(IsHeader (extra) && !IsAttach (extra)); ++ CHECK_ATTACH; ++ if (extra->ctx && extra->ctx->magic == M_NNTP && ++ !((NNTP_DATA *)extra->ctx->data)->allowed && ++ query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES) ++ break; ++ ci_send_message (SENDNEWS, NULL, NULL, extra->ctx, NULL); ++ redraw = REDRAW_FULL; ++ break; ++ ++ case OP_FORWARD_TO_GROUP: ++ CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); ++ CHECK_ATTACH; ++ if (extra->ctx && extra->ctx->magic == M_NNTP && ++ !((NNTP_DATA *)extra->ctx->data)->allowed && ++ query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES) ++ break; ++ if (IsMsgAttach (extra)) ++ mutt_attach_forward (extra->fp, extra->hdr, extra->idx, ++ extra->idxlen, extra->bdy, SENDNEWS); ++ else ++ ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr); ++ redraw = REDRAW_FULL; ++ break; ++ ++ case OP_FOLLOWUP: ++ CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); ++ CHECK_ATTACH; ++ ++ if (IsMsgAttach (extra)) ++ followup_to = extra->bdy->hdr->env->followup_to; ++ else ++ followup_to = extra->hdr->env->followup_to; ++ ++ if (!followup_to || mutt_strcasecmp (followup_to, "poster") || ++ query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES) ++ { ++ if (extra->ctx && extra->ctx->magic == M_NNTP && ++ !((NNTP_DATA *)extra->ctx->data)->allowed && ++ query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES) ++ break; ++ if (IsMsgAttach (extra)) ++ mutt_attach_reply (extra->fp, extra->hdr, extra->idx, ++ extra->idxlen, extra->bdy, SENDNEWS|SENDREPLY); ++ else ++ ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL, ++ extra->ctx, extra->hdr); ++ redraw = REDRAW_FULL; ++ break; ++ } ++#endif ++ + case OP_REPLY: + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); + CHECK_ATTACH; +@@ -2544,7 +2630,7 @@ search_next: + CHECK_ATTACH; + if (IsMsgAttach (extra)) + mutt_attach_forward (extra->fp, extra->hdr, extra->idx, +- extra->idxlen, extra->bdy); ++ extra->idxlen, extra->bdy, 0); + else + ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr); + redraw = REDRAW_FULL; +diff -udprP mutt-1.5.20.orig/parse.c mutt-1.5.20/parse.c +--- mutt-1.5.20.orig/parse.c 2009-06-01 19:29:32.000000000 +0300 ++++ mutt-1.5.20/parse.c 2009-06-15 21:05:24.000000000 +0300 +@@ -89,7 +89,7 @@ char *mutt_read_rfc822_line (FILE *f, ch + /* not reached */ + } + +-static LIST *mutt_parse_references (char *s, int in_reply_to) ++LIST *mutt_parse_references (char *s, int in_reply_to) + { + LIST *t, *lst = NULL; + char *m; +@@ -1067,6 +1067,17 @@ int mutt_parse_rfc822_line (ENVELOPE *e, + e->from = rfc822_parse_adrlist (e->from, p); + matched = 1; + } ++#ifdef USE_NNTP ++ else if (!mutt_strcasecmp (line+1, "ollowup-to")) ++ { ++ if (!e->followup_to) ++ { ++ mutt_remove_trailing_ws (p); ++ e->followup_to = safe_strdup (mutt_skip_whitespace (p)); ++ } ++ matched = 1; ++ } ++#endif + break; + + case 'i': +@@ -1149,6 +1160,27 @@ int mutt_parse_rfc822_line (ENVELOPE *e, + } + break; + ++#ifdef USE_NNTP ++ case 'n': ++ if (!mutt_strcasecmp (line + 1, "ewsgroups")) ++ { ++ FREE (&e->newsgroups); ++ mutt_remove_trailing_ws (p); ++ e->newsgroups = safe_strdup (mutt_skip_whitespace (p)); ++ matched = 1; ++ } ++ break; ++#endif ++ ++ case 'o': ++ /* field `Organization:' saves only for pager! */ ++ if (!mutt_strcasecmp (line + 1, "rganization")) ++ { ++ if (!e->organization && mutt_strcasecmp (p, "unknown")) ++ e->organization = safe_strdup (p); ++ } ++ break; ++ + case 'r': + if (!ascii_strcasecmp (line + 1, "eferences")) + { +@@ -1257,6 +1289,20 @@ int mutt_parse_rfc822_line (ENVELOPE *e, + e->x_label = safe_strdup(p); + matched = 1; + } ++#ifdef USE_NNTP ++ else if (!mutt_strcasecmp (line + 1, "-comment-to")) ++ { ++ if (!e->x_comment_to) ++ e->x_comment_to = safe_strdup (p); ++ matched = 1; ++ } ++ else if (!mutt_strcasecmp (line + 1, "ref")) ++ { ++ if (!e->xref) ++ e->xref = safe_strdup (p); ++ matched = 1; ++ } ++#endif + + default: + break; +diff -udprP mutt-1.5.20.orig/pattern.c mutt-1.5.20/pattern.c +--- mutt-1.5.20.orig/pattern.c 2009-06-03 23:48:31.000000000 +0300 ++++ mutt-1.5.20/pattern.c 2009-06-15 21:05:24.000000000 +0300 +@@ -91,6 +91,9 @@ Flags[] = + { 'U', M_UNREAD, 0, NULL }, + { 'v', M_COLLAPSED, 0, NULL }, + { 'V', M_CRYPT_VERIFIED, 0, NULL }, ++#ifdef USE_NNTP ++ { 'w', M_NEWSGROUPS, 0, eat_regexp }, ++#endif + { 'x', M_REFERENCE, 0, eat_regexp }, + { 'X', M_MIMEATTACH, 0, eat_range }, + { 'y', M_XLABEL, 0, eat_regexp }, +@@ -1204,6 +1207,10 @@ mutt_pattern_exec (struct pattern_t *pat + } + case M_UNREFERENCED: + return (pat->not ^ (h->thread && !h->thread->child)); ++#ifdef USE_NNTP ++ case M_NEWSGROUPS: ++ return (pat->not ^ (h->env->newsgroups && patmatch (pat, h->env->newsgroups) == 0)); ++#endif + } + mutt_error (_("error: unknown op %d (report this error)."), pat->op); + return (-1); +@@ -1285,6 +1292,7 @@ int mutt_pattern_func (int op, char *pro + progress_t progress; + + strfcpy (buf, NONULL (Context->pattern), sizeof (buf)); ++ if (prompt || op != M_LIMIT) + if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0]) + return (-1); + +diff -udprP mutt-1.5.20.orig/po/POTFILES.in mutt-1.5.20/po/POTFILES.in +--- mutt-1.5.20.orig/po/POTFILES.in 2008-11-11 21:55:47.000000000 +0200 ++++ mutt-1.5.20/po/POTFILES.in 2009-06-15 21:05:24.000000000 +0300 +@@ -46,6 +46,8 @@ mutt_ssl_gnutls.c + mutt_tunnel.c + muttlib.c + mx.c ++newsrc.c ++nntp.c + pager.c + parse.c + pattern.c +diff -udprP mutt-1.5.20.orig/postpone.c mutt-1.5.20/postpone.c +--- mutt-1.5.20.orig/postpone.c 2009-06-14 00:28:37.000000000 +0300 ++++ mutt-1.5.20/postpone.c 2009-06-15 21:05:24.000000000 +0300 +@@ -124,15 +124,26 @@ int mutt_num_postponed (int force) + + if (LastModify < st.st_mtime) + { ++#ifdef USE_NNTP ++ int optnews = option (OPTNEWS); ++#endif + LastModify = st.st_mtime; + + if (access (Postponed, R_OK | F_OK) != 0) + return (PostCount = 0); ++#ifdef USE_NNTP ++ if (optnews) ++ unset_option (OPTNEWS); ++#endif + if (mx_open_mailbox (Postponed, M_NOSORT | M_QUIET, &ctx) == NULL) + PostCount = 0; + else + PostCount = ctx.msgcount; + mx_fastclose_mailbox (&ctx); ++#ifdef USE_NNTP ++ if (optnews) ++ set_option (OPTNEWS); ++#endif + } + + return (PostCount); +diff -udprP mutt-1.5.20.orig/protos.h mutt-1.5.20/protos.h +--- mutt-1.5.20.orig/protos.h 2009-06-13 02:38:52.000000000 +0300 ++++ mutt-1.5.20/protos.h 2009-06-15 21:05:24.000000000 +0300 +@@ -115,6 +115,7 @@ HASH *mutt_make_id_hash (CONTEXT *); + HASH *mutt_make_subj_hash (CONTEXT *); + + LIST *mutt_make_references(ENVELOPE *e); ++LIST *mutt_parse_references (char *, int); + + char *mutt_read_rfc822_line (FILE *, char *, size_t *); + ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short); +diff -udprP mutt-1.5.20.orig/recvattach.c mutt-1.5.20/recvattach.c +--- mutt-1.5.20.orig/recvattach.c 2009-05-19 03:11:35.000000000 +0300 ++++ mutt-1.5.20/recvattach.c 2009-06-15 21:05:24.000000000 +0300 +@@ -1110,6 +1110,15 @@ void mutt_view_attachments (HEADER *hdr) + } + #endif + ++#ifdef USE_NNTP ++ if (Context->magic == M_NNTP) ++ { ++ mutt_flushinp (); ++ mutt_error _("Can't delete attachment from newsserver."); ++ break; ++ } ++#endif ++ + if (WithCrypto && hdr->security & ~PGP_TRADITIONAL_CHECKED) + { + mutt_message _( +@@ -1201,10 +1210,33 @@ void mutt_view_attachments (HEADER *hdr) + case OP_FORWARD_MESSAGE: + CHECK_ATTACH; + mutt_attach_forward (fp, hdr, idx, idxlen, +- menu->tagprefix ? NULL : idx[menu->current]->content); ++ menu->tagprefix ? NULL : idx[menu->current]->content, 0); + menu->redraw = REDRAW_FULL; + break; + ++#ifdef USE_NNTP ++ case OP_FORWARD_TO_GROUP: ++ CHECK_ATTACH; ++ mutt_attach_forward (fp, hdr, idx, idxlen, ++ menu->tagprefix ? NULL : idx[menu->current]->content, SENDNEWS); ++ menu->redraw = REDRAW_FULL; ++ break; ++ ++ case OP_FOLLOWUP: ++ CHECK_ATTACH; ++ ++ if (!idx[menu->current]->content->hdr->env->followup_to || ++ mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to, "poster") || ++ query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES) ++ { ++ mutt_attach_reply (fp, hdr, idx, idxlen, ++ menu->tagprefix ? NULL : idx[menu->current]->content, ++ SENDNEWS|SENDREPLY); ++ menu->redraw = REDRAW_FULL; ++ break; ++ } ++#endif ++ + case OP_REPLY: + case OP_GROUP_REPLY: + case OP_LIST_REPLY: +diff -udprP mutt-1.5.20.orig/recvcmd.c mutt-1.5.20/recvcmd.c +--- mutt-1.5.20.orig/recvcmd.c 2009-06-12 20:24:17.000000000 +0300 ++++ mutt-1.5.20/recvcmd.c 2009-06-15 21:05:24.000000000 +0300 +@@ -401,7 +401,7 @@ static BODY ** copy_problematic_attachme + static void attach_forward_bodies (FILE * fp, HEADER * hdr, + ATTACHPTR ** idx, short idxlen, + BODY * cur, +- short nattach) ++ short nattach, int flags) + { + short i; + short mime_fwd_all = 0; +@@ -547,7 +547,7 @@ _("Can't decode all tagged attachments. + tmpfp = NULL; + + /* now that we have the template, send it. */ +- ci_send_message (0, tmphdr, tmpbody, NULL, parent); ++ ci_send_message (flags, tmphdr, tmpbody, NULL, parent); + return; + + bail: +@@ -574,7 +574,7 @@ _("Can't decode all tagged attachments. + */ + + static void attach_forward_msgs (FILE * fp, HEADER * hdr, +- ATTACHPTR ** idx, short idxlen, BODY * cur) ++ ATTACHPTR ** idx, short idxlen, BODY * cur, int flags) + { + HEADER *curhdr = NULL; + HEADER *tmphdr; +@@ -679,23 +679,23 @@ static void attach_forward_msgs (FILE * + else + mutt_free_header (&tmphdr); + +- ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL, ++ ci_send_message (flags, tmphdr, *tmpbody ? tmpbody : NULL, + NULL, curhdr); + + } + + void mutt_attach_forward (FILE * fp, HEADER * hdr, +- ATTACHPTR ** idx, short idxlen, BODY * cur) ++ ATTACHPTR ** idx, short idxlen, BODY * cur, int flags) + { + short nattach; + + + if (check_all_msg (idx, idxlen, cur, 0) == 0) +- attach_forward_msgs (fp, hdr, idx, idxlen, cur); ++ attach_forward_msgs (fp, hdr, idx, idxlen, cur, flags); + else + { + nattach = count_tagged (idx, idxlen); +- attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach); ++ attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach, flags); + } + } + +@@ -753,28 +753,40 @@ attach_reply_envelope_defaults (ENVELOPE + return -1; + } + +- if (parent) ++#ifdef USE_NNTP ++ if ((flags & SENDNEWS)) + { +- if (mutt_fetch_recips (env, curenv, flags) == -1) +- return -1; ++ /* in case followup set Newsgroups: with Followup-To: if it present */ ++ if (!env->newsgroups && curenv && ++ mutt_strcasecmp (curenv->followup_to, "poster")) ++ env->newsgroups = safe_strdup (curenv->followup_to); + } + else ++#endif + { +- for (i = 0; i < idxlen; i++) ++ if (parent) + { +- if (idx[i]->content->tagged +- && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1) ++ if (mutt_fetch_recips (env, curenv, flags) == -1) + return -1; + } ++ else ++ { ++ for (i = 0; i < idxlen; i++) ++ { ++ if (idx[i]->content->tagged ++ && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1) ++ return -1; ++ } ++ } ++ ++ if ((flags & SENDLISTREPLY) && !env->to) ++ { ++ mutt_error _("No mailing lists found!"); ++ return (-1); ++ } ++ ++ mutt_fix_reply_recipients (env); + } +- +- if ((flags & SENDLISTREPLY) && !env->to) +- { +- mutt_error _("No mailing lists found!"); +- return (-1); +- } +- +- mutt_fix_reply_recipients (env); + mutt_make_misc_reply_headers (env, Context, curhdr, curenv); + + if (parent) +@@ -835,6 +847,13 @@ void mutt_attach_reply (FILE * fp, HEADE + char prefix[SHORT_STRING]; + int rc; + ++#ifdef USE_NNTP ++ if (flags & SENDNEWS) ++ set_option (OPTNEWSSEND); ++ else ++ unset_option (OPTNEWSSEND); ++#endif ++ + if (check_all_msg (idx, idxlen, cur, 0) == -1) + { + nattach = count_tagged (idx, idxlen); +diff -udprP mutt-1.5.20.orig/rfc1524.c mutt-1.5.20/rfc1524.c +--- mutt-1.5.20.orig/rfc1524.c 2009-05-30 20:20:08.000000000 +0300 ++++ mutt-1.5.20/rfc1524.c 2009-06-15 21:05:24.000000000 +0300 +@@ -569,13 +569,13 @@ int rfc1524_expand_filename (char *namet + * safe_fopen(). + */ + +-int mutt_rename_file (char *oldfile, char *newfile) ++int _mutt_rename_file (char *oldfile, char *newfile, int overwrite) + { + FILE *ofp, *nfp; + + if (access (oldfile, F_OK) != 0) + return 1; +- if (access (newfile, F_OK) == 0) ++ if (!overwrite && access (newfile, F_OK) == 0) + return 2; + if ((ofp = fopen (oldfile,"r")) == NULL) + return 3; +@@ -590,3 +590,8 @@ int mutt_rename_file (char *oldfile, cha + mutt_unlink (oldfile); + return 0; + } ++ ++int mutt_rename_file (char *oldfile, char *newfile) ++{ ++ return _mutt_rename_file (oldfile, newfile, 0); ++} +diff -udprP mutt-1.5.20.orig/rfc1524.h mutt-1.5.20/rfc1524.h +--- mutt-1.5.20.orig/rfc1524.h 2008-11-11 21:55:47.000000000 +0200 ++++ mutt-1.5.20/rfc1524.h 2009-06-15 21:05:24.000000000 +0300 +@@ -40,5 +40,6 @@ int rfc1524_expand_command (BODY *, char + int rfc1524_expand_filename (char *, char *, char *, size_t); + int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int); + int mutt_rename_file (char *, char *); ++int _mutt_rename_file (char *, char *, int); + + #endif /* _RFC1524_H */ +diff -udprP mutt-1.5.20.orig/send.c mutt-1.5.20/send.c +--- mutt-1.5.20.orig/send.c 2009-06-13 02:38:52.000000000 +0300 ++++ mutt-1.5.20/send.c 2009-06-15 21:13:13.000000000 +0300 +@@ -44,6 +44,11 @@ + #include + #include + ++#ifdef USE_NNTP ++#include "nntp.h" ++#include "mx.h" ++#endif ++ + #ifdef MIXMASTER + #include "remailer.h" + #endif +@@ -213,17 +218,51 @@ static int edit_address (ADDRESS **a, /* + return 0; + } + +-static int edit_envelope (ENVELOPE *en) ++static int edit_envelope (ENVELOPE *en, int flags) + { + char buf[HUGE_STRING]; + LIST *uh = UserHeader; + +- if (edit_address (&en->to, "To: ") == -1 || en->to == NULL) +- return (-1); +- if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1) +- return (-1); +- if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1) +- return (-1); ++#ifdef USE_NNTP ++ if (option (OPTNEWSSEND)) ++ { ++ if (en->newsgroups) ++ strfcpy (buf, en->newsgroups, sizeof (buf)); ++ else ++ buf[0] = 0; ++ if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0) ++ return (-1); ++ FREE (&en->newsgroups); ++ en->newsgroups = safe_strdup (buf); ++ ++ if (en->followup_to) ++ strfcpy (buf, en->followup_to, sizeof (buf)); ++ else ++ buf[0] = 0; ++ if (option (OPTASKFOLLOWUP) && mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0) ++ return (-1); ++ FREE (&en->followup_to); ++ en->followup_to = safe_strdup (buf); ++ ++ if (en->x_comment_to) ++ strfcpy (buf, en->x_comment_to, sizeof (buf)); ++ else ++ buf[0] = 0; ++ if (option (OPTXCOMMENTTO) && option (OPTASKXCOMMENTTO) && mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0) ++ return (-1); ++ FREE (&en->x_comment_to); ++ en->x_comment_to = safe_strdup (buf); ++ } ++ else ++#endif ++ { ++ if (edit_address (&en->to, "To: ") == -1 || en->to == NULL) ++ return (-1); ++ if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1) ++ return (-1); ++ if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1) ++ return (-1); ++ } + + if (en->subject) + { +@@ -259,6 +298,14 @@ static int edit_envelope (ENVELOPE *en) + return 0; + } + ++#ifdef USE_NNTP ++char *nntp_get_header (const char *s) ++{ ++ SKIPWS (s); ++ return safe_strdup (s); ++} ++#endif ++ + static void process_user_recips (ENVELOPE *env) + { + LIST *uh = UserHeader; +@@ -271,6 +318,14 @@ static void process_user_recips (ENVELOP + env->cc = rfc822_parse_adrlist (env->cc, uh->data + 3); + else if (ascii_strncasecmp ("bcc:", uh->data, 4) == 0) + env->bcc = rfc822_parse_adrlist (env->bcc, uh->data + 4); ++#ifdef USE_NNTP ++ else if (ascii_strncasecmp ("newsgroups:", uh->data, 11) == 0) ++ env->newsgroups = nntp_get_header (uh->data + 11); ++ else if (ascii_strncasecmp ("followup-to:", uh->data, 12) == 0) ++ env->followup_to = nntp_get_header (uh->data + 12); ++ else if (ascii_strncasecmp ("x-comment-to:", uh->data, 13) == 0) ++ env->x_comment_to = nntp_get_header (uh->data + 13); ++#endif + } + } + +@@ -309,6 +364,12 @@ static void process_user_header (ENVELOP + else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 && + ascii_strncasecmp ("cc:", uh->data, 3) != 0 && + ascii_strncasecmp ("bcc:", uh->data, 4) != 0 && ++#ifdef USE_NNTP ++ ascii_strncasecmp ("newsgroups:", uh->data, 11) != 0 && ++ ascii_strncasecmp ("followup-to:", uh->data, 12) != 0 && ++ ascii_strncasecmp ("x-comment-to:", uh->data, 13) != 0 && ++#endif ++ ascii_strncasecmp ("supersedes:", uh->data, 11) != 0 && + ascii_strncasecmp ("subject:", uh->data, 8) != 0 && + ascii_strncasecmp ("return-path:", uh->data, 12) != 0) + { +@@ -657,6 +718,10 @@ void mutt_add_to_reference_headers (ENVE + if (pp) *pp = p; + if (qq) *qq = q; + ++#ifdef USE_NNTP ++ if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from) ++ env->x_comment_to = safe_strdup (mutt_get_name (curenv->from)); ++#endif + } + + static void +@@ -719,6 +784,16 @@ envelope_defaults (ENVELOPE *env, CONTEX + + if (flags & SENDREPLY) + { ++#ifdef USE_NNTP ++ if ((flags & SENDNEWS)) ++ { ++ /* in case followup set Newsgroups: with Followup-To: if it present */ ++ if (!env->newsgroups && curenv && ++ mutt_strcasecmp (curenv->followup_to, "poster")) ++ env->newsgroups = safe_strdup (curenv->followup_to); ++ } ++ else ++#endif + if (tag) + { + HEADER *h; +@@ -865,7 +940,18 @@ void mutt_set_followup_to (ENVELOPE *e) + * it hasn't already been set + */ + +- if (option (OPTFOLLOWUPTO) && !e->mail_followup_to) ++ if (!option (OPTFOLLOWUPTO)) ++ return; ++#ifdef USE_NNTP ++ if (option (OPTNEWSSEND)) ++ { ++ if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ','))) ++ e->followup_to = safe_strdup (e->newsgroups); ++ return; ++ } ++#endif ++ ++ if (!e->mail_followup_to) + { + if (mutt_is_list_cc (0, e->to, e->cc)) + { +@@ -1026,6 +1112,9 @@ static int send_message (HEADER *msg) + #endif + + #if USE_SMTP ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++#endif /* USE_NNTP */ + if (SmtpUrl) + return mutt_smtp_send (msg->env->from, msg->env->to, msg->env->cc, + msg->env->bcc, tempfile, +@@ -1137,6 +1226,13 @@ ci_send_message (int flags, /* send mod + + int rv = -1; + ++#ifdef USE_NNTP ++ if (flags & SENDNEWS) ++ set_option (OPTNEWSSEND); ++ else ++ unset_option (OPTNEWSSEND); ++#endif ++ + if (!flags && !msg && quadoption (OPT_RECALL) != M_NO && + mutt_num_postponed (1)) + { +@@ -1167,6 +1263,22 @@ ci_send_message (int flags, /* send mod + { + if ((flags = mutt_get_postponed (ctx, msg, &cur, fcc, sizeof (fcc))) < 0) + goto cleanup; ++#ifdef USE_NNTP ++ /* ++ * If postponed message is a news article, it have ++ * a "Newsgroups:" header line, then set appropriate flag. ++ */ ++ if (msg->env->newsgroups) ++ { ++ flags |= SENDNEWS; ++ set_option (OPTNEWSSEND); ++ } ++ else ++ { ++ flags &= ~SENDNEWS; ++ unset_option (OPTNEWSSEND); ++ } ++#endif + } + + if (flags & (SENDPOSTPONED|SENDRESEND)) +@@ -1278,11 +1390,16 @@ ci_send_message (int flags, /* send mod + if (flags & SENDREPLY) + mutt_fix_reply_recipients (msg->env); + ++#ifdef USE_NNTP ++ if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP && !msg->env->newsgroups) ++ msg->env->newsgroups = safe_strdup (((NNTP_DATA *)ctx->data)->group); ++#endif ++ + if (! (flags & SENDMAILX) && + ! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) && + ! ((flags & SENDREPLY) && option (OPTFASTREPLY))) + { +- if (edit_envelope (msg->env) == -1) ++ if (edit_envelope (msg->env, flags) == -1) + goto cleanup; + } + +@@ -1539,6 +1656,11 @@ main_loop: + if (i == -1) + { + /* abort */ ++#ifdef USE_NNTP ++ if (flags & SENDNEWS) ++ mutt_message _("Article not posted."); ++ else ++#endif + mutt_message _("Mail not sent."); + goto cleanup; + } +@@ -1571,6 +1693,9 @@ main_loop: + } + } + ++#ifdef USE_NNTP ++ if (!(flags & SENDNEWS)) ++#endif + if (!has_recips (msg->env->to) && !has_recips (msg->env->cc) && + !has_recips (msg->env->bcc)) + { +@@ -1604,6 +1729,19 @@ main_loop: + mutt_error _("No subject specified."); + goto main_loop; + } ++#ifdef USE_NNTP ++ if ((flags & SENDNEWS) && !msg->env->subject) ++ { ++ mutt_error _("No subject specified."); ++ goto main_loop; ++ } ++ ++ if ((flags & SENDNEWS) && !msg->env->newsgroups) ++ { ++ mutt_error _("No newsgroup specified."); ++ goto main_loop; ++ } ++#endif + + if (msg->content->next) + msg->content = mutt_make_multipart (msg->content); +@@ -1810,7 +1948,12 @@ full_fcc: + } + } + else if (!option (OPTNOCURSES) && ! (flags & SENDMAILX)) +- mutt_message (i == 0 ? _("Mail sent.") : _("Sending in background.")); ++ mutt_message (i != 0 ? _("Sending in background.") : ++#ifdef USE_NNTP ++ (flags & SENDNEWS) ? _("Article posted.") : _("Mail sent.")); ++#else ++ _("Mail sent.")); ++#endif + + if (WithCrypto && (msg->security & ENCRYPT)) + FREE (&pgpkeylist); +diff -udprP mutt-1.5.20.orig/sendlib.c mutt-1.5.20/sendlib.c +--- mutt-1.5.20.orig/sendlib.c 2009-06-14 18:46:11.000000000 +0300 ++++ mutt-1.5.20/sendlib.c 2009-06-15 21:51:17.000000000 +0300 +@@ -46,6 +46,10 @@ + #include + #include + ++#ifdef USE_NNTP ++#include "nntp.h" ++#endif ++ + #ifdef HAVE_SYSEXITS_H + #include + #else /* Make sure EX_OK is defined */ +@@ -1868,6 +1872,9 @@ int mutt_write_rfc822_header (FILE *fp, + mutt_write_address_list (env->to, fp, 4, 0); + } + else if (mode > 0) ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++#endif + fputs ("To: \n", fp); + + if (env->cc) +@@ -1876,6 +1883,9 @@ int mutt_write_rfc822_header (FILE *fp, + mutt_write_address_list (env->cc, fp, 4, 0); + } + else if (mode > 0) ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++#endif + fputs ("Cc: \n", fp); + + if (env->bcc) +@@ -1887,8 +1897,28 @@ int mutt_write_rfc822_header (FILE *fp, + } + } + else if (mode > 0) ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++#endif + fputs ("Bcc: \n", fp); + ++#ifdef USE_NNTP ++ if (env->newsgroups) ++ fprintf (fp, "Newsgroups: %s\n", env->newsgroups); ++ else if (mode == 1 && option (OPTNEWSSEND)) ++ fputs ("Newsgroups: \n", fp); ++ ++ if (env->followup_to) ++ fprintf (fp, "Followup-To: %s\n", env->followup_to); ++ else if (mode == 1 && option (OPTNEWSSEND)) ++ fputs ("Followup-To: \n", fp); ++ ++ if (env->x_comment_to) ++ fprintf (fp, "X-Comment-To: %s\n", env->x_comment_to); ++ else if (mode == 1 && option (OPTNEWSSEND) && option (OPTXCOMMENTTO)) ++ fputs ("X-Comment-To: \n", fp); ++#endif ++ + if (env->subject) + mutt_write_one_header (fp, "Subject", env->subject, NULL, 0, 0); + else if (mode == 1) +@@ -1907,6 +1937,9 @@ int mutt_write_rfc822_header (FILE *fp, + fputs ("Reply-To: \n", fp); + + if (env->mail_followup_to) ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++#endif + { + fputs ("Mail-Followup-To: ", fp); + mutt_write_address_list (env->mail_followup_to, fp, 18, 0); +@@ -2245,11 +2278,30 @@ mutt_invoke_sendmail (ADDRESS *from, /* + const char *msg, /* file containing message */ + int eightbit) /* message contains 8bit chars */ + { +- char *ps = NULL, *path = NULL, *s = safe_strdup (Sendmail), *childout = NULL; ++ char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL; + char **args = NULL; + size_t argslen = 0, argsmax = 0; + int i; + ++#ifdef USE_NNTP ++ if (option (OPTNEWSSEND)) ++ { ++ char cmd[LONG_STRING]; ++ ++ mutt_FormatString (cmd, sizeof (cmd), 0, NONULL (Inews), nntp_format_str, 0, 0); ++ if (!*cmd) ++ { ++ i = nntp_post (msg); ++ unlink (msg); ++ return i; ++ } ++ ++ s = safe_strdup (cmd); ++ } ++ else ++#endif ++ s = safe_strdup (Sendmail); ++ + ps = s; + i = 0; + while ((ps = strtok (ps, " "))) +@@ -2273,6 +2325,10 @@ mutt_invoke_sendmail (ADDRESS *from, /* + i++; + } + ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND)) ++ { ++#endif + if (eightbit && option (OPTUSE8BITMIME)) + args = add_option (args, &argslen, &argsmax, "-B8BITMIME"); + +@@ -2304,6 +2360,9 @@ mutt_invoke_sendmail (ADDRESS *from, /* + args = add_args (args, &argslen, &argsmax, to); + args = add_args (args, &argslen, &argsmax, cc); + args = add_args (args, &argslen, &argsmax, bcc); ++#ifdef USE_NNTP ++ } ++#endif + + if (argslen == argsmax) + safe_realloc (&args, sizeof (char *) * (++argsmax)); +@@ -2384,6 +2443,9 @@ void mutt_prepare_envelope (ENVELOPE *en + rfc2047_encode_string (&env->x_label); + + if (env->subject) ++#ifdef USE_NNTP ++ if (!option (OPTNEWSSEND) || option (OPTMIMESUBJECT)) ++#endif + { + rfc2047_encode_string (&env->subject); + } +@@ -2504,6 +2566,10 @@ int mutt_bounce_message (FILE *fp, HEADE + } + rfc822_write_address (resent_from, sizeof (resent_from), from, 0); + ++#ifdef USE_NNTP ++ unset_option (OPTNEWSSEND); ++#endif ++ + ret = _mutt_bounce_message (fp, h, to, resent_from, from); + + rfc822_free_address (&from); +diff -udprP mutt-1.5.20.orig/sort.c mutt-1.5.20/sort.c +--- mutt-1.5.20.orig/sort.c 2008-11-11 21:55:47.000000000 +0200 ++++ mutt-1.5.20/sort.c 2009-06-15 21:05:24.000000000 +0300 +@@ -151,6 +151,15 @@ static int compare_order (const void *a, + HEADER **ha = (HEADER **) a; + HEADER **hb = (HEADER **) b; + ++#ifdef USE_NNTP ++ if ((*ha)->article_num && (*hb)->article_num) ++ { ++ int result = (*ha)->article_num - (*hb)->article_num; ++ AUXSORT(result,a,b); ++ return (SORTCODE (result)); ++ } ++ else ++#endif + /* no need to auxsort because you will never have equality here */ + return (SORTCODE ((*ha)->index - (*hb)->index)); + } +diff -udprP mutt-1.5.20.orig/url.c mutt-1.5.20/url.c +--- mutt-1.5.20.orig/url.c 2009-06-01 19:29:32.000000000 +0300 ++++ mutt-1.5.20/url.c 2009-06-15 21:05:24.000000000 +0300 +@@ -39,6 +39,8 @@ static struct mapping_t UrlMap[] = + { "imaps", U_IMAPS }, + { "pop", U_POP }, + { "pops", U_POPS }, ++ { "news", U_NNTP }, ++ { "newss", U_NNTPS }, + { "mailto", U_MAILTO }, + { "smtp", U_SMTP }, + { "smtps", U_SMTPS }, +diff -udprP mutt-1.5.20.orig/url.h mutt-1.5.20/url.h +--- mutt-1.5.20.orig/url.h 2008-11-11 21:55:47.000000000 +0200 ++++ mutt-1.5.20/url.h 2009-06-15 21:05:24.000000000 +0300 +@@ -8,6 +8,8 @@ typedef enum url_scheme + U_POPS, + U_IMAP, + U_IMAPS, ++ U_NNTP, ++ U_NNTPS, + U_SMTP, + U_SMTPS, + U_MAILTO, +diff -udprP mutt-1.5.20.orig/Makefile.am mutt-1.5.20/Makefile.am +--- mutt-1.5.20.orig/Makefile.am 2009-01-05 04:11:29.000000000 +0200 ++++ mutt-1.5.20/Makefile.am 2009-06-15 21:05:24.000000000 +0300 +@@ -53,6 +53,7 @@ EXTRA_mutt_SOURCES = account.c bcache.c + mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \ + mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \ + pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \ ++ nntp.c newsrc.c \ + smime.c smtp.c utf8.c wcwidth.c \ + bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h + +@@ -64,6 +65,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP O + mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ + mx.h pager.h pgp.h pop.h protos.h rfc1524.h rfc2047.h \ + rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \ ++ nntp.h ChangeLog.nntp \ + _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \ + mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \ + README.SSL smime.h \ +diff -udprP mutt-1.5.20.orig/Makefile.in mutt-1.5.20/Makefile.in +--- mutt-1.5.20.orig/Makefile.in 2009-06-09 09:50:44.000000000 +0300 ++++ mutt-1.5.20/Makefile.in 2009-06-15 21:05:24.000000000 +0300 +@@ -372,6 +372,7 @@ EXTRA_mutt_SOURCES = account.c bcache.c + mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \ + mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \ + pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \ ++ nntp.c newsrc.c \ + smime.c smtp.c utf8.c wcwidth.c \ + bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h + +@@ -383,6 +384,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP O + mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ + mx.h pager.h pgp.h pop.h protos.h rfc1524.h rfc2047.h \ + rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \ ++ nntp.h ChangeLog.nntp \ + _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \ + mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \ + README.SSL smime.h \ +@@ -637,6 +639,8 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutt_tunnel.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/muttlib.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mx.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newsrc.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nntp.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pager.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/patchlist.Po@am__quote@ +diff -udprP mutt-1.5.20.orig/configure mutt-1.5.20/configure +--- mutt-1.5.20.orig/configure 2009-06-09 09:50:42.000000000 +0300 ++++ mutt-1.5.20/configure 2009-06-15 21:05:24.000000000 +0300 +@@ -1478,6 +1478,7 @@ Optional Features: + Force use of an external dotlock program + --enable-pop Enable POP3 support + --enable-imap Enable IMAP support ++ --enable-nntp Enable NNTP support + --enable-smtp include internal SMTP relay support + --enable-debug Enable debugging support + --enable-flock Use flock() to lock files +@@ -14198,6 +14199,20 @@ fi + fi + done + ++# Check whether --enable-nntp or --disable-nntp was given. ++if test "${enable_nntp+set}" = set; then ++ enableval="$enable_nntp" ++ if test x$enableval = xyes ; then ++ cat >>confdefs.h <<\_ACEOF ++#define USE_NNTP 1 ++_ACEOF ++ ++ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS nntp.o newsrc.o" ++ need_socket="yes" ++ fi ++ ++fi; ++ + + + for ac_func in strftime +diff -udprP mutt-1.5.20.orig/doc/Muttrc mutt-1.5.20/doc/Muttrc +--- mutt-1.5.20.orig/doc/Muttrc 2009-06-14 21:53:24.000000000 +0300 ++++ mutt-1.5.20/doc/Muttrc 2009-06-15 21:05:24.000000000 +0300 +@@ -281,6 +281,28 @@ attachments -I message/external-body + # of the value as shown above if included. + # + # ++# set ask_follow_up=no ++# ++# Name: ask_follow_up ++# Type: boolean ++# Default: no ++# ++# ++# If set, Mutt will prompt you for follow-up groups before editing ++# the body of an outgoing message. ++# ++# ++# set ask_x_comment_to=no ++# ++# Name: ask_x_comment_to ++# Type: boolean ++# Default: no ++# ++# ++# If set, Mutt will prompt you for x-comment-to field before editing ++# the body of an outgoing message. ++# ++# + # set attach_format="%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " + # + # Name: attach_format +@@ -466,6 +488,17 @@ attachments -I message/external-body + # set certificate_file=~/.mutt/certificates + # + # ++# set catchup_newsgroup=ask-yes ++# ++# Name: catchup_newsgroup ++# Type: quadoption ++# Default: ask-yes ++# ++# ++# If this variable is set, Mutt will mark all articles in newsgroup ++# as read when you quit the newsgroup (catchup newsgroup). ++# ++# + # set charset="" + # + # Name: charset +@@ -1121,6 +1154,19 @@ attachments -I message/external-body + # of the same email for you. + # + # ++# set followup_to_poster=ask-yes ++# ++# Name: followup_to_poster ++# Type: quadoption ++# Default: ask-yes ++# ++# ++# If this variable is set and the keyword "poster" is present in ++# Followup-To header, follow-up to newsgroup function is not ++# permitted. The message will be mailed to the submitter of the ++# message via mail. ++# ++# + # set force_name=no + # + # Name: force_name +@@ -1231,6 +1277,28 @@ attachments -I message/external-body + # ``Franklin'' to ``Franklin, Steve''. + # + # ++# set group_index_format="%4C %M%N %5s %-45.45f %d" ++# ++# Name: group_index_format ++# Type: string ++# Default: "%4C %M%N %5s %-45.45f %d" ++# ++# ++# This variable allows you to customize the newsgroup browser display to ++# your personal taste. This string is similar to ``index_format'', but ++# has its own set of printf()-like sequences: ++# ++# %C current newsgroup number ++# %d description of newsgroup (becomes from server) ++# %f newsgroup name ++# %M - if newsgroup not allowed for direct post (moderated for example) ++# %N N if newsgroup is new, u if unsubscribed, blank otherwise ++# %n number of new articles in newsgroup ++# %s number of unread articles in newsgroup ++# %>X right justify the rest of the string and pad with character "X" ++# %|X pad to the end of the line with character "X" ++# ++# + # set hdrs=yes + # + # Name: hdrs +@@ -1779,6 +1847,7 @@ attachments -I message/external-body + # %E number of messages in current thread + # %f sender (address + real name), either From: or Return-Path: + # %F author name, or recipient name if the message is from you ++# %g newsgroup name (if compiled with nntp support) + # %H spam attribute(s) of this message + # %i message-id of the current message + # %l number of lines in the message (does not work with maildir, +@@ -1794,12 +1863,14 @@ attachments -I message/external-body + # stashed the message: list name or recipient name + # if not sent to a list + # %P progress indicator for the builtin pager (how much of the file has been displayed) ++# %R `x-comment-to:' field (if present and compiled with nntp support) + # %s subject of the message + # %S status of the message (``N''/``D''/``d''/``!''/``r''/*) + # %t ``To:'' field (recipients) + # %T the appropriate character from the $to_chars string + # %u user (login) name of the author + # %v first name of the author, or the recipient if the message is from you ++# %W name of organization of author (`organization:' field) + # %X number of attachments + # (please see the ``attachments'' section for possible speed effects) + # %y ``X-Label:'' field, if present +@@ -1835,6 +1906,22 @@ attachments -I message/external-body + # ``save-hook'', ``fcc-hook'' and ``fcc-save-hook'', too. + # + # ++# set inews="" ++# ++# Name: inews ++# Type: path ++# Default: "" ++# ++# ++# If set, specifies the program and arguments used to deliver news posted ++# by Mutt. Otherwise, mutt posts article using current connection to ++# news server. The following printf-style sequence is understood: ++# ++# %s newsserver name ++# ++# Example: set inews="/usr/local/bin/inews -hS" ++# ++# + # set ispell="ispell" + # + # Name: ispell +@@ -2188,6 +2275,18 @@ attachments -I message/external-body + # be attached to the newly composed message if this option is set. + # + # ++# set mime_subject=yes ++# ++# Name: mime_subject ++# Type: boolean ++# Default: yes ++# ++# ++# If unset, 8-bit ``subject:'' line in article header will not be ++# encoded according to RFC2047 to base64. This is useful when message ++# is Usenet article, because MIME for news is nonstandard feature. ++# ++# + # set mix_entry_format="%4n %c %-16s %a" + # + # Name: mix_entry_format +@@ -2254,6 +2353,118 @@ attachments -I message/external-body + # See also $read_inc, $write_inc and $net_inc. + # + # ++# set news_cache_dir="~/.mutt" ++# ++# Name: news_cache_dir ++# Type: path ++# Default: "~/.mutt" ++# ++# ++# This variable pointing to directory where Mutt will save cached news ++# articles headers in. If unset, headers will not be saved at all ++# and will be reloaded each time when you enter to newsgroup. ++# ++# ++# set news_server="" ++# ++# Name: news_server ++# Type: string ++# Default: "" ++# ++# ++# This variable specifies domain name or address of NNTP server. It ++# defaults to the newsserver specified in the environment variable ++# $NNTPSERVER or contained in the file /etc/nntpserver. You can also ++# specify username and an alternative port for each newsserver, ie: ++# ++# [news[s]://][username[:password]@]newsserver[:port] ++# ++# ++# set newsrc="~/.newsrc" ++# ++# Name: newsrc ++# Type: path ++# Default: "~/.newsrc" ++# ++# ++# The file, containing info about subscribed newsgroups - names and ++# indexes of read articles. The following printf-style sequence ++# is understood: ++# ++# %s newsserver name ++# ++# ++# set nntp_context=1000 ++# ++# Name: nntp_context ++# Type: number ++# Default: 1000 ++# ++# ++# This variable defines number of articles which will be in index when ++# newsgroup entered. If active newsgroup have more articles than this ++# number, oldest articles will be ignored. Also controls how many ++# articles headers will be saved in cache when you quit newsgroup. ++# ++# ++# set nntp_load_description=yes ++# ++# Name: nntp_load_description ++# Type: boolean ++# Default: yes ++# ++# ++# This variable controls whether or not descriptions for each newsgroup ++# must be loaded when newsgroup is added to list (first time list ++# loading or new newsgroup adding). ++# ++# ++# set nntp_user="" ++# ++# Name: nntp_user ++# Type: string ++# Default: "" ++# ++# ++# Your login name on the NNTP server. If unset and NNTP server requires ++# authentification, Mutt will prompt you for your account name when you ++# connect to newsserver. ++# ++# ++# set nntp_pass="" ++# ++# Name: nntp_pass ++# Type: string ++# Default: "" ++# ++# ++# Your password for NNTP account. ++# ++# ++# set nntp_poll=60 ++# ++# Name: nntp_poll ++# Type: number ++# Default: 60 ++# ++# ++# The time in seconds until any operations on newsgroup except post new ++# article will cause recheck for new news. If set to 0, Mutt will ++# recheck newsgroup on each operation in index (stepping, read article, ++# etc.). ++# ++# ++# set nntp_reconnect=ask-yes ++# ++# Name: nntp_reconnect ++# Type: quadoption ++# Default: ask-yes ++# ++# ++# Controls whether or not Mutt will try to reconnect to newsserver when ++# connection lost. ++# ++# + # set pager="builtin" + # + # Name: pager +@@ -2969,6 +3180,19 @@ attachments -I message/external-body + # string after the inclusion of a message which is being replied to. + # + # ++# set post_moderated=ask-yes ++# ++# Name: post_moderated ++# Type: quadoption ++# Default: ask-yes ++# ++# ++# If set to yes, Mutt will post article to newsgroup that have ++# not permissions to posting (e.g. moderated). Note: if newsserver ++# does not support posting to that newsgroup or totally read-only, that ++# posting will not have an effect. ++# ++# + # set postpone=ask-yes + # + # Name: postpone +@@ -3543,6 +3767,41 @@ attachments -I message/external-body + # shell from /etc/passwd is used. + # + # ++# set save_unsubscribed=no ++# ++# Name: save_unsubscribed ++# Type: boolean ++# Default: no ++# ++# ++# When set, info about unsubscribed newsgroups will be saved into ++# ``newsrc'' file and into cache. ++# ++# ++# set show_new_news=yes ++# ++# Name: show_new_news ++# Type: boolean ++# Default: yes ++# ++# ++# If set, newsserver will be asked for new newsgroups on entering ++# the browser. Otherwise, it will be done only once for a newsserver. ++# Also controls whether or not number of new articles of subscribed ++# newsgroups will be then checked. ++# ++# ++# set show_only_unread=no ++# ++# Name: show_only_unread ++# Type: boolean ++# Default: no ++# ++# ++# If set, only subscribed newsgroups that contain unread articles ++# will be displayed in browser. ++# ++# + # set sig_dashes=yes + # + # Name: sig_dashes +@@ -4748,3 +5007,14 @@ attachments -I message/external-body + # ``tuning'' section of the manual for performance considerations. + # + # ++# set x_comment_to=no ++# ++# Name: x_comment_to ++# Type: boolean ++# Default: no ++# ++# ++# If set, Mutt will add ``X-Comment-To:'' field (that contains full ++# name of original article author) to article that followuped to newsgroup. ++# ++# +--- a/PATCHES ++++ b/PATCHES +@@ -0,0 +1 @@ ++vvv.nntp --- mutt-1.5.21.orig/debian/patches/mutt-patched/sidebar-dotted +++ mutt-1.5.21/debian/patches/mutt-patched/sidebar-dotted @@ -0,0 +1,64 @@ +From: Evgeni Golov +License: 3-BSD + +When using IMAP, a '.' is often used as a separator instead of '/'. +This patch enables mutt to find these dots and +1. correctly intend the dir in the sidebar +2. if "sidebar_shortpath" is set, shorten the dir to the part after + the last dot + +I hope, it's usefull for someone ;) + +--- a/sidebar.c ++++ b/sidebar.c +@@ -255,14 +255,23 @@ + int i; + tmp_folder_name = tmp->path + strlen(Maildir); + for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) { +- if (tmp_folder_name[i] == '/') sidebar_folder_depth++; ++ if (tmp_folder_name[i] == '/' || tmp_folder_name[i] == '.') sidebar_folder_depth++; + } + if (sidebar_folder_depth > 0) { +- sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1); ++ if (option(OPTSIDEBARSHORTPATH)) { ++ tmp_folder_name = strrchr(tmp->path, '.'); ++ if (tmp_folder_name == NULL) ++ tmp_folder_name = tmp->path; ++ else ++ tmp_folder_name++; ++ } ++ else ++ tmp_folder_name = tmp->path; ++ sidebar_folder_name = malloc(strlen(basename(tmp_folder_name)) + sidebar_folder_depth + 1); + for (i=0; i < sidebar_folder_depth; i++) + sidebar_folder_name[i]=' '; + sidebar_folder_name[i]=0; +- strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth); ++ strncat(sidebar_folder_name, basename(tmp_folder_name), strlen(basename(tmp_folder_name)) + sidebar_folder_depth); + } + } + printw( "%.*s", SidebarWidth - delim_len + 1, +--- a/init.h ++++ b/init.h +@@ -1981,6 +1981,11 @@ + ** .pp + ** The width of the sidebar. + */ ++ { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 }, ++ /* ++ ** .pp ++ ** Should the sidebar shorten the path showed. ++ */ + { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, + /* + ** .pp +--- a/mutt.h ++++ b/mutt.h +@@ -432,6 +432,7 @@ + OPTSAVENAME, + OPTSCORE, + OPTSIDEBAR, ++ OPTSIDEBARSHORTPATH, + OPTSIGDASHES, + OPTSIGONTOP, + OPTSORTRE, --- mutt-1.5.21.orig/debian/patches/debian-specific/Muttrc +++ mutt-1.5.21/debian/patches/debian-specific/Muttrc @@ -0,0 +1,80 @@ +# vim:ft=diff + + * 2009-01-15 myon: refreshed for mutt-1.5.19; drop our list of ignored headers + in favor of upstream's new unignore list + +--- a/doc/Muttrc.head ++++ b/doc/Muttrc.head +@@ -12,6 +12,34 @@ + # Display the fields in this order + hdr_order date from to cc subject + ++# emacs-like bindings ++bind editor "\e" kill-word ++bind editor "\e" kill-word ++ ++# map delete-char to a sane value ++bind editor delete-char ++ ++# some people actually like these settings ++#set pager_stop ++#bind pager previous-line ++#bind pager next-line ++ ++# Specifies how to sort messages in the index menu. ++set sort=threads ++ ++# The behavior of this option on the Debian mutt package is ++# not the original one because exim4, the default SMTP on Debian ++# does not strip bcc headers so this can cause privacy problems; ++# see man muttrc for more info ++#unset write_bcc ++# Postfix and qmail use Delivered-To for detecting loops ++unset bounce_delivered ++ ++set mixmaster="mixmaster-filter" ++ ++# System-wide CA file managed by the ca-certificates package ++set ssl_ca_certificates_file="/etc/ssl/certs/ca-certificates.crt" ++ + # imitate the old search-body function + macro index \eb "~b " "search in message bodies" + +@@ -23,14 +51,14 @@ + "call urlview to extract URLs out of a message" + + # Show documentation when pressing F1 +-macro generic,pager " less @docdir@/manual.txt" "show Mutt documentation" ++macro generic,pager " zcat @docdir@/mutt/manual.txt.gz | sensible-pager" "show Mutt documentation" + + # show the incoming mailboxes list (just like "mutt -y") and back when pressing "y" + macro index,pager y "?" "show incoming mailboxes list" + bind browser y exit + + # If Mutt is unable to determine your site's domain name correctly, you can +-# set the default here. ++# set the default here. (better: fix /etc/mailname) + # + # set hostname=cs.hmc.edu + +@@ -42,6 +70,10 @@ + # be undone with unmime_lookup. + mime_lookup application/octet-stream + ++# Upgrade the progress counter every 250ms, good for mutt over SSH ++# see http://bugs.debian.org/537746 ++set time_inc=250 ++ + ## + ## *** DEFAULT SETTINGS FOR THE ATTACHMENTS PATCH *** + ## +@@ -96,6 +128,9 @@ + attachments -A message/external-body + attachments -I message/external-body + ++# enable mime lookup by extension ++mime_lookup application/octet-stream ++ + ## + ## More settings + ## --- mutt-1.5.21.orig/debian/patches/debian-specific/467432-write_bcc.patch +++ mutt-1.5.21/debian/patches/debian-specific/467432-write_bcc.patch @@ -0,0 +1,101 @@ +The purpose of this patch is to alter the behavior of the write_bcc option +because exim4, the default SMTP in Debian, does not strip the Bcc headers; by +default write_bcc is set so this could cause a privacy leak. + +The behavior that this patch introduces is: never write the Bcc header when the +message is sent, otherwise, if the message is sent to Fcc, then this optin +will be evaluated and the Bcc header will be written based on that. + +Background discussion on this is in the following bugs: +http://bugs.debian.org/304718 +http://bugs.debian.org/467432 + +This patch is a slightly modified version of the patch provided by +Stefan Völkel in the second bug + +--- a/headers.c ++++ b/headers.c +@@ -52,7 +52,7 @@ + } + + mutt_env_to_local (msg->env); +- mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0); ++ mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0, 1); + fputc ('\n', ofp); /* tie off the header. */ + + /* now copy the body of the message. */ +--- a/init.h ++++ b/init.h +@@ -3392,14 +3392,9 @@ + { "write_bcc", DT_BOOL, R_NONE, OPTWRITEBCC, 1}, + /* + ** .pp +- ** Controls whether mutt writes out the ``Bcc:'' header when preparing +- ** messages to be sent. Exim users may wish to unset this. If mutt +- ** is set to deliver directly via SMTP (see $$smtp_url), this +- ** option does nothing: mutt will never write out the ``Bcc:'' header +- ** in this case. +- ** .pp +- ** \fBNote:\fP On Debian systems, exim4 and postfix strip BCC headers by +- ** default. The above warning applies to exim3 users, see /etc/Muttrc. ++ ** Controls whether mutt writes out the Bcc header when saving ++ ** messages to FCC. Bcc headers will never be written to a message ++ ** when sending it. Note: this behavior is Debian specific. + */ + { "write_inc", DT_NUM, R_NONE, UL &WriteInc, 10 }, + /* +--- a/protos.h ++++ b/protos.h +@@ -366,7 +366,7 @@ + int mutt_write_mime_body (BODY *, FILE *); + int mutt_write_mime_header (BODY *, FILE *); + int mutt_write_one_header (FILE *fp, const char *tag, const char *value, const char *pfx, int wraplen, int flags); +-int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int); ++int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int, int); + void mutt_write_references (LIST *, FILE *, int); + int mutt_yesorno (const char *, int); + void mutt_set_header_color(CONTEXT *, HEADER *); +--- a/send.c ++++ b/send.c +@@ -995,10 +995,10 @@ + unset_option (OPTWRITEBCC); + #endif + #ifdef MIXMASTER +- mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, msg->chain ? 1 : 0); ++ mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, msg->chain ? 1 : 0, 0); + #endif + #ifndef MIXMASTER +- mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, 0); ++ mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, 0, 0); + #endif + #ifdef USE_SMTP + if (old_write_bcc) +--- a/sendlib.c ++++ b/sendlib.c +@@ -1929,7 +1929,7 @@ + + + int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, +- int mode, int privacy) ++ int mode, int privacy, int should_write_bcc) + { + char buffer[LONG_STRING]; + char *p, *q; +@@ -1972,7 +1972,7 @@ + else if (mode > 0) + fputs ("Cc: \n", fp); + +- if (env->bcc) ++ if (env->bcc && should_write_bcc) + { + if(mode != 0 || option(OPTWRITEBCC)) + { +@@ -2711,7 +2711,7 @@ + /* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header() + * post == 0 => Normal mode. Set mode = 0 in mutt_write_rfc822_header() + * */ +- mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0, 0); ++ mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0, 0, 1); + + /* (postponment) if this was a reply of some sort, contians the + * Message-ID: of message replied to. Save it using a special X-Mutt- --- mutt-1.5.21.orig/debian/patches/debian-specific/Md.etc_mailname_gethostbyname.diff +++ mutt-1.5.21/debian/patches/debian-specific/Md.etc_mailname_gethostbyname.diff @@ -0,0 +1,71 @@ +If /etc/mailname is present, the hostname inside the file will be +used, rather than calling gethostbyname() on the actual hostname + +--- a/init.c ++++ b/init.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2952,6 +2953,31 @@ + srandom(seed); + } + ++int getmailname(char *s, size_t l) ++{ ++ FILE *f; ++ char tmp[512]; ++ char *p = tmp; ++ ++ if ((f = fopen ("/etc/mailname", "r")) == NULL) ++ return (-1); ++ ++ if (fgets (tmp, 510, f) != NULL) { ++ while (*p && !ISSPACE(*p) && l > 0) { ++ *s++ = *p++; ++ l--; ++ } ++ if (*(s-1) == '.') ++ s--; ++ *s = 0; ++ ++ fclose (f); ++ return 0; ++ } ++ fclose (f); ++ return (-1); ++} ++ + void mutt_init (int skip_sys_rc, LIST *commands) + { + struct passwd *pw; +@@ -3027,10 +3053,25 @@ + Hostname = mutt_substrdup (utsname.nodename, p); + p++; + strfcpy (buffer, p, sizeof (buffer)); /* save the domain for below */ ++ Fqdn = safe_strdup (utsname.nodename); + } + else + Hostname = safe_strdup (utsname.nodename); + ++ /* if /etc/mailname exists use it and ignore everything else */ ++ if (getmailname(buffer, sizeof (buffer)) != -1) ++ Fqdn = safe_strdup(buffer); ++ ++ /* try gethostbyname(3) if /etc/mailname does not exists */ ++ if (!Fqdn) { ++ struct hostent *hp; ++ ++ if ((hp = gethostbyname(Hostname))) ++ Fqdn = safe_strdup(hp->h_name); ++ } ++ ++ if (Fqdn) { ++ } else + #ifndef DOMAIN + #define DOMAIN buffer + if (!p && getdnsdomainname (buffer, sizeof (buffer)) == -1) --- mutt-1.5.21.orig/debian/patches/debian-specific/use_usr_bin_editor.diff +++ mutt-1.5.21/debian/patches/debian-specific/use_usr_bin_editor.diff @@ -0,0 +1,25 @@ +Even if EDITOR is not set, mutt will always use /usr/bin/editor (which +is set by update-alternatives), rather than falling back to vi + +--- a/init.c ++++ b/init.c +@@ -3115,7 +3115,7 @@ + { + p = getenv ("EDITOR"); + if (!p) +- p = "vi"; ++ p = "/usr/bin/editor"; + } + Editor = safe_strdup (p); + Visual = safe_strdup (p); +--- a/init.h ++++ b/init.h +@@ -686,7 +686,7 @@ + ** .pp + ** This variable specifies which editor is used by mutt. + ** It defaults to the value of the \fC$$$VISUAL\fP, or \fC$$$EDITOR\fP, environment +- ** variable, or to the string ``vi'' if neither of those are set. ++ ** variable, or to the string ``/usr/bin/editor'' if neither of those are set. + */ + { "encode_from", DT_BOOL, R_NONE, OPTENCODEFROM, 0 }, + /* --- mutt-1.5.21.orig/debian/patches/debian-specific/correct_docdir_in_man_page.diff +++ mutt-1.5.21/debian/patches/debian-specific/correct_docdir_in_man_page.diff @@ -0,0 +1,13 @@ +Fix the link so it points to the correct docdir and gzipped manuall + +--- a/doc/mutt.man ++++ b/doc/mutt.man +@@ -185,7 +185,7 @@ + System mapping between MIME types and file extensions. + .IP "@bindir@/mutt_dotlock" + The privileged dotlocking program. +-.IP "@docdir@/manual.txt" ++.IP "/usr/share/doc/mutt/manual.txt.gz" + The Mutt manual. + .SH BUGS + .PP --- mutt-1.5.21.orig/debian/patches/debian-specific/566076-build_doc_adjustments.patch +++ mutt-1.5.21/debian/patches/debian-specific/566076-build_doc_adjustments.patch @@ -0,0 +1,28 @@ +Use w3m to build the txt manual + +--- a/doc/Makefile.am ++++ b/doc/Makefile.am +@@ -102,9 +102,7 @@ + + check: + manual.txt: manual.html +- -LC_ALL=C lynx -dump -nolist -with_backspaces -display_charset=us-ascii manual.html > $@ || \ +- LC_ALL=C w3m -dump manual.html > $@ || \ +- LC_ALL=C elinks -dump -no-numbering -no-references manual.html | sed -e 's,\\001, ,g' > $@ ++ LC_ALL=C w3m -dump -O UTF-8 manual.html > $@ + + Muttrc: stamp-doc-rc + +@@ -116,10 +114,10 @@ + touch stamp-doc-rc + + manual.html: $(srcdir)/html.xsl $(srcdir)/mutt.xsl stamp-doc-xml $(srcdir)/mutt.css +- -xsltproc --nonet -o $@ $(srcdir)/html.xsl manual.xml ++ xsltproc --nonet -o $@ $(srcdir)/html.xsl manual.xml + + stamp-doc-chunked: $(srcdir)/chunk.xsl $(srcdir)/mutt.xsl stamp-doc-xml $(srcdir)/mutt.css +- -xsltproc --nonet $(srcdir)/chunk.xsl manual.xml ++ xsltproc --nonet $(srcdir)/chunk.xsl manual.xml + touch stamp-doc-chunked + + $(CHUNKED_DOCFILES): stamp-doc-chunked --- mutt-1.5.21.orig/debian/patches/debian-specific/assumed_charset-compat +++ mutt-1.5.21/debian/patches/debian-specific/assumed_charset-compat @@ -0,0 +1,15 @@ +On upstream inclusion of the assumed_charset patch (past 1.5.14), file_charset +got renamed to attach_charset. We add it back for compatibility. + +--- a/init.h ++++ b/init.h +@@ -211,6 +211,9 @@ + ** Note: for Japanese users, ``iso-2022-*'' must be put at the head + ** of the value as shown above if included. + */ ++ { "file_charset", DT_SYN, R_NONE, UL "attach_charset", 0 }, ++ /* ++ */ + { "attach_format", DT_STR, R_NONE, UL &AttachFormat, UL "%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " }, + /* + ** .pp --- mutt-1.5.21.orig/debian/patches/debian-specific/document_debian_defaults +++ mutt-1.5.21/debian/patches/debian-specific/document_debian_defaults @@ -0,0 +1,76 @@ +Some customization of the option which are straying from the default +only on Debian systems + +--- a/init.h ++++ b/init.h +@@ -312,6 +312,9 @@ + ** .pp + ** When this variable is \fIset\fP, mutt will include Delivered-To headers when + ** bouncing messages. Postfix users may wish to \fIunset\fP this variable. ++ ** .pp ++ ** \fBNote:\fP On Debian systems, this option is unset by default in ++ ** /etc/Muttrc. + */ + { "braille_friendly", DT_BOOL, R_NONE, OPTBRAILLEFRIENDLY, 0 }, + /* +@@ -1033,6 +1036,9 @@ + ** one is not used. + ** .pp + ** Also see $$use_domain and $$hidden_host. ++ ** .pp ++ ** \fBNote:\fP On Debian systems, the default for this variable is obtained ++ ** from /etc/mailname when Mutt starts. + */ + { "ignore_linear_white_space", DT_BOOL, R_NONE, OPTIGNORELWS, 0 }, + /* +@@ -1566,6 +1572,9 @@ + ** system. It is used with various sets of parameters to gather the + ** list of known remailers, and to finally send a message through the + ** mixmaster chain. ++ ** .pp ++ ** \fBNote:\fP On Debian systems, this option is set by default to ++ ** ``mixmaster-filter'' in /etc/Muttrc. + */ + #endif + { "move", DT_QUAD, R_NONE, OPT_MOVE, M_NO }, +@@ -2585,6 +2594,10 @@ + ** This variable contains the name of either a directory, or a file which + ** contains trusted certificates for use with OpenSSL. + ** (S/MIME only) ++ ** .pp ++ ** \fBNote:\fP On Debian systems, this defaults to the first existing file in ++ ** the following list: ~/.smime/ca-certificates.crt ~/.smime/ca-bundle.crt ++ ** /etc/ssl/certs/ca-certificates.crt. + */ + { "smime_certificates", DT_PATH, R_NONE, UL &SmimeCertificates, 0 }, + /* +@@ -2791,6 +2804,9 @@ + ** .ts + ** set smtp_authenticators="digest-md5:cram-md5" + ** .te ++ ** .pp ++ ** \fBNote:\fP On Debian systems, this variable defaults to the example ++ ** mentioned. This file is managed by the ``ca-certificates'' package. + */ + # endif /* USE_SASL */ + { "smtp_pass", DT_STR, R_NONE, UL &SmtpPass, UL 0 }, +@@ -2838,6 +2854,9 @@ + ** .pp + ** You may optionally use the ``reverse-'' prefix to specify reverse sorting + ** order (example: ``\fCset sort=reverse-date-sent\fP''). ++ ** .pp ++ ** \fBNote:\fP On Debian systems, this option is set by default to ++ ** ``threads'' in /etc/Muttrc. + */ + { "sort_alias", DT_SORT|DT_SORT_ALIAS, R_NONE, UL &SortAlias, SORT_ALIAS }, + /* +@@ -3375,6 +3394,9 @@ + ** is set to deliver directly via SMTP (see $$smtp_url), this + ** option does nothing: mutt will never write out the ``Bcc:'' header + ** in this case. ++ ** .pp ++ ** \fBNote:\fP On Debian systems, exim4 and postfix strip BCC headers by ++ ** default. The above warning applies to exim3 users, see /etc/Muttrc. + */ + { "write_inc", DT_NUM, R_NONE, UL &WriteInc, 10 }, + /* --- mutt-1.5.21.orig/debian/patches/debian-specific/dont_document_not_present_features.diff +++ mutt-1.5.21/debian/patches/debian-specific/dont_document_not_present_features.diff @@ -0,0 +1,25 @@ +As the patch says, this will add an include so only documented options +for Debian will be used + +--- a/init.h ++++ b/init.h +@@ -19,7 +19,7 @@ + + #ifdef _MAKEDOC + # include "config.h" +-# include "doc/makedoc-defs.h" ++/* # include "makedoc-defs.h" include only documented options for Debian */ + #else + # include "sort.h" + #endif +--- a/functions.h ++++ b/functions.h +@@ -35,7 +35,7 @@ + + #ifdef _MAKEDOC + # include "config.h" +-# include "doc/makedoc-defs.h" ++/* # include "doc/makedoc-defs.h" include only documented options for Debian */ + #endif + + struct binding_t OpGeneric[] = { /* map: generic */ --- mutt-1.5.21.orig/debian/patches/debian-specific/529838-gnutls-autoconf.patch +++ mutt-1.5.21/debian/patches/debian-specific/529838-gnutls-autoconf.patch @@ -0,0 +1,20 @@ +More details about this patch are on http://bugs.debian.org/529838 +The bug and the patch were forwarded to upstream, please see +http://bugs.mutt.org/3239 + +--- a/configure.ac ++++ b/configure.ac +@@ -690,10 +690,10 @@ + then + AC_MSG_WARN([SSL support is only useful with POP, IMAP or SMTP support]) + else +- MUTT_AM_PATH_GNUTLS([$gnutls_prefix], ++ PKG_CHECK_MODULES(GNUTLS, gnutls, + [dnl GNUTLS found +- CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS" +- MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS" ++ CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS" ++ MUTTLIBS="$MUTTLIBS $GNUTLS_LIBS" + + AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ]) + AC_DEFINE(USE_SSL_GNUTLS,1,[ Define if you want support for SSL via GNUTLS. ]) --- mutt-1.5.21.orig/debian/patches/ubuntu/lp-693244-autoview +++ mutt-1.5.21/debian/patches/ubuntu/lp-693244-autoview @@ -0,0 +1,12 @@ +--- a/muttlib.c ++++ b/muttlib.c +@@ -658,6 +658,9 @@ + switch (m->type) + { + case TYPETEXT: ++ if (!ascii_strcasecmp ("html", m->subtype)) ++ return 1; ++ + /* we can display any text, overridable by auto_view */ + return 0; + break; --- mutt-1.5.21.orig/debian/source/format +++ mutt-1.5.21/debian/source/format @@ -0,0 +1 @@ +1.0 --- mutt-1.5.21.orig/debian/bug/control +++ mutt-1.5.21/debian/bug/control @@ -0,0 +1 @@ +package-status: mutt mutt-patched mutt-dbg --- mutt-1.5.21.orig/debian/bug/script +++ mutt-1.5.21/debian/bug/script @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "Including output of \`mutt -v'..." + +LC_ALL=C mutt -v >&3