-(defun nnspool-possibly-change-directory (newsgroup)
- (if newsgroup
- (let ((pathname (nnspool-article-pathname
- (nnspool-replace-chars-in-string newsgroup ?. ?/))))
- (if (file-directory-p pathname)
- (progn
- (setq nnspool-current-directory pathname)
- (setq nnspool-current-group newsgroup))
- (setq nnspool-status-string
- (format "No such newsgroup: %s" newsgroup))
- nil))
- t))
-
-(defun nnspool-article-pathname (group)
- "Make pathname for GROUP."
- (concat (file-name-as-directory nnspool-spool-directory) group "/"))
-
-(defun nnspool-replace-chars-in-string (string from to)
- "Replace characters in STRING from FROM to TO."
- (let ((string (substring string 0)) ;Copy string.
- (len (length string))
- (idx 0))
- ;; Replace all occurrences of FROM with TO.
- (while (< idx len)
- (if (= (aref string idx) from)
- (aset string idx to))
- (setq idx (1+ idx)))
- string))
-
-(defun nnspool-number-base-10 (num pos)
- (if (<= pos 0) ""
- (setcdr num (+ (* (% (car num) 10) 65536) (cdr num)))
- (apply
- 'concat
- (reverse
- (list
- (char-to-string
- (aref "0123456789" (% (cdr num) 10)))
- (progn
- (setcdr num (/ (cdr num) 10))
- (setcar num (/ (car num) 10))
- (nnspool-number-base-10 num (1- pos))))))))
-
-(defun nnspool-days-between (date1 date2)
- ;; Return the number of days between date1 and date2.
- (let ((d1 (mapcar (lambda (s) (and s (string-to-int s)))
- (timezone-parse-date date1)))
- (d2 (mapcar (lambda (s) (and s (string-to-int s)))
- (timezone-parse-date date2))))
- (- (timezone-absolute-from-gregorian
- (nth 1 d1) (nth 2 d1) (car d1))
- (timezone-absolute-from-gregorian
- (nth 1 d2) (nth 2 d2) (car d2)))))
-
-(defun nnspool-date-to-seconds (string)
- (let ((days (nnspool-days-between string "Jan 1 00:00:00 1970")))
- (* days 86)))
+(defun nnspool-possibly-change-directory (group)
+ (if (not group)
+ t
+ (let ((pathname (nnspool-article-pathname group)))
+ (if (file-directory-p pathname)
+ (setq nnspool-current-directory pathname
+ nnspool-current-group group)
+ (nnheader-report 'nnspool "No such newsgroup: %s" group)))))
+
+(defun nnspool-article-pathname (group &optional article)
+ "Find the file name for GROUP."
+ (nnheader-group-pathname group nnspool-spool-directory article))