Andreas Krennmair:
authorak1 <ak1@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Fri, 14 Jan 2005 22:23:31 +0000 (22:23 +0000)
committerak1 <ak1@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Fri, 14 Jan 2005 22:23:31 +0000 (22:23 +0000)
* integrated rr.compressed patch
* changed User-Agent string
* added $operating_system to set fake operating system for User-Agent string

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@15 e385b8ad-14ed-0310-8656-cc95a2468c6d

22 files changed:
ChangeLog.mutt-ng
Makefile.am
Makefile.in
PATCHES
acconfig.h
config.h.in
configure
configure.in
curs_main.c
doc/manual.sgml.head
doc/muttrc.man.head
globals.h
hook.c
init.h
main.c
mbox.c
mutt.h
mx.c
mx.h
po/POTFILES.in
sendlib.c
status.c

index b1216d6..4d29835 100644 (file)
@@ -1,4 +1,9 @@
 Changes specific to mutt-ng:
 Changes specific to mutt-ng:
+2004-01-14:
+  * Integrated the following patches:
+    * rr.compressed for compressed folders
+  * Changed User-Agent string
+  * Added operating_system to set fake operating system for User-Agent string
 
 2004-01-09:
   * first version of mutt-ng
 
 2004-01-09:
   * first version of mutt-ng
index 4b3bd06..d532304 100644 (file)
@@ -18,7 +18,7 @@ BUILT_SOURCES = keymap_defs.h patchlist.c
 bin_PROGRAMS = muttng @DOTLOCK_TARGET@ @PGPAUX_TARGET@ @SMIMEAUX_TARGET@
 muttng_SOURCES = $(BUILT_SOURCES) \
        addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
 bin_PROGRAMS = muttng @DOTLOCK_TARGET@ @PGPAUX_TARGET@ @SMIMEAUX_TARGET@
 muttng_SOURCES = $(BUILT_SOURCES) \
        addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
-        crypt.c cryptglue.c \
+       compress.c crypt.c cryptglue.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 \
        handler.c hash.c hdrline.c headers.c help.c hook.c keymap.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 \
        handler.c hash.c hdrline.c headers.c help.c hook.c keymap.c \
@@ -67,6 +67,7 @@ EXTRA_muttng_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
 
 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
        configure acconfig.h account.h \
 
 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
        configure acconfig.h account.h \
+       compress.h \
        attach.h buffy.h charset.h copy.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 \
        attach.h buffy.h charset.h copy.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 \
index e0b96f6..e0b1482 100644 (file)
@@ -197,7 +197,7 @@ BUILT_SOURCES = keymap_defs.h patchlist.c
 bin_PROGRAMS = muttng @DOTLOCK_TARGET@ @PGPAUX_TARGET@ @SMIMEAUX_TARGET@
 muttng_SOURCES = $(BUILT_SOURCES) \
        addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
 bin_PROGRAMS = muttng @DOTLOCK_TARGET@ @PGPAUX_TARGET@ @SMIMEAUX_TARGET@
 muttng_SOURCES = $(BUILT_SOURCES) \
        addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
-        crypt.c cryptglue.c \
+       compress.c crypt.c cryptglue.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 \
        handler.c hash.c hdrline.c headers.c help.c hook.c keymap.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 \
        handler.c hash.c hdrline.c headers.c help.c hook.c keymap.c \
@@ -234,6 +234,7 @@ EXTRA_muttng_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
 
 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
        configure acconfig.h account.h \
 
 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
        configure acconfig.h account.h \
+       compress.h \
        attach.h buffy.h charset.h copy.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 \
        attach.h buffy.h charset.h copy.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 \
@@ -284,25 +285,26 @@ mutt_dotlock_LDFLAGS =
 am__objects_1 = patchlist.$(OBJEXT)
 am_muttng_OBJECTS = $(am__objects_1) addrbook.$(OBJEXT) alias.$(OBJEXT) \
        attach.$(OBJEXT) base64.$(OBJEXT) browser.$(OBJEXT) \
 am__objects_1 = patchlist.$(OBJEXT)
 am_muttng_OBJECTS = $(am__objects_1) addrbook.$(OBJEXT) alias.$(OBJEXT) \
        attach.$(OBJEXT) base64.$(OBJEXT) browser.$(OBJEXT) \
