;;; nnmail.el --- mail support functions for the Gnus mail backends
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news, mail
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
+;; For Emacs < 22.2.
+(eval-and-compile
+ (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
(eval-when-compile (require 'cl))
(require 'gnus) ; for macro gnus-kill-buffer, at least
(require 'gnus-util)
(require 'mail-source)
(require 'mm-util)
+(require 'gnus-int)
-(eval-and-compile
- (autoload 'gnus-add-buffer "gnus")
- (autoload 'gnus-kill-buffer "gnus"))
+(autoload 'gnus-add-buffer "gnus")
+(autoload 'gnus-kill-buffer "gnus")
(defgroup nnmail nil
"Reading mail with Gnus."
:version "21.1"
:group 'nnmail-expire
:type '(choice (const delete)
- (function :format "%v" nnmail-)
+ function
string))
(defcustom nnmail-fancy-expiry-targets nil
:type '(choice (const :tag "disable" nil)
(integer :format "%v")))
-(defcustom nnmail-message-id-cache-file "~/.nnmail-cache"
- "*The file name of the nnmail Message-ID cache."
+(defcustom nnmail-message-id-cache-file
+ (nnheader-concat gnus-home-directory ".nnmail-cache")
+ "The file name of the nnmail Message-ID cache."
:group 'nnmail-duplicate
:group 'nnmail-files
:type 'file)
"Header line matching mailer producing bogus References lines.
See `nnmail-ignore-broken-references'."
:group 'nnmail-prepare
- :version "23.0" ;; No Gnus
+ :version "23.1" ;; No Gnus
:type 'regexp)
(defun nnmail-ignore-broken-references ()
;;; Utility functions
+(declare-function gnus-activate-group "gnus-start"
+ (group &optional scan dont-check method))
+
(defun nnmail-do-request-post (accept-func &optional server)
"Utility function to directly post a message to an nnmail-derived group.
Calls ACCEPT-FUNC (which should be `nnchoke-request-accept-article')
(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)
(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)
(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)))
;; Compare the time with the current time.
(ignore-errors (time-less-p days (time-since time))))))))
+(declare-function gnus-group-mark-article-read "gnus-group" (group article))
+
(defun nnmail-expiry-target-group (target group)
;; Do not invoke this from nntp-server-buffer! At least nnfolder clears
;; that buffer if the nnfolder group isn't selected.
(provide 'nnmail)
-;;; arch-tag: fe8f671a-50db-428a-bb5d-f00462f72ed7
+;; arch-tag: fe8f671a-50db-428a-bb5d-f00462f72ed7
;;; nnmail.el ends here