- "Find the path for GROUP."
- (concat
- (file-name-as-directory nnspool-spool-directory)
- (nnspool-replace-chars-in-string group ?. ?/)
- "/"
- (if article (int-to-string article) "")))
-
-(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))))