-       buffy.$(OBJEXT) color.$(OBJEXT) crypt.$(OBJEXT) \
-       cryptglue.$(OBJEXT) commands.$(OBJEXT) complete.$(OBJEXT) \
-       compose.$(OBJEXT) copy.$(OBJEXT) curs_lib.$(OBJEXT) \
-       curs_main.$(OBJEXT) date.$(OBJEXT) edit.$(OBJEXT) \
-       enter.$(OBJEXT) flags.$(OBJEXT) init.$(OBJEXT) filter.$(OBJEXT) \
-       from.$(OBJEXT) getdomain.$(OBJEXT) handler.$(OBJEXT) \
-       hash.$(OBJEXT) hdrline.$(OBJEXT) headers.$(OBJEXT) \
-       help.$(OBJEXT) hook.$(OBJEXT) keymap.$(OBJEXT) main.$(OBJEXT) \
-       mbox.$(OBJEXT) menu.$(OBJEXT) mh.$(OBJEXT) mx.$(OBJEXT) \
-       pager.$(OBJEXT) parse.$(OBJEXT) pattern.$(OBJEXT) \
-       postpone.$(OBJEXT) query.$(OBJEXT) recvattach.$(OBJEXT) \
-       recvcmd.$(OBJEXT) rfc822.$(OBJEXT) rfc1524.$(OBJEXT) \
-       rfc2047.$(OBJEXT) rfc2231.$(OBJEXT) score.$(OBJEXT) \
-       send.$(OBJEXT) sendlib.$(OBJEXT) signal.$(OBJEXT) \
-       sort.$(OBJEXT) status.$(OBJEXT) system.$(OBJEXT) \
-       thread.$(OBJEXT) charset.$(OBJEXT) history.$(OBJEXT) \
-       lib.$(OBJEXT) muttlib.$(OBJEXT) editmsg.$(OBJEXT) \
-       utf8.$(OBJEXT) mbyte.$(OBJEXT) wcwidth.$(OBJEXT) url.$(OBJEXT) \
-       ascii.$(OBJEXT) mutt_idna.$(OBJEXT) sidebar.$(OBJEXT)
+       buffy.$(OBJEXT) color.$(OBJEXT) compress.$(OBJEXT) \
+       crypt.$(OBJEXT) cryptglue.$(OBJEXT) commands.$(OBJEXT) \
+       complete.$(OBJEXT) compose.$(OBJEXT) copy.$(OBJEXT) \
+       curs_lib.$(OBJEXT) curs_main.$(OBJEXT) date.$(OBJEXT) \
+       edit.$(OBJEXT) enter.$(OBJEXT) flags.$(OBJEXT) init.$(OBJEXT) \
+       filter.$(OBJEXT) from.$(OBJEXT) getdomain.$(OBJEXT) \
+       handler.$(OBJEXT) hash.$(OBJEXT) hdrline.$(OBJEXT) \
+       headers.$(OBJEXT) help.$(OBJEXT) hook.$(OBJEXT) \
+       keymap.$(OBJEXT) main.$(OBJEXT) mbox.$(OBJEXT) menu.$(OBJEXT) \
+       mh.$(OBJEXT) mx.$(OBJEXT) pager.$(OBJEXT) parse.$(OBJEXT) \
+       pattern.$(OBJEXT) postpone.$(OBJEXT) query.$(OBJEXT) \
+       recvattach.$(OBJEXT) recvcmd.$(OBJEXT) rfc822.$(OBJEXT) \
+       rfc1524.$(OBJEXT) rfc2047.$(OBJEXT) rfc2231.$(OBJEXT) \
+       score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
+       signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
+       system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
+       history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
+       editmsg.$(OBJEXT) utf8.$(OBJEXT) mbyte.$(OBJEXT) \
+       wcwidth.$(OBJEXT) url.$(OBJEXT) ascii.$(OBJEXT) \
+       mutt_idna.$(OBJEXT) sidebar.$(OBJEXT)
 muttng_OBJECTS = $(am_muttng_OBJECTS)
 muttng_LDFLAGS =
 am_pgpring_OBJECTS = pgppubring.$(OBJEXT) pgplib.$(OBJEXT) lib.$(OBJEXT) \
 muttng_OBJECTS = $(am_muttng_OBJECTS)
 muttng_LDFLAGS =
 am_pgpring_OBJECTS = pgppubring.$(OBJEXT) pgplib.$(OBJEXT) lib.$(OBJEXT) \
