]> git.eshelyaron.com Git - emacs.git/commitdiff
Drop hashcash support from Gnus and Message mode
authorStefan Kangas <stefankangas@gmail.com>
Tue, 11 Feb 2025 17:47:27 +0000 (18:47 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 26 Feb 2025 09:36:06 +0000 (10:36 +0100)
* lisp/gnus/gnus.el (gnus-install-group-spam-parameters): Remove
'spam-use-hashcash' option.
* lisp/gnus/message.el (message-generate-hashcash): Mark as
obsolete, default to nil unconditionally.
(message-send-mail, message-setup-1, message-resend): Don't
generate hashcash headers.
* lisp/gnus/spam.el (hashcash): Don't require.
(spam-use-hashcash):
(spam-check-hashcash): Mark as obsolete.
(spam-install-hooks): Don't install 'spam-use-hashcash' hook.
* doc/misc/message.texi (Mail Headers): Don't document above
obsoleted variable 'message-generate-hashcash'.
* doc/misc/gnus.texi (Hashcash): Delete section.
(Anti-spam Hashcash Payments): Delete subsection.
(Extending the Spam package): Don't mention Hashcash.  (Bug#76195)

(cherry picked from commit 250f4214752d223981259e453c55a8c5cabb111a)

doc/misc/gnus.texi
doc/misc/message.texi
lisp/gnus/gnus.el
lisp/gnus/message.el
lisp/gnus/spam.el

index 2360cd24dac8bd6f326d0a037acc20b25a1df41b..5bfd6e2ef9c6069f722125cda85dfe9772267f61 100644 (file)
@@ -874,7 +874,6 @@ Thwarting Email Spam
 * The problem of spam::         Some background, and some solutions
 * Anti-Spam Basics::            Simple steps to reduce the amount of spam.
 * SpamAssassin::                How to use external anti-spam tools.
-* Hashcash::                    Reduce spam by burning CPU time.
 
 Spam Package
 
@@ -892,7 +891,6 @@ Spam Back Ends
 * Blacklists and Whitelists::
 * BBDB Whitelists::
 * Gmane Spam Reporting::
-* Anti-spam Hashcash Payments::
 * Blackholes::
 * Regular Expressions Header Matching::
 * Bogofilter::
@@ -24314,7 +24312,6 @@ This is annoying.  Here's what you can do about it.
 * The problem of spam::         Some background, and some solutions
 * Anti-Spam Basics::            Simple steps to reduce the amount of spam.
 * SpamAssassin::                How to use external anti-spam tools.
-* Hashcash::                    Reduce spam by burning CPU time.
 @end menu
 
 @node The problem of spam
@@ -24536,81 +24533,6 @@ spam.  And here is the nifty function:
   (gnus-summary-mark-as-expirable 1))
 @end lisp
 
-@node Hashcash
-@subsection Hashcash
-@cindex hashcash
-
-One technique to fight spam is to require senders to do something
-costly and demonstrably unique for each message they send.  This has
-the obvious drawback that you cannot rely on everyone in the world
-using this technique, since it is not part of the Internet standards,
-but it may be useful in smaller communities.
-
-While the tools in the previous section work well in practice, they
-work only because the tools are constantly maintained and updated as
-new form of spam appears.  This means that a small percentage of spam
-will always get through.  It also means that somewhere, someone needs
-to read lots of spam to update these tools.  Hashcash avoids that, but
-instead prefers that everyone you contact through e-mail supports the
-scheme.  You can view the two approaches as pragmatic vs dogmatic.
-The approaches have their own advantages and disadvantages, but as
-often in the real world, a combination of them is stronger than either
-one of them separately.
-
-@cindex X-Hashcash
-The ``something costly'' is to burn CPU time, more specifically to
-compute a hash collision up to a certain number of bits.  The
-resulting hashcash cookie is inserted in a @samp{X-Hashcash:} header.
-For more details, and for the external application @code{hashcash} you
-need to install to use this feature, see
-@uref{http://www.hashcash.org/}.
-
-If you wish to generate hashcash for each message you send, you can
-customize @code{message-generate-hashcash} (@pxref{Mail Headers, ,Mail
-Headers,message, The Message Manual}), as in:
-
-@lisp
-(setq message-generate-hashcash t)
-@end lisp
-
-You will need to set up some additional variables as well:
-
-@table @code
-
-@item hashcash-default-payment
-@vindex hashcash-default-payment
-This variable indicates the default number of bits the hash collision
-should consist of.  By default this is 20.  Suggested useful values
-include 17 to 29.
-
-@item hashcash-payment-alist
-@vindex hashcash-payment-alist
-Some receivers may require you to spend burn more CPU time than the
-default.  This variable contains a list of @samp{(@var{addr}
-@var{amount})} cells, where @var{addr} is the receiver (email address
-or newsgroup) and @var{amount} is the number of bits in the collision
-that is needed.  It can also contain @samp{(@var{addr} @var{string}
-@var{amount})} cells, where the @var{string} is the string to use
-(normally the email address or newsgroup name is used).
-
-@item hashcash-program
-@vindex hashcash-program
-Where the @code{hashcash} binary is installed.  This variable should
-be automatically set by @code{executable-find}, but if it's @code{nil}
-(usually because the @code{hashcash} binary is not in your path)
-you'll get a warning when you check hashcash payments and an error
-when you generate hashcash payments.
-
-@end table
-
-Gnus can verify hashcash cookies, although this can also be done by
-hand customized mail filtering scripts.  To verify a hashcash cookie
-in a message, use the @code{mail-check-payment} function in the
-@code{hashcash.el} library.  You can also use the @code{spam.el}
-package with the @code{spam-use-hashcash} back end to validate hashcash
-cookies in incoming mail and filter mail accordingly (@pxref{Anti-spam
-Hashcash Payments}).
-
 @node Spam Package
 @section Spam Package
 @cindex spam filtering
@@ -25241,7 +25163,6 @@ Processors}).
 * Blacklists and Whitelists::
 * BBDB Whitelists::
 * Gmane Spam Reporting::
