+2009-07-07 13:00 +0200 Rocco Rutte <pdmef@gmx.net> (376545d6909c)
+
+ * UPDATING, globals.h, init.h, sendlib.c: Add $wrap_headers. Closes
+ #3135
+
+2009-07-07 12:53 +0200 Rocco Rutte <pdmef@gmx.net> (0980cdb206d2)
+
+ * doc/manual.xml.head: Manual: mention terminal setup for
+ charsets, more unicode pros.
+
+ Closes #3292.
+
2009-07-06 15:28 +0200 Rocco Rutte <pdmef@gmx.net> (ccab6c56b557)
* doc/manual.xml.head: Manual: Add a note about when/why to use utf-8
hg tip:
+ ! header/body cache paths are always UTF-8
+ $wrap_headers to control outgoing message's header length
+ all text/* parts can be displayed inline without mailcap
/*
* Copyright (C) 2006-7 Brendan Cully <brendan@kublai.com>
- * Copyright (C) 2006 Rocco Rutte <pdmef@gmx.net>
+ * Copyright (C) 2006, 2009 Rocco Rutte <pdmef@gmx.net>
*
* 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
char *dst, size_t dstlen)
{
char host[STRING];
+ char path[_POSIX_PATH_MAX];
ciss_url_t url;
int len;
return -1;
}
- dprint (3, (debugfile, "bcache_path: URL: '%s'\n", host));
+ mutt_encode_path (path, sizeof (path), NONULL (mailbox));
len = snprintf (dst, dstlen-1, "%s/%s%s%s", MessageCachedir,
- host, NONULL(mailbox),
- (mailbox && *mailbox &&
- mailbox[mutt_strlen(mailbox) - 1] == '/') ? "" : "/");
+ host, NONULL (path),
+ (*path && path[mutt_strlen (path) - 1] == '/') ? "" : "/");
+
+ dprint (3, (debugfile, "bcache_path: rc: %d, path: '%s'\n", len, dst));
+
if (len < 0 || len >= dstlen-1)
return -1;
<para>
Mutt provides optional support for caching message headers for the
following types of folders: IMAP, POP, Maildir and MH. Header caching
-greatly improves speed because for remote folders, headers usually only
-need to be downloaded once. For Maildir and MH, reading the headers from
-a single file is much faster than looking at possibly thousands of
-single files (since Maildir and MH use one file per message.)
+greatly speeds up opening large folders because for remote folders,
+headers usually only need to be downloaded once. For Maildir and MH,
+reading the headers from a single file is much faster than looking at
+possibly thousands of single files (since Maildir and MH use one file
+per message.)
</para>
<para>
manual maintenance tasks.
</para>
-
<para>
In addition to caching message headers only, Mutt can also cache whole
message bodies. This results in faster display of messages for POP and
<para>
For configuration, the variable <link linkend="message-cachedir"
>$message_cachedir</link> must point to a directory. There, Mutt will
-create a hierarchy of subdirectories named like:
-<literal>proto:user@hostname</literal> where <literal>proto</literal> is
-either <quote>pop</quote> or <quote>imap.</quote> Within there for each
-folder, Mutt stores messages in single files. All files can be removed
-as needed if the consumed disk space becomes an issue as Mutt will
-silently fetch missing items again.
+create a hierarchy of subdirectories named like the account and mailbox
+path the cache is for.
+</para>
+
+</sect2>
+
+<sect2 id="cache-dirs">
+<title>Cache Directories</title>
+
+<para>
+For using both, header and body caching, <link
+linkend="header-cache">$header_cache</link> and <link
+linkend="message-cachedir" >$message_cachedir</link> can be safely set
+to the same value.
+</para>
+
+<para>
+In a header or body cache directory, Mutt creates a directory hierarchy
+named like: <literal>proto:user@hostname</literal> where
+<literal>proto</literal> is either <quote>pop</quote> or
+<quote>imap.</quote> Within there, for each folder, Mutt stores messages
+in single files and header caches in files with the
+<quote>.hcache</quote> extension. All files can be removed as needed if
+the consumed disk space becomes an issue as Mutt will silently fetch
+missing items again. Pathnames are always stored in UTF-8 encoding.
+</para>
+
+<para>
+For Maildir and MH, the header cache files are named after the MD5
+checksum of the path.
</para>
</sect2>
#endif
}
-static char* get_foldername(const char *folder) {
+static char* get_foldername(const char *folder)
+{
char *p = NULL;
+ char path[_POSIX_PATH_MAX];
struct stat st;
+ mutt_encode_path (path, sizeof (path), folder);
+
/* if the folder is local, canonify the path to avoid
* to ensure equivalent paths share the hcache */
- if (stat (folder, &st) == 0)
+ if (stat (path, &st) == 0)
{
p = safe_malloc (PATH_MAX+1);
- if (!realpath (folder, p))
- mutt_str_replace (&p, folder);
+ if (!realpath (path, p))
+ mutt_str_replace (&p, path);
} else
- p = safe_strdup (folder);
+ p = safe_strdup (path);
return p;
}
return 0;
}
+void mutt_encode_path (char *dest, size_t dlen, const char *src)
+{
+ char *p = safe_strdup (src);
+ int rc = mutt_convert_string (&p, Charset, "utf-8", 0);
+ strfcpy (dest, rc == 0 ? p : src, dlen);
+ FREE (&p);
+}
int mutt_filter_unprintable (char **);
void mutt_curses_error (const char *, ...);
void mutt_curses_message (const char *, ...);
+void mutt_encode_path (char *, size_t, const char *);
void mutt_enter_command (void);
void mutt_expand_aliases_env (ENVELOPE *);
void mutt_expand_file_fmt (char *, size_t, const char *, const char *);