diff --git a/PATCHES b/PATCHES
index f2089c8..6f0bdfe 100644 (file)
--- a/PATCHES
+++ b/PATCHES
@@ -1,3 +1,4 @@
+rr.compressed
 patch-1.5.6i.sidebar.20041122
 patch-1.5.4.aw.listreply.1
 patch-1.5.4.cd.source_multiple.2
 patch-1.5.6i.sidebar.20041122
 patch-1.5.4.aw.listreply.1
 patch-1.5.4.cd.source_multiple.2
index 38f7fc5..245f238 100644 (file)
@@ -39,3 +39,6 @@
  * all return values other than (size_t)(-1) as equivalent. */
 #undef ICONV_NONTRANS
 
  * all return values other than (size_t)(-1) as equivalent. */
 #undef ICONV_NONTRANS
 
+/* The compressed mailboxes support */
+#undef USE_COMPRESSED
+
index 802857b..f4af89c 100644 (file)
  * all return values other than (size_t)(-1) as equivalent. */
 #undef ICONV_NONTRANS
 
  * all return values other than (size_t)(-1) as equivalent. */
 #undef ICONV_NONTRANS
 
+/* The compressed mailboxes support */
+#undef USE_COMPRESSED
+
index 3e7676a..b179e11 100755 (executable)
--- a/configure
+++ b/configure
@@ -863,6 +863,7 @@ Optional Features:
   --enable-nfs-fix           Work around an NFS with broken attributes caching
   --enable-buffy-size        Use file size attribute instead of access time
   --enable-mailtool          Enable Sun mailtool attachments support
   --enable-nfs-fix           Work around an NFS with broken attributes caching
   --enable-buffy-size        Use file size attribute instead of access time
   --enable-mailtool          Enable Sun mailtool attachments support
+  --enable-compressed        Enable compressed folders support
   --enable-locales-fix       The result of isprint() is unreliable
   --enable-exact-address     Enable regeneration of email addresses
   --disable-iconv            Disable iconv support
   --enable-locales-fix       The result of isprint() is unreliable
   --enable-exact-address     Enable regeneration of email addresses
   --disable-iconv            Disable iconv support
@@ -11390,6 +11391,17 @@ _ACEOF
         fi
 fi;
 
         fi
 fi;
 
+# Check whether --enable-compressed or --disable-compressed was given.
+if test "${enable_compressed+set}" = set; then
+  enableval="$enable_compressed"
+  if test x$enableval = xyes; then
+                cat >>confdefs.h <<\_ACEOF
+#define USE_COMPRESSED 1
+_ACEOF
+
+        fi
+fi;
+
 # Check whether --enable-locales-fix or --disable-locales-fix was given.
 if test "${enable_locales_fix+set}" = set; then
   enableval="$enable_locales_fix"
 # Check whether --enable-locales-fix or --disable-locales-fix was given.
 if test "${enable_locales_fix+set}" = set; then
   enableval="$enable_locales_fix"
index 6b42629..f48be12 100644 (file)
@@ -754,6 +754,11 @@ AC_ARG_ENABLE(mailtool, [  --enable-mailtool          Enable Sun mailtool attach
                 AC_DEFINE(SUN_ATTACHMENT,1,[ Define to enable Sun mailtool attachments support. ])
         fi])
 
                 AC_DEFINE(SUN_ATTACHMENT,1,[ Define to enable Sun mailtool attachments support. ])
         fi])
 
