+2003-01-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * gnus-async.el (gnus-async-wait-for-article): Don't use a
+ timeout.
+
+ * nntp.el (nntp-accept-process-output): Removed timeout.
+ (nntp-read-timeout): New variable.
+ (nntp-accept-process-output): Use it.
+
+ * gnus-sum.el (gnus-data-find-list): Remove *.
+
+2002-01-23 Kevin Greiner <kgreiner@xpediantsolutions.com>
+
+ * gnus-sum.el (gnus-summary-first-subject): Fixed bug that I
+ introduced on 2002-01-22.
+ (gnus-summary-first-unseen-or-unread-subject): Ditto.
+
+2003-01-23 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * spam.el (spam-check-regex-headers, spam-list-of-checks)
+ (spam-regex-headers-spam, spam-regex-headers-ham): added spam/ham
+ checks of incoming mail based on simple header regexp matching
+
2003-01-22 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sum.el (gnus-spam-mark): set to `$'
;; needs to be done in nntp.el.
(while (eq article gnus-async-current-prefetch-article)
(incf tries)
- (when (nntp-accept-process-output proc 1)
+ (when (nntp-accept-process-output proc)
(setq tries 0))
(when (and (not nntp-have-messaged)
(= tries 3))
(gnus-data-number (car gnus-newsgroup-data)))
;; Find the first unread article.
(t
- (let ((data gnus-newsgroup-data)
- (gnus-newsgroup-unreads gnus-newsgroup-unreads)
- (gnus-newsgroup-undownloaded gnus-newsgroup-undownloaded)
- (gnus-newsgroup-unseen gnus-newsgroup-unseen)
- (gnus-newsgroup-unfetched gnus-newsgroup-unfetched))
+ (let ((data gnus-newsgroup-data))
(while (and data
- (not (let ((num (gnus-data-number (car data)))
- (matched nil))
- (while (> num (or (car gnus-newsgroup-unfetched)
- (1+ num)))
- (pop gnus-newsgroup-unfetched))
- (unless (eq num (car gnus-newsgroup-unfetched))
- (when unread
- (while (> num (or (car gnus-newsgroup-unreads)
- (1+ num)))
- (pop gnus-newsgroup-unreads))
- (setq matched (eq num (car gnus-newsgroup-unreads))))
- (unless matched
- (when undownloaded
- (while (> num (or (car gnus-newsgroup-undownloaded)
- (1+ num)))
- (pop gnus-newsgroup-undownloaded))
- (setq matched (eq num (car gnus-newsgroup-undownloaded))))
- (unless matched
- (when unseen
- (while (> num (or (car gnus-newsgroup-unseen)
- (1+ num)))
- (pop gnus-newsgroup-unseen))
- (setq matched (eq num (car gnus-newsgroup-unseen)))))))
- matched)))
+ (let ((num (gnus-data-number (car data))))
+ (or (memq num gnus-newsgroup-unfetched)
+ (not (or (and unread
+ (memq num gnus-newsgroup-unreads))
+ (and undownloaded
+ (memq num gnus-newsgroup-undownloaded))
+ (and unseen
+ (memq num gnus-newsgroup-unseen)))))))
(setq data (cdr data)))
(prog1
(if data
(gnus-summary-position-point)))
(defun gnus-summary-first-unseen-or-unread-subject ()
- "Place the point on the subject line of the first unseen article.
-Return nil if there are no unseen articles."
+ "Place the point on the subject line of the first unseen article or,
+if all article have been seen, on the subject line of the first unread
+article."
(interactive)
(prog1
- (unless (when (gnus-summary-first-subject t nil t)
+ (unless (when (gnus-summary-first-subject nil nil t)
(gnus-summary-show-thread)
- (gnus-summary-first-subject t nil t))
+ (gnus-summary-first-subject nil nil t))
(when (gnus-summary-first-subject t)
(gnus-summary-show-thread)
(gnus-summary-first-subject t)))
(defsubst mm-set-handle-multipart-parameter (handle parameter value)
;; HANDLE could be a CTL.
- (if handle
- (put-text-property 0 (length (car handle)) parameter value
- (car handle))))
+ (when handle
+ (put-text-property 0 (length (car handle)) parameter value
+ (car handle))))
(defun mm-possibly-verify-or-decrypt (parts ctl)
(let ((type (car ctl))
protocols nil)
(setq protocols (cdr protocols))))))
(setq func (nth 1 (assoc protocol mm-verify-function-alist)))
- (if (cond
- ((eq mm-verify-option 'never) nil)
- ((eq mm-verify-option 'always) t)
- ((eq mm-verify-option 'known)
- (and func
- (or (not (setq functest
- (nth 3 (assoc protocol
- mm-verify-function-alist))))
- (funcall functest parts ctl))))
- (t (y-or-n-p
+ (when (cond
+ ((eq mm-verify-option 'never) nil)
+ ((eq mm-verify-option 'always) t)
+ ((eq mm-verify-option 'known)
+ (and func
+ (or (not (setq functest
+ (nth 3 (assoc protocol
+ mm-verify-function-alist))))
+ (funcall functest parts ctl))))
+ (t
+ (y-or-n-p
(format "Verify signed (%s) part? "
(or (nth 2 (assoc protocol mm-verify-function-alist))
(format "protocol=%s" protocol))))))
- (save-excursion
- (if func
- (funcall func parts ctl)
- (mm-set-handle-multipart-parameter
- mm-security-handle 'gnus-details
- (format "Unknown sign protocol (%s)" protocol))))))
+ (save-excursion
+ (if func
+ (funcall func parts ctl)
+ (mm-set-handle-multipart-parameter
+ mm-security-handle 'gnus-details
+ (format "Unknown sign protocol (%s)" protocol))))))
((equal subtype "encrypted")
(unless (setq protocol
(mm-handle-multipart-ctl-parameter ctl 'protocol))
parts nil)
(setq parts (cdr parts))))))
(setq func (nth 1 (assoc protocol mm-decrypt-function-alist)))
- (if (cond
- ((eq mm-decrypt-option 'never) nil)
- ((eq mm-decrypt-option 'always) t)
- ((eq mm-decrypt-option 'known)
- (and func
- (or (not (setq functest
- (nth 3 (assoc protocol
- mm-decrypt-function-alist))))
- (funcall functest parts ctl))))
- (t (y-or-n-p
+ (when (cond
+ ((eq mm-decrypt-option 'never) nil)
+ ((eq mm-decrypt-option 'always) t)
+ ((eq mm-decrypt-option 'known)
+ (and func
+ (or (not (setq functest
+ (nth 3 (assoc protocol
+ mm-decrypt-function-alist))))
+ (funcall functest parts ctl))))
+ (t
+ (y-or-n-p
(format "Decrypt (%s) part? "
(or (nth 2 (assoc protocol mm-decrypt-function-alist))
(format "protocol=%s" protocol))))))
- (save-excursion
- (if func
- (setq parts (funcall func parts ctl))
- (mm-set-handle-multipart-parameter
- mm-security-handle 'gnus-details
- (format "Unknown encrypt protocol (%s)" protocol))))))
+ (save-excursion
+ (if func
+ (setq parts (funcall func parts ctl))
+ (mm-set-handle-multipart-parameter
+ mm-security-handle 'gnus-details
+ (format "Unknown encrypt protocol (%s)" protocol))))))
(t nil))
parts))
"*Hook run just before posting an article. It is supposed to be used
to insert Cancel-Lock headers.")
+(defvoo nntp-read-timeout 0.1
+ "How long nntp should wait between checking for the end of output.
+Shorter values mean quicker response, but is more CPU intensive.")
+
;;; Internal variables.
(defvar nntp-record-commands nil
nntp-server-buffer))
(buffer (and process
(process-buffer process))))
- ; when I an able to identify
- ; the connection to the server
- ; AND I've received NO reponse
- ; for nntp-connection-timeout
- ; seconds.
+ ;; When I an able to identify the
+ ;; connection to the server AND I've
+ ;; received NO reponse for
+ ;; nntp-connection-timeout seconds.
(when (and buffer (eq 0 (buffer-size buffer)))
- ; Close the connection. Take
- ; no other action as the
- ; accept input code will
- ; handle the closed
- ; connection.
+ ;; Close the connection. Take no
+ ;; other action as the accept input
+ ;; code will handle the closed
+ ;; connection.
(nntp-kill-buffer buffer))))))))
(unwind-protect
(setq nntp-with-open-group-internal
(progn ,@forms)
(quit
(nntp-close-server)
- (signal 'quit nil)))
- )
+ (signal 'quit nil))))
(when timer
(nnheader-cancel-timer timer)))
nil))
(nnheader-report 'nntp message)
message))
-(defun nntp-accept-process-output (process &optional timeout)
+(defun nntp-accept-process-output (process)
"Wait for output from PROCESS and message some dots."
(save-excursion
(set-buffer (or (nntp-find-connection-buffer nntp-server-buffer)
(unless (< len 10)
(setq nntp-have-messaged t)
(nnheader-message 7 "nntp read: %dk" len)))
- (if timeout
- (accept-process-output process timeout)
- (accept-process-output process 0 100))
+ (accept-process-output
+ process
+ (truncate nntp-read-timeout)
+ (truncate (* (- nntp-read-timeout
+ (truncate nntp-read-timeout))
+ 1000)))
;; accept-process-output may update status of process to indicate
;; that the server has closed the connection. This MUST be
;; handled here as the buffer restored by the save-excursion may
;; be the process's former output buffer (i.e. now killed)
(or (and process
- (memq (process-status process) '(open run)))
+ (memq (process-status process) '(open run)))
(nntp-report "Server closed connection"))))
(defun nntp-accept-response ()
:type 'boolean
:group 'spam)
+(defcustom spam-use-regex-headers nil
+ "Whether a header regular expression match should be used by spam-split.
+Also see the variable `spam-spam-regex-headers' and `spam-ham-regex-headers'."
+ :type 'boolean
+ :group 'spam)
+
(defcustom spam-use-bogofilter-headers nil
"Whether bogofilter headers should be used by spam-split.
Enable this if you pre-process messages with Bogofilter BEFORE Gnus sees them."
:type 'face
:group 'spam)
+(defcustom spam-regex-headers-spam '("^X-Spam-Flag: YES")
+ "Regular expression for positive header spam matches"
+ :type '(repeat (regexp :tag "Regular expression to match spam header"))
+ :group 'spam)
+
+(defcustom spam-regex-headers-ham '("^X-Spam-Flag: NO")
+ "Regular expression for positive header ham matches"
+ :type '(repeat (regexp :tag "Regular expression to match ham header"))
+ :group 'spam)
+
(defgroup spam-ifile nil
"Spam ifile configuration."
:group 'spam)
(defvar spam-list-of-checks
'((spam-use-blacklist . spam-check-blacklist)
+ (spam-use-regex-headers . spam-check-regex-headers)
(spam-use-whitelist . spam-check-whitelist)
(spam-use-BBDB . spam-check-BBDB)
(spam-use-ifile . spam-check-ifile)
nil
decision)))
\f
+;;;; Regex headers
+
+(defun spam-check-regex-headers ()
+ (let (ret found)
+ (dolist (h-regex spam-regex-headers-ham)
+ (unless found
+ (goto-char (point-min))
+ (when (re-search-forward h-regex nil t)
+ (message "Ham regex header search positive.")
+ (setq found t))))
+ (dolist (s-regex spam-regex-headers-spam)
+ (unless found
+ (goto-char (point-min))
+ (when (re-search-forward s-regex nil t)
+ (message "Spam regex header search positive." (match-string 1))
+ (setq found t)
+ (setq ret spam-split-group))))
+ ret))
+
+\f
;;;; Blackholes.
(defun spam-check-blackholes ()
+2003-01-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * gnus.texi (NNTP): Addition.
+
+2003-01-23 Teodor Zlatanov <tzz@bwh.harvard.edu>
+
+ * gnus.texi (Regular Expressions Header Matching): documentation
+ for new spam splitting functionality
+
2003-01-23 Jesper Harder <harder@ifa.au.dk>
* gnus.texi (Signing and encrypting): Index.
\e$B$9$Y$F$N%5!<%P!<$,?d>)\e(B ID \e$B$r%5%]!<%H$7$F$$$k$o$1$G$O$J$$$3$H$KCm0U$7$F2<\e(B
\e$B$5$$!#$3$l$ONc$($P\e(B INN 2.3.0 \e$B0J>e$GF0:n$7$^$9!#\e(B
+@item nntp-read-timeout
+@vindex nntp-read-timeout
+Nntp \e$B$,=PNO$,=*N;$7$?$3$H$r3NG'$9$k$?$a$KBT$D$Y$-;~4V$G$9!#CM$rC;$/$9$l\e(B
+\e$B$PH?1~$,B.$/$J$j$^$9$,\e(B CPU \e$B$r?)$$$^$9!#%G%#%U%)%k%H$O\e(B 0.1 \e$BIC$G$9!#%5!<%P!<\e(B
+\e$B$KCY$$2s@~$G@\B3$7$F$$$k>l9g$O\e(B (\e$B$=$7$F\e(B Emacs \e$B$,\e(B CPU \e$B%Q%o!<$r?)$&$N$rK>$^\e(B
+\e$B$J$1$l$P\e(B)\e$B!"$3$l$rNc$($P\e(B 1 \e$B$K$7$F$b9=$$$^$;$s!#\e(B
+
@item nntp-list-options
@vindex nntp-list-options
LIST \e$B%3%^%s%I$N%*%W%7%g%s$K;H$C$F!"\e(B(\e$B%5!<%P!<$N\e(B) \e$B%j%9%H=PNO$r@_Dj$7$?%K%e!<\e(B
* Blacklists and Whitelists::
* BBDB Whitelists::
* Blackholes::
+* Regular Expressions Header Matching::
* Bogofilter::
* ifile spam filtering::
* spam-stat spam filtering::
\e$B%V%i%C%/%[!<%k!&%A%'%C%/$OF~$C$FMh$k%a!<%k$KBP$7$F$@$19T$J$o$l$^$9!#%V%i%C\e(B
\e$B%/%[!<%k$K\e(B spam \e$B$^$?$O\e(B ham \e$B%W%m%;%C%5!<$O$"$j$^$;$s!#\e(B
+@node Regular Expressions Header Matching
+@subsubsection \e$B@55,I=8=$K$h$k%X%C%@!<$N9gCW8!::\e(B
+@cindex spam filtering
+@cindex regular expressions header matching, spam filtering
+@cindex spam
+
+@defvar spam-use-regex-headers
+
+\e$B$3$N%*%W%7%g%s$O%G%#%U%)%k%H$GL58z$K$J$C$F$$$^$9!#$3$N%*%W%7%g%s$r%;%C%H\e(B
+\e$B$9$k$H!"\e(Bgnus \e$B$K@55,I=8=$N%j%9%H$H%a%C%;!<%8%X%C%@!<$r>H9g$5$;$k$3$H$,$G\e(B
+\e$B$-$^$9!#JQ?t\e(B @code{spam-regex-headers-spam} \e$B$*$h\e(B
+\e$B$S\e(B @code{spam-regex-headers-ham} \e$B$,@55,I=8=$N%j%9%H$r;}$A$^$9!#%a%C%;!<\e(B
+\e$B%8$,\e(B spam \e$B$^$?$O\e(B ham \e$B$+$I$&$+$r7h$a$k$?$a$K!"\e(BGnus \e$B$O%a%C%;!<%8%X%C%@!<$N\e(B
+\e$B$=$l$>$l$r8!::$7$^$9!#\e(B
+
+@end defvar
+
+@defvar spam-regex-headers-spam
+
+\e$B%a%C%;!<%8%X%C%@!<$NCf$G0lCW$7$?;~$K!"$=$l$,L@$i$+$K\e(B spam \e$B$G$"$k$3$H$r8+\e(B
+\e$BJ,$1$k$?$a$N@55,I=8=$N%j%9%H$G$9!#\e(B
+
+@end defvar
+
+@defvar spam-regex-headers-ham
+
+\e$B%a%C%;!<%8%X%C%@!<$NCf$G0lCW$7$?;~$K!"$=$l$,L@$i$+$K\e(B ham \e$B$G$"$k$3$H$r8+\e(B
+\e$BJ,$1$k$?$a$N@55,I=8=$N%j%9%H$G$9!#\e(B
+
+@end defvar
+
+\e$B@55,I=8=$K$h$k%X%C%@!<$N8!::$O!"F~$C$F$-$?%a!<%k$KBP$7$F$@$19T$J$o$l$^$9!#\e(B
+\e$B@55,I=8=$N$?$a$KFCM-$J\e(B spam \e$B$^$?$O\e(B ham \e$B%W%m%;%C%5!<$O$"$j$^$;$s!#\e(B
+
@node Bogofilter
@subsubsection Bogofilter
@cindex spam filtering
Note that not all servers support the recommended ID. This works for
INN versions 2.3.0 and later, for instance.
+@item nntp-read-timeout
+@vindex nntp-read-timeout
+How long nntp should wait between checking for the end of output.
+Shorter values mean quicker response, but is more CPU intensive. The
+default is 0.1 seconds. If you have a slow line to the server (and
+don't like to see Emacs eat your available CPU power), you might set
+this to, say, 1.
+
@item nntp-list-options
@vindex nntp-list-options
List of newsgroup name used for a option of the LIST command to restrict
* Blacklists and Whitelists::
* BBDB Whitelists::
* Blackholes::
+* Regular Expressions Header Matching::
* Bogofilter::
* ifile spam filtering::
* spam-stat spam filtering::
Blackhole checks are done only on incoming mail. There is no spam or
ham processor for blackholes.
+@node Regular Expressions Header Matching
+@subsubsection Regular Expressions Header Matching
+@cindex spam filtering
+@cindex regular expressions header matching, spam filtering
+@cindex spam
+
+@defvar spam-use-regex-headers
+
+This option is disabled by default. You can let Gnus check the
+message headers against lists of regular expressions when you set this
+option. The variables @code{spam-regex-headers-spam} and
+@code{spam-regex-headers-ham} hold the list of regular expressions.
+Gnus will check against the message headers to determine if the
+message is spam or ham, respectively.
+
+@end defvar
+
+@defvar spam-regex-headers-spam
+
+The list of regular expressions that, when matched in the headers of
+the message, positively identify it as spam.
+
+@end defvar
+
+@defvar spam-regex-headers-ham
+
+The list of regular expressions that, when matched in the headers of
+the message, positively identify it as ham.
+
+@end defvar
+
+Regular expression header checks are done only on incoming mail.
+There is no specific spam or ham processor for regular expressions.
+
@node Bogofilter
@subsubsection Bogofilter
@cindex spam filtering