X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;ds=inline;f=lisp%2Fnnspool.el;h=5cbfed79a0d54649ed4a0239823a2d6e8988b3bf;hb=82d219ce980dc263c9288225f901635336101fb4;hp=8d45210fcc900b98858f9515fb2f6e0d83906c4f;hpb=b28454eed83f245c4160228b076134ce930b320a;p=gnus diff --git a/lisp/nnspool.el b/lisp/nnspool.el index 8d45210fc..5cbfed79a 100644 --- a/lisp/nnspool.el +++ b/lisp/nnspool.el @@ -1,8 +1,8 @@ ;;; nnspool.el --- spool access for GNU Emacs -;; Copyright (C) 1988,89,90,93,94,95,96,97 Free Software Foundation, Inc. +;; Copyright (C) 1988,89,90,93,94,95,96,97,98 Free Software Foundation, Inc. ;; Author: Masanobu UMEDA -;; Lars Magne Ingebrigtsen +;; Lars Magne Ingebrigtsen ;; Keywords: news ;; This file is part of GNU Emacs. @@ -28,7 +28,6 @@ (require 'nnheader) (require 'nntp) -(require 'timezone) (require 'nnoo) (eval-when-compile (require 'cl)) @@ -82,6 +81,9 @@ there.") (defvoo nnspool-rejected-article-hook nil "*A hook that will be run when an article has been rejected by the server.") +(defvoo nnspool-file-coding-system nnheader-file-coding-system + "Coding system for nnspool.") + (defconst nnspool-version "nnspool 2.0" @@ -109,6 +111,7 @@ there.") (default-directory nnspool-current-directory) (do-message (and (numberp nnspool-large-newsgroup) (> number nnspool-large-newsgroup))) + (nnheader-file-coding-system nnspool-file-coding-system) file beg article ag) (if (and (numberp (car articles)) (nnspool-retrieve-headers-with-nov articles fetch-old)) @@ -133,18 +136,23 @@ there.") (setq beg (point)) (inline (nnheader-insert-head file)) (goto-char beg) - (search-forward "\n\n" nil t) - (forward-char -1) - (insert ".\n") + (if (search-forward "\n\n" nil t) + (progn + (forward-char -1) + (insert ".\n")) + (goto-char (point-max)) + (if (bolp) + (insert ".\n") + (insert "\n.\n"))) (delete-region (point) (point-max))) (and do-message (zerop (% (incf count) 20)) - (message "nnspool: Receiving headers... %d%%" - (/ (* count 100) number)))) + (nnheader-message 5 "nnspool: Receiving headers... %d%%" + (/ (* count 100) number)))) (when do-message - (message "nnspool: Receiving headers...done")) + (nnheader-message 5 "nnspool: Receiving headers...done")) ;; Fold continuation lines. (nnheader-fold-continuation-lines) @@ -276,7 +284,7 @@ there.") (while (and (not (looking-at "\\([^ ]+\\) +\\([0-9]+\\)[0-9][0-9][0-9] ")) (zerop (forward-line -1)))) - (let ((seconds (nnspool-seconds-since-epoch date)) + (let ((seconds (time-to-seconds (date-to-time date))) groups) ;; Go through lines and add the latest groups to a list. (while (and (looking-at "\\([^ ]+\\) +[0-9]+ ") @@ -291,8 +299,8 @@ there.") (read (current-buffer))) seconds)) (push (buffer-substring - (match-beginning 1) (match-end 1)) - groups) + (match-beginning 1) (match-end 1)) + groups) (zerop (forward-line -1)))) (erase-buffer) (while groups @@ -339,7 +347,7 @@ there.") (while (re-search-forward "[ \t\n]+" nil t) (replace-match " " t t)) (nnheader-report 'nnspool "%s" (buffer-string)) - (message "nnspool: %s" nnspool-status-string) + (nnheader-message 5 "nnspool: %s" nnspool-status-string) (ding) (run-hooks 'nnspool-rejected-article-hook)))) @@ -349,6 +357,7 @@ there.") (let ((nov (nnheader-group-pathname nnspool-current-group nnspool-nov-directory ".overview")) (arts articles) + (nnheader-file-coding-system nnspool-file-coding-system) last) (if (not (file-exists-p nov)) () @@ -415,7 +424,6 @@ there.") (defun nnspool-find-id (id) (save-excursion (set-buffer (get-buffer-create " *nnspool work*")) - (buffer-disable-undo (current-buffer)) (erase-buffer) (ignore-errors (call-process "grep" nil t nil (regexp-quote id) nnspool-history-file)) @@ -430,7 +438,9 @@ there.") (set-buffer nntp-server-buffer) (erase-buffer) (condition-case () - (progn (nnheader-insert-file-contents file) t) + (let ((coding-system-for-read nnspool-file-coding-system)) + (mm-insert-file-contents file) + t) (file-error nil))) (defun nnspool-possibly-change-directory (group) @@ -446,18 +456,6 @@ there.") "Find the path for GROUP." (nnheader-group-pathname group nnspool-spool-directory article)) -(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)))) - (unix (encode-time (nth 2 ttime) (nth 1 ttime) (nth 0 ttime) - (nth 2 tdate) (nth 1 tdate) (nth 0 tdate) - (nth 4 tdate)))) - (+ (* (car unix) 65536.0) - (cadr unix)))) - (provide 'nnspool) ;;; nnspool.el ends here