+AC_ARG_ENABLE(compressed, [  --enable-compressed        Enable compressed folders support ],
+        [if test x$enableval = xyes; then
+                AC_DEFINE(USE_COMPRESSED)
+        fi])
+
 AC_ARG_ENABLE(locales-fix, [  --enable-locales-fix       The result of isprint() is unreliable ],
         [if test x$enableval = xyes; then
                 AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
 AC_ARG_ENABLE(locales-fix, [  --enable-locales-fix       The result of isprint() is unreliable ],
         [if test x$enableval = xyes; then
                 AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
index 3835af7..7137100 100644 (file)
@@ -1296,6 +1296,12 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
         {
           int check;
 
         {
           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;
 
           mutt_str_replace (&LastFolder, Context->path);
           oldcount = Context ? Context->msgcount : 0;
 
index 8ad8d3b..556cff8 100644 (file)
@@ -2412,6 +2412,168 @@ macro index \cb |urlview\n
 macro pager \cb |urlview\n
 </verb></tscreen>
 
 macro pager \cb |urlview\n
 </verb></tscreen>
 
+<sect1>Compressed folders Support (OPTIONAL)
+<p>
+
+If Mutt was compiled with compressed folders support (by running the
+<em/configure/ script with the <em/--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 (<ref id="open-hook" name="open-hook">,
+<ref id="close-hook" name="close-hook"> and <ref id="append-hook"
+name="append-hook">) which define commands to uncompress and compress
+a folder and to append messages to an existing compressed folder 
+respectively.
+
+For example:
+
+<tscreen><verb>
+open-hook \\.gz$ "gzip -cd %f > %t" 
+close-hook \\.gz$ "gzip -c %t > %f"
+append-hook \\.gz$ "gzip -c %t >> %f" 
+</verb></tscreen>
+
+You do not have to specify all of the commands. If you omit <ref
+id="append-hook" name="append-hook">, the folder will be open and
+closed again each time you will add to it. If you omit <ref
+id="close-hook" name="close-hook"> (or give empty command) , the
+folder will be open in the  mode. If you specify <ref
+id="append-hook" name="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
+&dquot;.&dquot; as a regexp. But this may be surprising if your
+compressing script produces empty files. In this situation, unset <ref
+id="save_empty" name="&dollar;save&lowbar;empty">, so that the compressed file
+will be removed if you delete all of the messages.
+
+<sect2>Open a compressed mailbox for reading<label id="open-hook">
+<p>
+Usage: <tt/open-hook/ <em/regexp/ &dquot;<em/command/&dquot;
+
+The <em/command/ is the command that can be used for opening the
+folders whose names match <em/regexp/.
+
+The <em/command/ string is the printf-like format string, and it
+should accept two parameters: &percnt;f, which is replaced with the
+(compressed) folder name, and &percnt;t which is replaced with the
+name of the temporary folder to which to write.
+
+&percnt;f and &percnt;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, &percnt;&percnt; is replaced by
+&percnt;, as in printf, and any other &percnt;anything is left as is.
+
+The <em/command/ should <bf/not/ remove the original compressed file.
+The <em/command/ should return non-zero exit status if it fails, so
+mutt knows something's wrong.
+
+Example:
+
+<tscreen><verb>
+open-hook \\.gz$ "gzip -cd %f > %t" 
+</verb></tscreen>
+
+If the <em/command/ is empty, this operation is disabled for this file
+type.
+
+<sect2>Write a compressed mailbox<label id="close-hook">
+<p>
+Usage: <tt/close-hook/ <em/regexp/ &dquot;<em/command/&dquot;
+
+This is used to close the folder that was open with the <ref id="open-hook" 
+name="open-hook"> command after some changes were made to it.
+
+The <em/command/ string is the command that can be used for closing the
+folders whose names match <em/regexp/. It has the same format as in 
+the <ref id="open-hook" name="open-hook"> command. Temporary folder
+in this case is the folder previously produced by the <<ref id="open-hook"
+name="open-hook"> command.
+
+The <em/command/ should <bf/not/ remove the decompressed file. The
+<em/command/ should return non-zero exit status if it fails, so mutt
+knows something's wrong.
+
+Example:
+
+<tscreen><verb>
+close-hook \\.gz$ "gzip -c %t > %f"
+</verb></tscreen>
+
+If the <em/command/ is empty, this operation is disabled for this file
+type, and the file can only be open in the readonly mode.
+
+<ref id="close-hook" name ="close-hook"> is not called when you exit
+from the folder if the folder was not changed.
+
+<sect2>Append a message to a compressed mailbox<label id="append-hook">
+<p>
+Usage: <tt/append-hook/ <em/regexp/ &dquot;<em/command/&dquot;
+
+This command is used for saving to an existing compressed folder.
+The <em/command/ is the command that can be used for appending to the
+folders whose names match <em/regexp/. It has the same format as in 
+ the <ref id="open-hook" name="open-hook"> command.
+The temporary folder in this case contains the messages that are being
+appended. 
+
+The <em/command/ should <bf/not/ remove the decompressed file. The
+<em/command/ should return non-zero exit status if it fails, so mutt
+knows something's wrong.
+
+Example:
+
+<tscreen><verb>
+append-hook \\.gz$ "gzip -c %t >> %f" 
+</verb></tscreen>
+
+When <ref id="append-hook" name="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 (<ref id="mbox_type"
+name="&dollar;mbox&lowbar;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, <ref id="close-hook"
+name="close-hook"> is called, and not <ref id="append-hook"
+name="append-hook">. <ref id="append-hook" name="append-hook"> is only
+for appending to existing folders.
+
+If the <em/command/ is empty, this operation is disabled for this file
+type. In this case, the folder will be open and closed again (using
+<ref id="open-hook" name="open-hook"> and <ref id="close-hook" 
+name="close-hook">respectively) each time you will add to it.
+
+<sect2>Encrypted folders
+<p>
+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:
+
+<tscreen><verb>
+open-hook  \\.pgp$ "pgp -f < %f > %t"
+close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId < %t > %f"
+</verb></tscreen>
+
+Please note, that PGP does not support appending to an encrypted
+folder, so there is no append-hook defined.
+
+<bf/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.
+
 <sect>Mutt's MIME Support
 <p>
 Quite a bit of effort has been made to make Mutt the premier text-mode
 <sect>Mutt's MIME Support
 <p>
 Quite a bit of effort has been made to make Mutt the premier text-mode
@@ -2991,6 +3153,8 @@ The following are the commands understood by mutt.
 <item>
 <tt><ref id="alternative_order" name="unalternative&lowbar;order"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <item>
 <item>
 <tt><ref id="alternative_order" name="unalternative&lowbar;order"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <item>
+<tt><ref id="append-hook" name="append-hook"></tt> <em/regexp/ <em/command/
+<item>
 <tt><ref id="auto_view" name="auto&lowbar;view"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <item>
 <tt><ref id="auto_view" name="unauto&lowbar;view"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <tt><ref id="auto_view" name="auto&lowbar;view"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <item>
 <tt><ref id="auto_view" name="unauto&lowbar;view"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
@@ -2999,6 +3163,8 @@ The following are the commands understood by mutt.
 <item>
 <tt><ref id="charset-hook" name="charset-hook"></tt> <em/alias/ <em/charset/
 <item>
 <item>
 <tt><ref id="charset-hook" name="charset-hook"></tt> <em/alias/ <em/charset/
 <item>
+<tt><ref id="close-hook" name="close-hook"></tt> <em/regexp/ <em/command/
+<item>
 <tt><ref id="color" name="color"></tt> <em/object/ <em/foreground/ <em/background/ &lsqb; <em/regexp/ &rsqb;
 <item>
 <tt><ref id="color" name="uncolor"></tt> <em/index/ <em/pattern/ &lsqb; <em/pattern/ ... &rsqb;
 <tt><ref id="color" name="color"></tt> <em/object/ <em/foreground/ <em/background/ &lsqb; <em/regexp/ &rsqb;
 <item>
 <tt><ref id="color" name="uncolor"></tt> <em/index/ <em/pattern/ &lsqb; <em/pattern/ ... &rsqb;
@@ -3045,6 +3211,8 @@ The following are the commands understood by mutt.
 <item>
 <tt><ref id="my_hdr" name="unmy&lowbar;hdr"></tt> <em/field/ &lsqb; <em/field/ ... &rsqb;
 <item>
 <item>
 <tt><ref id="my_hdr" name="unmy&lowbar;hdr"></tt> <em/field/ &lsqb; <em/field/ ... &rsqb;
 <item>
+<tt><ref id="open-hook" name="open-hook"></tt> <em/regexp/ <em/command/
+<item>
 <tt><ref id="crypt-hook" name="crypt-hook"></tt> <em/pattern/ <em/key-id/
 <item>
 <tt><ref id="push" name="push"></tt> <em/string/
 <tt><ref id="crypt-hook" name="crypt-hook"></tt> <em/pattern/ <em/key-id/
 <item>
 <tt><ref id="push" name="push"></tt> <em/string/
index 5e9350a..a2380dd 100644 (file)
@@ -296,6 +296,24 @@ specify the ID of the public key to be used when encrypting messages
 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.
 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.
 .TP
 \fBpush\fP \fIstring\fP
 This command adds the named \fIstring\fP to the keyboard buffer.
index 60bb90e..f7b2058 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -80,6 +80,8 @@ WHERE char *Mixmaster;
 WHERE char *MixEntryFormat;
 #endif
 
 WHERE char *MixEntryFormat;
 #endif
 
+WHERE char *OperatingSystem INITVAL (NULL);
+
 WHERE char *Muttrc INITVAL (NULL);
 #ifdef USE_NNTP
 WHERE char *NewsCacheDir;
 WHERE char *Muttrc INITVAL (NULL);
 #ifdef USE_NNTP
 WHERE char *NewsCacheDir;
diff --git a/hook.c b/hook.c
index d7931c0..b157f05 100644 (file)
--- a/hook.c
+++ b/hook.c
 #include "mailbox.h"
 #include "mutt_crypt.h"
 
 #include "mailbox.h"
 #include "mutt_crypt.h"
 
+#ifdef USE_COMPRESSED
+#include "compress.h"
+#endif
+
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
@@ -88,6 +92,16 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
     memset (&pattern, 0, sizeof (pattern));
     pattern.data = safe_strdup (path);
   }
     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, _("bad formatted command string"), err->dsize);
+      return (-1);
+    }
+  }
+#endif
   else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
            && (!WithCrypto || !(data & M_CRYPTHOOK))
       )
   else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
            && (!WithCrypto || !(data & M_CRYPTHOOK))
       )
diff --git a/init.h b/init.h
index f288ff6..111ad72 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1098,6 +1098,13 @@ struct option_t MuttVars[] = {
   ** This specifies the folder into which read mail in your ``$$spoolfile''
   ** folder will be appended.
   */
   ** This specifies the folder into which read mail in your ``$$spoolfile''
   ** folder will be appended.
   */
+  { "operating_system",  DT_STR, R_NONE, UL&OperatingSystem, 0 },
+  /*
+  ** .pp
+  ** This specifies the operating system name for the User-Agent header. If
+  ** this is unset, it will be set to the operating system name that uname(2)
+  ** returns. If uname(2) fails, "UNIX" will be used.
+  */
   { "sidebar_visible", DT_BOOL, R_BOTH, OPTMBOXPANE, 0 },
   /*
   ** .pp
   { "sidebar_visible", DT_BOOL, R_BOTH, OPTMBOXPANE, 0 },
   /*
   ** .pp
@@ -3054,6 +3061,11 @@ struct command_t Commands[] = {
   { "fcc-hook",                mutt_parse_hook,        M_FCCHOOK },
   { "fcc-save-hook",   mutt_parse_hook,        M_FCCHOOK | M_SAVEHOOK },
   { "folder-hook",     mutt_parse_hook,        M_FOLDERHOOK },
   { "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
   { "hdr_order",       parse_list,             UL &HeaderOrderList },
 #ifdef HAVE_ICONV
   { "iconv-hook",      mutt_parse_hook,        M_ICONVHOOK }, 
   { "hdr_order",       parse_list,             UL &HeaderOrderList },
 #ifdef HAVE_ICONV
   { "iconv-hook",      mutt_parse_hook,        M_ICONVHOOK }, 
diff --git a/main.c b/main.c
index 58e6079..89fa6d3 100644 (file)
--- a/main.c
+++ b/main.c
@@ -283,6 +283,12 @@ static void show_version (void)
        "-USE_GNU_REGEX  "
 #endif
 
        "-USE_GNU_REGEX  "
 #endif
 
+#ifdef USE_COMPRESSED
+       "+COMPRESSED  "
+#else
+       "-COMPRESSED  "
+#endif
+
        "\n"
        
 #ifdef HAVE_COLOR
        "\n"
        
 #ifdef HAVE_COLOR
diff --git a/mbox.c b/mbox.c
index dc900e4..dedf7c6 100644 (file)
--- a/mbox.c
+++ b/mbox.c
 #include "sort.h"
 #include "copy.h"
 
 #include "sort.h"
 #include "copy.h"
 
+#ifdef USE_COMPRESSED
+#include "compress.h"
+#endif
+
 #include <sys/stat.h>
 #include <dirent.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <dirent.h>
 #include <string.h>
@@ -1016,6 +1020,12 @@ bail:  /* Come here in case of disaster */
 int mbox_close_mailbox (CONTEXT *ctx)
 {
   mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
 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;
   mutt_unblock_signals ();
   mx_fastclose_mailbox (ctx);
   return 0;
diff --git a/mutt.h b/mutt.h
index 6a6b036..c99861c 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -158,6 +158,11 @@ typedef enum
 #define M_CRYPTHOOK    (1<<8)
 #define M_ACCOUNTHOOK  (1<<9)
 #define M_REPLYHOOK    (1<<10)
 #define M_CRYPTHOOK    (1<<8)
 #define M_ACCOUNTHOOK  (1<<9)
 #define M_REPLYHOOK    (1<<10)
+#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
 
 /* tree characters for linearize_tree and print_enriched_string */
 #define M_TREE_LLCORNER                1
@@ -833,6 +838,11 @@ typedef struct
 
   short magic;                 /* mailbox type */
 
 
   short magic;                 /* mailbox type */
 
+#ifdef USE_COMPRESSED
+  void *compressinfo;          /* compressed mbox module private data */
+  char *realpath;              /* path to compressed mailbox */
+#endif /* USE_COMPRESSED */
+
   unsigned int locked : 1;     /* is the mailbox locked? */
   unsigned int changed : 1;    /* mailbox has been modified */
   unsigned int readonly : 1;    /* don't allow changes to the mailbox */
   unsigned int locked : 1;     /* is the mailbox locked? */
   unsigned int changed : 1;    /* mailbox has been modified */
   unsigned int readonly : 1;    /* don't allow changes to the mailbox */
diff --git a/mx.c b/mx.c
index 2186651..ed779b2 100644 (file)
--- a/mx.c
+++ b/mx.c
 #include "keymap.h"
 #include "url.h"
 
 #include "keymap.h"
 #include "url.h"
 
+#ifdef USE_COMPRESSED
+#include "compress.h"
+#endif
+
 #ifdef USE_IMAP
 #include "imap.h"
 #endif
 #ifdef USE_IMAP
 #include "imap.h"
 #endif
@@ -475,6 +479,11 @@ int mx_get_magic (const char *path)
     return (-1);
   }
 
     return (-1);
   }
 
+#ifdef USE_COMPRESSED
+  if (magic == 0 && mutt_can_read_compressed (path))
+    return M_COMPRESSED;
+#endif
+
   return (magic);
 }
 
   return (magic);
 }
 