-* Anti-spam Hashcash Payments::
 * Blackholes::
 * Regular Expressions Header Matching::
 * Bogofilter::
@@ -25437,23 +25358,6 @@ default is @code{user-mail-address}.
 
 @end defvar
 
-@node Anti-spam Hashcash Payments
-@subsubsection Anti-spam Hashcash Payments
-@cindex spam filtering
-@cindex hashcash, spam filtering
-@cindex spam
-
-@defvar spam-use-hashcash
-
-Similar to @code{spam-use-whitelist} (@pxref{Blacklists and
-Whitelists}), but uses hashcash tokens for whitelisting messages
-instead of the sender address.  Messages without a hashcash payment
-token will be sent to the next spam-split rule.  This is an explicit
-filter, meaning that unless a hashcash token is found, the messages
-are not assumed to be spam or ham.
-
-@end defvar
-
 @node Blackholes
 @subsubsection Blackholes
 @cindex spam filtering
@@ -26004,8 +25908,7 @@ such a back end.
 
 This function will install a back end that can only check incoming mail
 for spam contents.  It can't register or unregister messages.
-@code{spam-use-blackholes} and @code{spam-use-hashcash} are such
-back ends.
+@code{spam-use-blackholes} is such a back end.
 
 @item
 @code{spam-install-statistical-checkonly-backend}
@@ -29056,8 +28959,6 @@ that are accessible from the article buffer.
 nnfolder archives.
 
 @item Gnus now supports the ``hashcash'' client puzzle anti-spam mechanism.
-Use @code{(setq message-generate-hashcash t)} to enable.
-@xref{Hashcash}.
 
 @item You can now drag and drop attachments to the Message buffer.
 See @code{mml-dnd-protocol-alist} and @code{mml-dnd-attach-options}.
index 3dd01ea621b3784b1d655542d1ccbdf60d8c369a..8c636ceb2c55999e9aa366f253d3a4a1e99ca6e2 100644 (file)
@@ -1908,13 +1908,6 @@ Regexp of headers to be removed before mailing.  The default is@*
 This string is inserted at the end of the headers in all message
 buffers that are initialized as mail.
 
-@item message-generate-hashcash
-@vindex message-generate-hashcash
-Variable that indicates whether @samp{X-Hashcash} headers
-should be computed for the message.  @xref{Hashcash, ,Hashcash,gnus,
-The Gnus Manual}.  If @code{opportunistic}, only generate the headers
-when it doesn't lead to the user having to wait.
-
 @end table
 
 
index f0ab94eceb7337760f9024683050922b558ea2e5..8116809cc063df909a6579e8e0303ee7228fde86 100644 (file)
@@ -1925,7 +1925,6 @@ spam-autodetect-recheck-messages is set.")
          (variable-item spam-use-bsfilter-headers)
          (variable-item spam-use-stat)
          (variable-item spam-use-blackholes)
-         (variable-item spam-use-hashcash)
          (variable-item spam-use-bogofilter-headers)
          (variable-item spam-use-bogofilter)))
    :function-document
@@ -1958,7 +1957,6 @@ set."
        (variable-item spam-use-crm114)
        (variable-item spam-use-stat)
        (variable-item spam-use-blackholes)
-       (variable-item spam-use-hashcash)
        (variable-item spam-use-spamassassin)
        (variable-item spam-use-spamassassin-headers)
        (variable-item spam-use-bsfilter)
index cd5cffeb4536f5dba651b1300f2159d3cb04a49d..78d1cd2b1d03ece73b8f92ababf48c0375c9ea77 100644 (file)
@@ -1937,7 +1937,7 @@ no, only reply back to the author."
                 (const :tag "Never" nil)
                 (const :tag "Always" t)))
 
