From: Reiner Steib Date: Thu, 24 Jan 2008 22:16:33 +0000 (+0000) Subject: * mail-source.el (mail-sources): Add `group' choice. X-Git-Url: http://cgit.sxemacs.org/?a=commitdiff_plain;h=1b54251ced701c3738cde4f0021fa95583874ed3;p=gnus * mail-source.el (mail-sources): Add `group' choice. * nnmail.el (nnmail-get-new-mail-1): Abstract this out to add another parameter `in-group' to control into which group the articles go. Add treatment of `group' mail-source. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa9cd6719..5dc38e5b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2008-01-24 Michael Sperber + + * mail-source.el (mail-sources): Add `group' choice. + + * nnmail.el (nnmail-get-new-mail-1): Abstract this out to add another + parameter `in-group' to control into which group the articles go. + Add treatment of `group' mail-source. + 2008-01-23 Katsumi Yamaoka * gnus-art.el (gnus-insert-mime-button): Don't decode description. diff --git a/lisp/mail-source.el b/lisp/mail-source.el index 9f9f97331..01463c556 100644 --- a/lisp/mail-source.el +++ b/lisp/mail-source.el @@ -74,6 +74,8 @@ See Info node `(gnus)Mail Source Specifiers'." (repeat :tag "List" (choice :format "%[Value Menu%] %v" :value (file) + (cons :tag "Group parameter `mail-source'" + (const :format "" group)) (cons :tag "Spool file" (const :format "" file) (checklist :tag "Options" :greedy t diff --git a/lisp/nnmail.el b/lisp/nnmail.el index f0f90218a..a6ed71903 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1766,11 +1766,15 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (symbol-value sym)))) (defun nnmail-get-new-mail (method exit-func temp - &optional group spool-func) + &optional group spool-func) "Read new incoming mail." + (nnmail-get-new-mail-1 method exit-func temp group nil spool-func)) + +(defun nnmail-get-new-mail-1 (method exit-func temp + group in-group spool-func) + (let* ((sources mail-sources) fetching-sources - (group-in group) (i 0) (new 0) (total 0) @@ -1778,6 +1782,18 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (when (and (nnmail-get-value "%s-get-new-mail" method) sources) (while (setq source (pop sources)) + + ;; Use group's parameter + (when (eq (car source) 'group) + (let ((mail-sources + (list + (gnus-group-find-parameter + (concat (symbol-name method) ":" group) + 'mail-source t)))) + (nnmail-get-new-mail-1 method exit-func temp + group group spool-func)) + (setq source nil)) + ;; Hack to only fetch the contents of a single group's spool file. (when (and (eq (car source) 'directory) (null nnmail-scan-directory-mail-source-once) @@ -1816,9 +1832,10 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (nnmail-split-incoming file ',(intern (format "%s-save-mail" method)) ',spool-func - (if (equal file orig-file) - nil - (nnmail-get-split-group orig-file ',source)) + (or in-group + (if (equal file orig-file) + nil + (nnmail-get-split-group orig-file ',source))) ',(intern (format "%s-active-number" method))))))) (incf total new) (incf i)))