@@ -514,6 +523,13 @@ static int mx_open_mailbox_append (CONTEXT *ctx, int flags)
 {
   struct stat sb;
 
 {
   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
   ctx->append = 1;
 
 #ifdef USE_IMAP
@@ -675,6 +691,11 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
 
   ctx->magic = mx_get_magic (path);
   
 
   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);
 
   if(ctx->magic == 0)
     mutt_error (_("%s is not a mailbox."), path);
 
@@ -790,6 +811,10 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
     mutt_free_header (&ctx->hdrs[i]);
   FREE (&ctx->hdrs);
   FREE (&ctx->v2r);
     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) 
   FREE (&ctx->path);
   FREE (&ctx->pattern);
   if (ctx->limit_pattern) 
@@ -853,6 +878,12 @@ static int sync_mailbox (CONTEXT *ctx, int *index_hint)
   if (tmp && tmp->new == 0)
     mutt_update_mailbox (tmp);
 #endif
   if (tmp && tmp->new == 0)
     mutt_update_mailbox (tmp);
 #endif
+
+#ifdef USE_COMPRESSED
+  if (rc == 0 && ctx->compressinfo)
+    return mutt_sync_compressed (ctx);
+#endif
+
   return rc;
 }
 
   return rc;
 }
 
@@ -1125,6 +1156,11 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
       !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
     mx_unlink_empty (ctx->path);
 
       !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;
   mx_fastclose_mailbox (ctx);
 
   return 0;
