-(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-seconds-since-epoch (date)
- (let* ((tdate (mapcar (lambda (ti) (and ti (string-to-int ti)))
- (timezone-parse-date date)))
- (ttime (mapcar (lambda (ti) (and ti (string-to-int ti)))
- (timezone-parse-time
- (aref (timezone-parse-date date) 3))))
- (edate (mapcar (lambda (ti) (and ti (string-to-int ti)))
- (timezone-parse-date "Jan 1 12:00:00 1970")))
- (tday (- (timezone-absolute-from-gregorian
- (nth 1 tdate) (nth 2 tdate) (nth 0 tdate))
- (timezone-absolute-from-gregorian
- (nth 1 edate) (nth 2 edate) (nth 0 edate)))))
- (+ (nth 2 ttime)
- (* (nth 1 ttime) 60)
- (* 1.0 (nth 0 ttime) 60 60)
- (* 1.0 tday 60 60 24))))
+(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))