Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 20BCF431FC4 for ; Thu, 29 Jan 2015 13:36:23 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 2.639 X-Spam-Level: ** X-Spam-Status: No, score=2.639 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DNS_FROM_AHBL_RHSBL=2.438, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id libfKoN6EPI3 for ; Thu, 29 Jan 2015 13:36:20 -0800 (PST) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C85E9431FBC for ; Thu, 29 Jan 2015 13:36:19 -0800 (PST) Received: by mail-pa0-f41.google.com with SMTP id kq14so43723660pab.0 for ; Thu, 29 Jan 2015 13:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qLPydc38mDxPE4hG3UjhLo4rMJGp8SlqNTTdoLtV0Ts=; b=yvsicgRiQpkq+XJ+2qjqRTdQO8dLK2UAd1FcxGFp3dP6WsQEjh/5XIOmu7NKr61/N4 SwLz49IrAnY+XR00unBgon5JzgMqbLT5u2Y+gDfyH+7lu+7+G7w4fwvdVXjZnYEwuNts v7K4VdkKP7/5qloEiTDwMb4/Yd/dFEUFYQSyn1CKO8jTE/jkeNHa2ZDl9qBxMBHzeYfw /4PngWEz37uGWTcvFubavEH00Mm4yoA7XxZzPs7FqsizkTnSjs8iwdUuJ0d2OSMENU5X y05Lv3as0ctNOcDwbaShfldFbICyweZv+ZmvgcBceXhQl+LG6QgqqXMcHJYemjaUbGJm uPtQ== X-Received: by 10.66.62.138 with SMTP id y10mr3808929par.51.1422567379160; Thu, 29 Jan 2015 13:36:19 -0800 (PST) Received: from jinwoo-macbookair.roam.corp.google.com.net ([24.130.61.213]) by mx.google.com with ESMTPSA id bq7sm8687628pdb.50.2015.01.29.13.36.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 13:36:18 -0800 (PST) From: Jinwoo Lee To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images. Date: Thu, 29 Jan 2015 13:35:52 -0800 Message-Id: <1422567352-32647-1-git-send-email-jinwoo68@gmail.com> X-Mailer: git-send-email 2.2.2 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 21:36:24 -0000 It's default value is ".", meaning all remote images will be blocked by default. --- This time setting gnus-blocked-images from the correct place. --- emacs/notmuch-show.el | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 66350d4..6f38e0c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -136,6 +136,11 @@ indentation." :type 'boolean :group 'notmuch-show) +(defcustom notmuch-show-text/html-blocked-images "." + "Remote images that have URLs matching this regexp will be blocked." + :type '(choice (const nil) regexp) + :group 'notmuch-show) + (defvar notmuch-show-thread-id nil) (make-variable-buffer-local 'notmuch-show-thread-id) (put 'notmuch-show-thread-id 'permanent-local t) @@ -798,16 +803,24 @@ will return nil if the CID is unknown or cannot be retrieved." ;; URL-decode it (see RFC 2392). (let ((cid (url-unhex-string url))) (first (notmuch-show--get-cid-content cid))))) - ;; Block all external images to prevent privacy leaks and - ;; potential attacks. FIXME: If we block an image, offer a - ;; button to load external images. - (shr-blocked-images ".")) + ;; By default, block all external images to prevent privacy + ;; leaks and potential attacks. FIXME: If we block an image, + ;; offer a button to load external images. + (shr-blocked-images notmuch-show-text/html-blocked-images)) (shr-insert-document dom) t)) (defun notmuch-show-insert-part-*/* (msg part content-type nth depth button) ;; This handler _must_ succeed - it is the handler of last resort. - (notmuch-mm-display-part-inline msg part content-type notmuch-show-process-crypto) + + ;; By default, block all external images to prevent privacy leaks + ;; and potential attacks. FIXME: If we block an image, offer a + ;; button to load external images. + ;; Note that GNUS-BLOCKED-IMAGES is effective only when + ;; MM-TEXT-HTML-RENDERER is 'gnus-w3m. + (let ((gnus-blocked-images notmuch-show-text/html-blocked-images)) + (notmuch-mm-display-part-inline msg part content-type + notmuch-show-process-crypto)) t) ;; Functions for determining how to handle MIME parts. -- 2.2.2