@@ -1435,6 +1471,11 @@ int mx_check_mailbox (CONTEXT *ctx, int *index_hint, int lock)
 {
   int rc;
 
 {
   int rc;
 
+#ifdef USE_COMPRESSED
+  if (ctx->compressinfo)
+    return mutt_check_mailbox_compressed (ctx);
+#endif
+
   if (ctx)
   {
     if (ctx->locked) lock = 0;
   if (ctx)
   {
     if (ctx->locked) lock = 0;
diff --git a/mx.h b/mx.h
index 3750928..f5a31a7 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -43,6 +43,9 @@ enum
 #ifdef USE_NNTP
   , M_NNTP
 #endif
 #ifdef USE_NNTP
   , M_NNTP
 #endif
+#ifdef USE_COMPRESSED
+  , M_COMPRESSED
+#endif
 };
 
 WHERE short DefaultMagic INITVAL (M_MBOX);
 };
 
 WHERE short DefaultMagic INITVAL (M_MBOX);
index 0a570ee..0dbeee9 100644 (file)
@@ -8,6 +8,7 @@ charset.c
 color.c
 commands.c
 compose.c
 color.c
 commands.c
 compose.c
+compress.c
 crypt.c
 curs_lib.c
 curs_main.c
 crypt.c
 curs_lib.c
 curs_main.c
index 8128089..31596c9 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -40,6 +40,7 @@
 #include <signal.h>
 #include <sys/wait.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <sys/wait.h>
 #include <fcntl.h>
+#include <sys/utsname.h>
 
 #ifdef USE_NNTP
 #include <nntp.h>
 
 #ifdef USE_NNTP
 #include <nntp.h>
@@ -1738,8 +1739,19 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,
 
   if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent)
   {
 
   if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent)
   {
+    struct utsname un;
+    char * os;
+    if (OperatingSystem!=NULL) {
+      os = OperatingSystem;
+    } else {
+      if (uname(&un)==-1) {
+        os = "UNIX";
+      } else {
+        os = un.sysname;
+      }
+    }
     /* Add a vanity header */
     /* Add a vanity header */
-    fprintf (fp, "User-Agent: Mutt/%s\n", MUTT_VERSION);
+    fprintf (fp, "User-Agent: mutt-ng %s (%s)\n", MUTT_VERSION,os);
   }
 
   return (ferror (fp) == 0 ? 0 : -1);
   }
 
   return (ferror (fp) == 0 ? 0 : -1);
index 3d175f6..305be60 100644 (file)
--- a/status.c
+++ b/status.c
@@ -93,6 +93,14 @@ status_format_str (char *buf, size_t buflen, char op, const char *src,
 
     case 'f':
       snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
 
     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);
+      }
+      else
+#endif
       if (Context && Context->path)
       {
        strfcpy (tmp, Context->path, sizeof (tmp));
       if (Context && Context->path)
       {
        strfcpy (tmp, Context->path, sizeof (tmp));