+2004-02-26 Mark A. Hershberger <mah@everybody.org>
+
+ * nnrss.el (nnrss-opml-import, nnrss-opml-export): New functions.
+
+2004-02-26 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * spam.el (spam-summary-prepare-exit): gnus-set-difference needs
+ to be run with new-articles as LIST1, not LIST2
+ (spam-registration-functions): add spam-use-ham-copy as a nil
+ registration backend
+
+2004-02-26 Jesper Harder <harder@ifa.au.dk>
+
+ * spam-stat.el (spam-stat-washing-hook): New option.
+ (spam-stat-buffer-words): Use it.
+ (spam-stat-process-directory, spam-stat-test-directory): Use
+ insert-file-contents-literally.
+ (spam-stat-coding-system): New variable.
+ (spam-stat-load, spam-stat-save): Use it.
+
2004-02-25 Katsumi Yamaoka <yamaoka@jpl.org>
* spam-report.el (spam-report-plug-agent): Quote
;;; nnrss.el --- interfacing with RSS
-;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
;; Keywords: RSS
(push (list group nnrss-group-max) nnrss-server-data)))
(nnrss-save-server-data server))))
+(defun nnrss-opml-import (opml-file)
+ "OPML subscriptions import.
+Read the file and attempt to subscribe to each Feed in the file."
+ (interactive "fImport file: ")
+ (mapcar
+ (lambda (node) (gnus-group-make-rss-group
+ (cdr (assq 'xmlUrl (cadr node)))))
+ (nnrss-find-el 'outline
+ (progn
+ (find-file opml-file)
+ (xml-parse-region (point-min)
+ (point-max))))))
+
+(defun nnrss-opml-export ()
+ "OPML subscription export.
+Export subscriptions to a buffer in OPML Format."
+ (interactive)
+ (with-current-buffer (get-buffer-create "*OPML Export*")
+ (set-buffer-file-coding-system 'utf-8)
+ (insert (concat
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<!-- OPML generated by Emacs Gnus' nnrss.el -->\n"
+ "<opml version=\"1.1\">\n"
+ " <head>\n"
+ " <title>mySubscriptions</title>\n"
+ " <dateCreated>" (format-time-string "%a, %d %b %Y %T %z")
+ "</dateCreated>\n"
+ " <ownerEmail>" user-mail-address "</ownerEmail>\n"
+ " <ownerName>" (user-full-name) "</ownerName>\n"
+ " </head>\n"
+ " <body>\n"))
+ (mapcar (lambda (sub)
+ (insert (concat
+ " <outline text=\"" (car sub) "\" xmlUrl=\""
+ (cadr sub) "\"/>\n")))
+ nnrss-group-alist)
+ (insert (concat
+ " </body>\n"
+ "</opml>\n")))
+ (pop-to-buffer "*OPML Export*"))
+
(defun nnrss-generate-download-script ()
"Generate a download script in the current buffer.
It is useful when `(setq nnrss-use-local t)'."
:type 'number
:group 'spam-stat)
+(defcustom spam-stat-washing-hook nil
+ "Hook applied to each message before analysis."
+ :type 'hook
+ :group 'spam-stat)
+
(defcustom spam-stat-process-directory-age 90
"Max. age of files to be processed in directory, in days.
When using `spam-stat-process-spam-directory' or
(defvar spam-stat-buffer-name " *spam stat buffer*"
"Name of the `spam-stat-buffer'.")
+(defvar spam-stat-coding-system
+ (if (coding-system-p 'emacs-mule) 'emacs-mule 'raw-text)
+ "Coding system used for `spam-stat-file'.")
+
;; Hooking into Gnus
(defun spam-stat-store-current-buffer ()
(defun spam-stat-buffer-words ()
"Return a hash table of words and number of occurences in the buffer."
+ (run-hooks 'spam-stat-washing-hook)
(with-spam-stat-max-buffer-size
(with-syntax-table spam-stat-syntax-table
(goto-char (point-min))
With a prefix argument save unconditionally."
(interactive "P")
(when (or force spam-stat-dirty)
- (with-temp-buffer
- (let ((standard-output (current-buffer))
- (font-lock-maximum-size 0))
- (insert "(setq spam-stat-ngood "
- (number-to-string spam-stat-ngood)
- " spam-stat-nbad "
- (number-to-string spam-stat-nbad)
- " spam-stat (spam-stat-to-hash-table '(")
- (maphash (lambda (word entry)
- (prin1 (list word
- (spam-stat-good entry)
- (spam-stat-bad entry))))
- spam-stat)
- (insert ")))")
- (write-file spam-stat-file)))
- (setq spam-stat-dirty nil)))
+ (let ((coding-system-for-write spam-stat-coding-system))
+ (with-temp-file spam-stat-file
+ (let ((standard-output (current-buffer))
+ (font-lock-maximum-size 0))
+ (insert (format ";-*- coding: %s; -*-\n" spam-stat-coding-system))
+ (insert (format "(setq spam-stat-ngood %d spam-stat-nbad %d
+spam-stat (spam-stat-to-hash-table '(" spam-stat-ngood spam-stat-nbad))
+ (maphash (lambda (word entry)
+ (prin1 (list word
+ (spam-stat-good entry)
+ (spam-stat-bad entry))))
+ spam-stat)
+ (insert ")))"))))
+ (setq spam-stat-dirty nil)))
(defun spam-stat-load ()
"Read the `spam-stat' hash table from disk."
;; TODO: maybe we should warn the user if spam-stat-dirty is t?
- (load-file spam-stat-file)
+ (let ((coding-system-for-read spam-stat-coding-system))
+ (load-file spam-stat-file))
(setq spam-stat-dirty nil))
(defun spam-stat-to-hash-table (entries)
spam-stat-process-directory-age))
(setq count (1+ count))
(message "Reading %s: %.2f%%" dir (/ count max))
- (insert-file-contents f)
+ (insert-file-contents-literally f)
(spam-stat-strip-xref)
(funcall func)
(erase-buffer))))))
(setq count (1+ count))
(message "Reading %.2f%%, score %.2f"
(/ count max) (/ score count))
- (insert-file-contents f)
+ (insert-file-contents-literally f)
(setq buffer-score (spam-stat-score-buffer))
(when (> buffer-score 0.9)
(setq score (1+ score)))
(new-articles (spam-list-articles
gnus-newsgroup-articles
classification))
- (changed-articles (gnus-set-difference old-articles new-articles)))
+ (changed-articles (gnus-set-difference new-articles old-articles)))
;; now that we have the changed articles, we go through the processors
(dolist (processor-param spam-list-of-processors)
(let ((processor (nth 0 processor-param))
nil
spam-whitelist-unregister-routine
nil)
+ (spam-use-ham-copy nil
+ nil
+ nil
+ nil)
(spam-use-BBDB spam-BBDB-register-routine
nil
spam-BBDB-unregister-routine
nil
decision)))
+
;;; check if a ham- or spam-processor registration needs to be undone
(defun spam-log-unregistration-needed-p (id type classification check)
(when spam-log-to-registry