Synch to No Gnus 200409101504.
[elisp/gnus.git-] / lisp / nntp.el
index 7507eb6..bdaa7b6 100644 (file)
 (require 'nnheader)
 (require 'nnoo)
 (require 'gnus-util)
+(require 'gnus)
 
 (nnoo-declare nntp)
 
+(defgroup nntp nil
+  "NNTP access for Gnus."
+  :group 'gnus)
+
 (defvoo nntp-address nil
   "Address of the physical nntp server.")
 
@@ -220,7 +225,7 @@ server there that you can connect to.  See also
 
 ;; Marks
 (defvoo nntp-marks-is-evil nil
-  "*If non-nil, GNus will never generate and use marks file for nntp groups.
+  "*If non-nil, Gnus will never generate and use marks file for nntp groups.
 See `nnml-marks-is-evil' for more information.")
 
 (defvoo nntp-marks-file-name ".marks")
@@ -235,6 +240,7 @@ See `nnml-marks-is-evil' for more information.")
 
 (defcustom nntp-authinfo-file "~/.authinfo"
   ".netrc-like file that holds nntp authinfo passwords."
+  :group 'nntp
   :type
   '(choice file
           (repeat :tag "Entries"
@@ -1091,8 +1097,8 @@ newsgroups that match the regexp."
   t)
 
 (deffoo nntp-request-set-mark (group actions &optional server)
-  (nntp-possibly-change-group group server)
   (unless nntp-marks-is-evil
+    (nntp-possibly-create-directory group server)
     (nntp-open-marks group server)
     (dolist (action actions)
       (let ((range (nth 0 action))
@@ -1111,8 +1117,9 @@ newsgroups that match the regexp."
   nil)
 
 (deffoo nntp-request-update-info (group info &optional server)
-  (nntp-possibly-change-group group server)
-  (when (and (not nntp-marks-is-evil) (nntp-marks-changed-p group))
+  (unless nntp-marks-is-evil
+    (nntp-possibly-create-directory group server))
+  (when (and (not nntp-marks-is-evil) (nntp-marks-changed-p group server))
     (nnheader-message 8 "Updating marks for %s..." group)
     (nntp-open-marks group server)
     ;; Update info using `nntp-marks'.
@@ -1154,11 +1161,11 @@ and a password.
 
 If SEND-IF-FORCE, only send authinfo to the server if the
 .authinfo file has the FORCE token."
-  (let* ((list (gnus-parse-netrc nntp-authinfo-file))
-        (alist (gnus-netrc-machine list nntp-address "nntp"))
-        (force (gnus-netrc-get alist "force"))
-        (user (or (gnus-netrc-get alist "login") nntp-authinfo-user))
-        (passwd (gnus-netrc-get alist "password")))
+  (let* ((list (netrc-parse nntp-authinfo-file))
+        (alist (netrc-machine list nntp-address "nntp"))
+        (force (netrc-get alist "force"))
+        (user (or (netrc-get alist "login") nntp-authinfo-user))
+        (passwd (netrc-get alist "password")))
     (when (or (not send-if-force)
              force)
       (unless user
@@ -2051,7 +2058,7 @@ Please refer to the following variables to customize the connection:
       (make-directory (directory-file-name dir) t)
       (nnheader-message 5 "Creating nntp marks directory %s" dir))))
 
-(defun nntp-marks-changed-p (group)
+(defun nntp-marks-changed-p (group server)
   (let ((file (expand-file-name
               nntp-marks-file-name 
               (nnmail-group-pathname
@@ -2069,7 +2076,7 @@ Please refer to the following variables to customize the connection:
                group (nntp-marks-directory server)))))
     (condition-case err
        (progn
-         (nntp-possibly-create-directory group)
+         (nntp-possibly-create-directory group server)
          (with-temp-file file
            (erase-buffer)
            (gnus-prin1 nntp-marks)