-(defcustom message-generate-hashcash (if (executable-find "hashcash") 'opportunistic)
+(defcustom message-generate-hashcash nil
   "Whether to generate X-Hashcash: headers.
 If t, always generate hashcash headers.  If `opportunistic',
 only generate hashcash headers if it can be done without the user
@@ -1951,6 +1951,7 @@ You must have the \"hashcash\" binary installed, see `hashcash-program'."
   :type '(choice (const :tag "Always" t)
                 (const :tag "Never" nil)
                 (const :tag "Opportunistic" opportunistic)))
+(make-obsolete-variable 'message-generate-hashcash "it does nothing." "31.1")
 
 ;;; Internal variables.
 
@@ -4824,8 +4825,6 @@ Valid types are `send', `return', `exit', `kill' and `postpone'."
            (erase-buffer)))
       (kill-buffer tembuf))))
 
-(declare-function hashcash-wait-async "hashcash" (&optional buffer))
-
 (defun message--check-continuation-headers ()
   (message-check 'continuation-headers
     (goto-char (point-min))
@@ -4895,16 +4894,6 @@ If you always want Gnus to send messages in one piece, set
            message-posting-charset))
         (headers message-required-mail-headers)
         options)
-    (when (and message-generate-hashcash
-              (not (eq message-generate-hashcash 'opportunistic)))
-      (message "Generating hashcash...")
-      (require 'hashcash)
-      ;; Wait for calculations already started to finish...
-      (hashcash-wait-async)
-      ;; ...and do calculations not already done.  mail-add-payment
-      ;; will leave existing X-Hashcash headers alone.
-      (mail-add-payment)
-      (message "Generating hashcash...done"))
     (save-restriction
       (message-narrow-to-headers)
       ;; Generate the Mail-Followup-To header if the header is not there...
@@ -6937,9 +6926,6 @@ are not included."
     (message-narrow-to-headers)
     (run-hooks 'message-header-setup-hook))
   (setq buffer-undo-list nil)
-  (when message-generate-hashcash
-    ;; Generate hashcash headers for recipients already known
-    (mail-add-payment-async))
   ;; Gnus posting styles are applied via buffer-local `message-setup-hook'
   ;; values.
   (run-hooks 'message-setup-hook)
@@ -7993,7 +7979,6 @@ is for the internal use."
        (let ((inhibit-read-only t))
          (erase-buffer)))
       (let ((message-this-is-mail t)
-           message-generate-hashcash
            message-setup-hook)
        (message-setup `((To . ,address))))
       ;; Insert our usual headers.
@@ -8042,7 +8027,6 @@ is for the internal use."
            (sendmail-coding-system 'raw-text)
            (select-safe-coding-system-function nil)
            message-required-mail-headers
-           message-generate-hashcash
            rfc2047-encode-encoded-words
             ;; If `message-sendmail-envelope-from' is `header' then
             ;; the envelope-from will be the original sender's
index 983e82cb028904e78b90a4e49e9dd53ee03b74e9..14abaf83ff27c8ba07a16a0de56b566a5bad4042 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
-;; Keywords: network, spam, mail, bogofilter, BBDB, dspam, dig, whitelist, blacklist, gmane, hashcash, spamassassin, bsfilter, ifile, stat, crm114, spamoracle
+;; Keywords: network, spam, mail, bogofilter, BBDB, dspam, dig, whitelist, blacklist, gmane, spamassassin, bsfilter, ifile, stat, crm114, spamoracle
 
 ;; This file is part of GNU Emacs.
 
@@ -46,8 +46,7 @@
 (require 'dig)
 
 (eval-when-compile
-  (require 'cl-lib)
-  (require 'hashcash))
+  (require 'cl-lib))
 
 ;; autoload spam-report
 (autoload 'spam-report-gmane "spam-report")
@@ -205,6 +204,7 @@ are considered spam."
   "Whether hashcash payments should be detected by `spam-split'."
   :type 'boolean
   :group 'spam)
+(make-obsolete-variable 'spam-use-hashcash "it does nothing." "31.1")
 
 (defcustom spam-use-regex-headers nil
   "Whether a header regular expression match should be used by `spam-split'.
@@ -294,7 +294,6 @@ them."
                                spam-use-whitelist
                                spam-use-whitelist-exclusive
                                spam-use-blackholes
-                               spam-use-hashcash
                                spam-use-regex-headers
                                spam-use-regex-body
                                spam-use-bogofilter
@@ -1014,9 +1013,6 @@ backends)."
 (spam-install-checkonly-backend 'spam-use-blackholes
                                 #'spam-check-blackholes)
 
-(spam-install-checkonly-backend 'spam-use-hashcash
-                                #'spam-check-hashcash)
-
 (spam-install-checkonly-backend 'spam-use-spamassassin-headers
                                 #'spam-check-spamassassin-headers)
 
@@ -2022,8 +2018,11 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
 
 ;;{{{ Hashcash.
 
+(declare-function mail-check-payment "hashcash")
 (defun spam-check-hashcash ()
   "Check the headers for hashcash payments."
+  (declare (obsolete nil "31.1"))
+  (require 'hashcash)
   (ignore-errors (mail-check-payment)))  ;mail-check-payment returns a boolean
 
 ;;}}}