Merge branch 'master' of github.com:djcb/mu

This commit is contained in:
djcb
2016-06-05 18:53:31 +03:00
2 changed files with 22 additions and 11 deletions

View File

@ -239,15 +239,26 @@ get_part_size (GMimePart *part)
} }
static void static char*
cleanup_filename (char *fname) cleanup_filename (char *fname)
{ {
GString *gstr;
gchar *cur; gchar *cur;
gunichar uc;
/* replace control characters, slashes,colons by a '-' */ gstr = g_string_sized_new (strlen (fname));
for (cur = fname; *cur; ++cur)
if (*cur < ' ' || *cur == '/' || *cur == ':') /* replace control characters, slashes, and colons by '-' */
*cur = '-'; for (cur = fname; cur && *cur; cur = g_utf8_next_char (cur)) {
uc = g_utf8_get_char (cur);
if (g_unichar_iscntrl (uc) || uc == '/' || uc == ':')
g_string_append_unichar (gstr, '-');
else
g_string_append_unichar (gstr, uc);
}
g_free (fname);
return g_string_free (gstr, FALSE);
} }
@ -304,9 +315,9 @@ mime_part_get_filename (GMimeObject *mobj, unsigned index,
if (!fname) if (!fname)
fname = guess_file_name (mobj, index); fname = guess_file_name (mobj, index);
/* remove slashes, spaces, colons... */ /* replace control characters, slashes, and colons */
cleanup_filename (fname); fname = cleanup_filename (fname);
return fname; return fname;
} }

View File

@ -192,8 +192,6 @@ and images in a multipart/related part."
"Convert the current body to html." "Convert the current body to html."
(unless (fboundp 'org-export-string-as) (unless (fboundp 'org-export-string-as)
(mu4e-error "require function 'org-export-string-as not found.")) (mu4e-error "require function 'org-export-string-as not found."))
(unless (executable-find "dvipng")
(mu4e-error "Required program dvipng not found"))
(let* ((begin (let* ((begin
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -209,7 +207,9 @@ and images in a multipart/related part."
;; makes the replies with ">"s look nicer ;; makes the replies with ">"s look nicer
(org-export-preserve-breaks t) (org-export-preserve-breaks t)
;; dvipng for inline latex because MathJax doesn't work in mail ;; dvipng for inline latex because MathJax doesn't work in mail
(org-export-with-LaTeX-fragments 'dvipng) (org-export-with-LaTeX-fragments
(if (executable-find "dvipng") 'dvipng
(mu4e-message "Cannot find dvipng, ignore inline LaTeX") nil))
;; to hold attachments for inline html images ;; to hold attachments for inline html images
(html-and-images (html-and-images
(org~mu4e-mime-replace-images (org~mu4e-mime-replace-images