mu4e-view-gnus: Manipulate gnus so it blocks remote images

mu4e reuses the default gnus-blocked-images, but sadly in the mu4e
context, the default (a function called gnus-block-private-groups) does
_not_ work (i.e., it never blocks).

Advise this function so it'll block for mu4e as well, and update the
docs.

Fixes: #2072.
This commit is contained in:
Dirk-Jan C. Binnema
2021-08-02 23:39:33 +03:00
parent 3ea20afe20
commit 907db013c0
2 changed files with 22 additions and 3 deletions

View File

@ -422,6 +422,13 @@ Gnus' article-mode."
(advice-add 'gnus-set-mode-line :around #'mu4e~view-nop) (advice-add 'gnus-set-mode-line :around #'mu4e~view-nop)
(advice-add 'gnus-button-reply :around #'mu4e~view-button-reply) (advice-add 'gnus-button-reply :around #'mu4e~view-button-reply)
(advice-add 'gnus-msg-mail :around #'mu4e~view-msg-mail) (advice-add 'gnus-msg-mail :around #'mu4e~view-msg-mail)
;; advice gnus-block-private-groups to always return "."
;; so that by default we block images.
(advice-add 'gnus-block-private-groups :around
(lambda(func &rest args)
(if (mu4e~view-mode-p)
"." (apply func args))))
(mu4e~view-mode-body)) (mu4e~view-mode-body))
;;; Massaging the message view ;;; Massaging the message view

View File

@ -1370,10 +1370,17 @@ To disable this, set @code{gnus-inhibit-images} to @t{t}. By default,
external images in HTML are not retrieved from external URLs because external images in HTML are not retrieved from external URLs because
they can be used to track you. they can be used to track you.
Apart from that, you can also control whether to load remote images;
since loading remote images is often used for privacy violations, by
default this is not allowed.
You can specify what URLs to block by setting You can specify what URLs to block by setting
@code{gnus-blocked-images} to a regular exporession or to a function @code{gnus-blocked-images} to a regular expression or to a function
that will receive the message as an argument. For example, to enable that will receive a single parameter which is not meaningful for
images in Github notifications, do the following: @t{mu4e}.
For example, to enable images in Github notifications, you could use
the following:
@lisp @lisp
(setq gnus-blocked-images (setq gnus-blocked-images
@ -1383,6 +1390,11 @@ images in Github notifications, do the following:
nil "."))) nil ".")))
@end lisp @end lisp
@code{mu4e} inherits the default @t{gnus-blocked-images} from Gnus and
ensures that it works with @t{mu4e} too. However, mu4e is not Gnus, so
if you have Gnus-specific settings for @t{gnus-blocked-images}, you
should verify that they have the desired effect in @code{mu4e} as
well.
@node MSGV Custom headers @node MSGV Custom headers
@section Custom headers @section Custom headers