Remove backend marks from nntp.el
[gnus] / lisp / nntp.el
index 98393a6..65387ba 100644 (file)
@@ -228,21 +228,6 @@ server there that you can connect to.  See also
 (defvoo nntp-coding-system-for-write 'binary
   "*Coding system to write to NNTP.")
 
-;; Marks
-(defvoo nntp-marks-is-evil nil
-  "*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")
-(defvoo nntp-marks nil)
-(defvar nntp-marks-modtime (gnus-make-hashtable))
-
-(defcustom nntp-marks-directory
-  (nnheader-concat gnus-directory "marks/")
-  "*The directory where marks for nntp groups will be stored."
-  :group 'nntp
-  :type 'directory)
-
 (defcustom nntp-authinfo-file "~/.authinfo"
   ".netrc-like file that holds nntp authinfo passwords."
   :group 'nntp
@@ -1188,43 +1173,6 @@ command whose response triggered the error."
 (deffoo nntp-asynchronous-p ()
   t)
 
-(deffoo nntp-request-set-mark (group actions &optional server)
-  (when (and (not nntp-marks-is-evil)
-            nntp-marks-file-name)
-    (nntp-possibly-create-directory group server)
-    (nntp-open-marks group server)
-    (setq nntp-marks (nnheader-update-marks-actions nntp-marks actions))
-    (nntp-save-marks group server))
-  nil)
-
-(deffoo nntp-request-marks (group info &optional server)
-  (when (and (not nntp-marks-is-evil)
-            nntp-marks-file-name)
-    (nntp-possibly-create-directory group server)
-    (when (nntp-marks-changed-p group server)
-      (nnheader-message 8 "Updating marks for %s..." group)
-      (nntp-open-marks group server)
-      ;; Update info using `nntp-marks'.
-      (mapc (lambda (pred)
-             (unless (memq (cdr pred) gnus-article-unpropagated-mark-lists)
-               (gnus-info-set-marks
-                info
-                (gnus-update-alist-soft
-                 (cdr pred)
-                 (cdr (assq (cdr pred) nntp-marks))
-                 (gnus-info-marks info))
-                t)))
-           gnus-article-mark-lists)
-      (let ((seen (cdr (assq 'read nntp-marks))))
-       (gnus-info-set-read info
-                           (if (and (integerp (car seen))
-                                    (null (cdr seen)))
-                               (list (cons (car seen) (car seen)))
-                             seen)))
-      (nnheader-message 8 "Updating marks for %s...done" group)))
-  nil)
-
-
 
 ;;; Hooky functions.
 
@@ -2164,95 +2112,6 @@ Please refer to the following variables to customize the connection:
        (delete-region (point) (point-max)))
       proc)))
 
-;; Marks handling
-
-(defun nntp-marks-directory (server)
-  (expand-file-name server nntp-marks-directory))
-
-(defvar nntp-server-to-method-cache nil
-  "Alist of servers and select methods.")
-
-(defun nntp-group-pathname (server group &optional file)
-  "Return an absolute file name of FILE for GROUP on SERVER."
-  (let ((method (cdr (assoc server nntp-server-to-method-cache))))
-    (unless method
-      (push (cons server (setq method (or (gnus-server-to-method server)
-                                         (gnus-find-method-for-group group))))
-           nntp-server-to-method-cache))
-    (nnmail-group-pathname
-     (mm-decode-coding-string group
-                             (inline (gnus-group-name-charset method group)))
-     (nntp-marks-directory server)
-     file)))
-
-(defun nntp-possibly-create-directory (group server)
-  (let ((dir (nntp-group-pathname server group))
-       (file-name-coding-system nnmail-pathname-coding-system))
-    (unless (file-exists-p dir)
-      (make-directory (directory-file-name dir) t)
-      (nnheader-message 5 "Creating nntp marks directory %s" dir))))
-
-(autoload 'time-less-p "time-date")
-
-(defun nntp-marks-changed-p (group server)
-  (let ((file (nntp-group-pathname server group nntp-marks-file-name))
-       (file-name-coding-system nnmail-pathname-coding-system))
-    (if (null (gnus-gethash file nntp-marks-modtime))
-       t ;; never looked at marks file, assume it has changed
-      (time-less-p (gnus-gethash file nntp-marks-modtime)
-                  (nth 5 (file-attributes file))))))
-
-(defun nntp-save-marks (group server)
-  (let ((file-name-coding-system nnmail-pathname-coding-system)
-       (file (nntp-group-pathname server group nntp-marks-file-name)))
-    (condition-case err
-       (progn
-         (nntp-possibly-create-directory group server)
-         (with-temp-file file
-           (erase-buffer)
-           (gnus-prin1 nntp-marks)
-           (insert "\n"))
-         (gnus-sethash file
-                       (nth 5 (file-attributes file))
-                       nntp-marks-modtime))
-      (error (or (gnus-yes-or-no-p
-                 (format "Could not write to %s (%s).  Continue? " file err))
-                (error "Cannot write to %s (%s)" file err))))))
-
-(defun nntp-open-marks (group server)
-  (let ((file (nntp-group-pathname server group nntp-marks-file-name))
-       (file-name-coding-system nnmail-pathname-coding-system))
-    (if (file-exists-p file)
-       (condition-case err
-           (with-temp-buffer
-             (gnus-sethash file (nth 5 (file-attributes file))
-                           nntp-marks-modtime)
-             (nnheader-insert-file-contents file)
-             (setq nntp-marks (read (current-buffer)))
-             (dolist (el gnus-article-unpropagated-mark-lists)
-               (setq nntp-marks (gnus-remassoc el nntp-marks))))
-         (error (or (gnus-yes-or-no-p
-                     (format "Error reading nntp marks file %s (%s).  Continuing will use marks from .newsrc.eld.  Continue? " file err))
-                    (error "Cannot read nntp marks file %s (%s)" file err))))
-      ;; User didn't have a .marks file.  Probably first time
-      ;; user of the .marks stuff.  Bootstrap it from .newsrc.eld.
-      (let ((info (gnus-get-info
-                  (gnus-group-prefixed-name
-                   group
-                   (gnus-server-to-method (format "nntp:%s" server)))))
-           (decoded-name (mm-decode-coding-string
-                          group
-                          (gnus-group-name-charset
-                           (gnus-server-to-method server) group))))
-       (nnheader-message 7 "Bootstrapping marks for %s..." decoded-name)
-       (setq nntp-marks (gnus-info-marks info))
-       (push (cons 'read (gnus-info-read info)) nntp-marks)
-       (dolist (el gnus-article-unpropagated-mark-lists)
-         (setq nntp-marks (gnus-remassoc el nntp-marks)))
-       (nntp-save-marks group server)
-       (nnheader-message 7 "Bootstrapping marks for %s...done"
-                         decoded-name)))))
-
 (provide 'nntp)
 
 ;;; nntp.el ends here