;;; elmo-archive.el -- Archive folder of ELMO.
-;; Copyright 1998,1999,2000 OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
-;; Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
-;; Author: OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
+;; Author: OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
+;; Yuuichi Teranishi <teranisi@gohome.org>
;; Keywords: mail, net news
;; Created: Sep 13, 1998
-;; Revised: Dec 15, 1998
;; This file is part of ELMO (Elisp Library for Message Orchestration).
;;; Commentary:
;;
;; TODO:
-;; [\e$B%\%=\e(B] append-msgs() \e$B$,M_$7$$!J$1$I\e(B multi-refile \e$BIT2D!K!#\e(B
-;; Info-Zip \e$B@lMQ%(!<%8%'%s%H$rMQ$$$?F|K\8l8!:w!J\e(BOS/2 \e$B@lMQ!K!#\e(B
+;; [¥Ü¥½] append-msgs() ¤¬Íߤ·¤¤¡Ê¤±¤É multi-refile ÉԲġˡ£
+;; Info-Zip ÀìÍÑ¥¨¡¼¥¸¥§¥ó¥È¤òÍѤ¤¤¿ÆüËܸ측º÷¡ÊOS/2 ÀìÍÑ¡Ë¡£
;;; Code:
;;
"*Regular expression of UNIX Mail delimiter.")
(defvar elmo-archive-header-regexp "^[ \t]*[-=][-=][-=][-=]"
- "*Common regexp of the delimiter in listing archive.") ;; marche
+ "*Common regexp of the delimiter in listing archive.") ; marche
(defvar elmo-archive-file-regexp-alist
(append
(if elmo-archive-lha-dos-compatible
- '((lha . "^%s\\([0-9]+\\)$")) ; OS/2,DOS w/ "-x"
+ '((lha . "^%s\\([0-9]+\\)$")) ; OS/2,DOS w/ "-x"
'((lha . "^.*[ \t]%s\\([0-9]+\\)$")))
'((zip . "^.*[ \t]%s\\([0-9]+\\)$")
(zoo . "^.*[ \t]%s\\([0-9]+\\)$")
- (tar . "^%s\\([0-9]+\\)$") ; ok
- (tgz . "^%s\\([0-9]+\\)$") ; ok
+ (tar . "^%s\\([0-9]+\\)$") ; ok
+ (tgz . "^%s\\([0-9]+\\)$") ; ok
(rar . "^[ \t]%s\\([0-9]+\\)$"))))
(defvar elmo-archive-suffix-alist
'((lha . ".lzh") ; default
-; (lha . ".lzs")
+;;; (lha . ".lzs")
(zip . ".zip")
(zoo . ".zoo")
-; (arc . ".arc")
-; (arj . ".arj")
+;;; (arc . ".arc")
+;;; (arj . ".arj")
(rar . ".rar")
(tar . ".tar")
(tgz . ".tar.gz")))
(rm . ("lha" "d"))
(ls . ("lha" "l" "-x"))
(cat . ("lha" "p" "-n"))
- (ext . ("lha" "x")) ; "-x"
+ (ext . ("lha" "x")) ; "-x"
)
;; some UN|X
'((cp . ("lha" "u"))
(mv . ("zoo" "aMq"))
(mv-pipe . ("zoo" "aMqI"))
(rm . ("zoo" "Dq"))
- (ls . ("zoo" "l")) ; normal
+ (ls . ("zoo" "l")) ; normal
(cat . ("zoo" "xpq"))
(ext . ("zoo" "xq"))))
'((ls . ("gtar" "-tf"))
(cat . ("gtar" "--posix Oxf"))
(ext . ("gtar" "-xf"))
- ;;(rm . ("gtar" "--posix" "--delete" "-f")) ;; well not work
+;;; (rm . ("gtar" "--posix" "--delete" "-f")) ; well not work
)
- '((ls . ("gtar" "-tf"))
- (cat . ("gtar" "-Oxf"))
- (ext . ("gtar" "-xf"))
- ;;(rm . ("gtar" "--delete" "-f")) ;; well not work
- )))
+ '((ls . ("gtar" "-tf"))
+ (cat . ("gtar" "-Oxf"))
+ (ext . ("gtar" "-xf"))
+;;; (rm . ("gtar" "--delete" "-f")) ;; well not work
+ )))
;;; GNU tar (*.tar.gz, *.tar.Z, *.tar.bz2)
(defvar elmo-archive-tgz-method-alist
'((ls . ("gtar" "-ztf"))
(cat . ("gtar" "-Ozxf"))
(create . ("gtar" "-zcf"))
- ;;(rm . elmo-archive-tgz-rm-func)
+;;; (rm . elmo-archive-tgz-rm-func)
(cp . elmo-archive-tgz-cp-func)
(mv . elmo-archive-tgz-mv-func)
(ext . ("gtar" "-zxf"))
(decompress . ("gzip" "-d"))
(compress . ("gzip"))
(append . ("gtar" "-uf"))
- ;;(delete . ("gtar" "--delete" "-f")) ;; well not work
+;;; (delete . ("gtar" "--delete" "-f")) ; well not work
))
(defvar elmo-archive-method-list
'(elmo-archive-lha-method-alist
elmo-archive-zip-method-alist
elmo-archive-zoo-method-alist
-; elmo-archive-tar-method-alist
+;;; elmo-archive-tar-method-alist
elmo-archive-tgz-method-alist
-; elmo-archive-arc-method-alist
-; elmo-archive-arj-method-alist
+;;; elmo-archive-arc-method-alist
+;;; elmo-archive-arj-method-alist
elmo-archive-rar-method-alist))
;;; Internal vars.
(` (cdr (assq (, type)
elmo-archive-file-regexp-alist))))
-(defsubst elmo-archive-call-process (prog args &optional output)
- (= (apply 'call-process prog nil output nil args) 0))
+(static-if (boundp 'NEMACS)
+ (defsubst elmo-archive-call-process (prog args &optional output)
+ (apply 'call-process prog nil output nil args)
+ 0)
+ (defsubst elmo-archive-call-process (prog args &optional output)
+ (= (apply 'call-process prog nil output nil args) 0)))
(defsubst elmo-archive-call-method (method args &optional output)
(cond
(if nonsort
(cons (or (elmo-max-of-list file-list) 0)
(if killed
- (- (length file-list) (length killed))
+ (- (length file-list)
+ (elmo-msgdb-killed-list-length killed))
(length file-list)))
(setq numbers (sort file-list '<))
(elmo-living-messages numbers killed))))
-(defun elmo-archive-list-folder (spec)
+(defun elmo-archive-list-folder (spec &optional nohide)
(elmo-archive-list-folder-subr spec))
(defun elmo-archive-max-of-folder (spec)
(let ((dir (elmo-archive-get-archive-directory folder))
(suffix (elmo-archive-get-suffix type))
filename dbdir)
+ (unless suffix
+ (error "Unknown archiver type: %s" type))
(if elmo-archive-treat-file
(if (string-match (concat (regexp-quote suffix) "$") folder)
(expand-file-name
t)
(defun elmo-archive-create-folder (spec)
- (let* ((dir (directory-file-name ;; remove tail slash.
+ (let* ((dir (directory-file-name ; remove tail slash.
(elmo-archive-get-archive-directory (nth 1 spec))))
(type (nth 2 spec))
(arc (elmo-archive-get-archive-name (nth 1 spec) type)))
(error "Create folder failed; File \"%s\" exists" dir))
((file-directory-p dir)
(if (file-exists-p arc)
- t ; return value
+ t ; return value
(elmo-archive-create-file arc type spec)))
(t
(elmo-make-directory dir)
(defun elmo-archive-delete-folder (spec)
(let* ((arc (elmo-archive-get-archive-name (nth 1 spec) (nth 2 spec))))
(if (not (file-exists-p arc))
- (error "no such file: %s" arc)
+ (error "No such file: %s" arc)
(delete-file arc)
t)))
(nth 1 new-spec) (nth 2 new-spec))))
(unless (and (eq (nth 2 old-spec) (nth 2 new-spec))
(equal (nth 3 old-spec) (nth 3 new-spec)))
- (error "not same archive type and prefix"))
+ (error "Not same archive type and prefix"))
(if (not (file-exists-p old-arc))
- (error "no such file: %s" old-arc)
+ (error "No such file: %s" old-arc)
(if (file-exists-p new-arc)
- (error "already exists: %s" new-arc)
+ (error "Already exists: %s" new-arc)
(rename-file old-arc new-arc)
t))))
;;; Article file related functions
;;; read(extract) / append(move) / delete(delete) / query(list)
-(defun elmo-archive-read-msg (spec number outbuf)
+(defun elmo-archive-read-msg (spec number outbuf &optional msgdb unread)
(save-excursion
(let* ((type (nth 2 spec))
(arc (elmo-archive-get-archive-name (nth 1 spec) type spec))
(elmo-archive-call-method method args t))
(elmo-delete-cr-get-content-type))))))
-(defun elmo-archive-append-msg (spec string &optional msg no-see) ;;; verrrrrry slow!!
+;; verrrrrry slow!!
+(defun elmo-archive-append-msg (spec string &optional msg no-see)
(let* ((type (nth 2 spec))
(prefix (nth 3 spec))
(arc (elmo-archive-get-archive-name (nth 1 spec) type))
nil))
(kill-buffer tmp-buffer)))))
-;;; (localdir, maildir, localnews, archive) -> archive
+;; (localdir, maildir, localnews, archive) -> archive
(defun elmo-archive-copy-msgs (dst-spec msgs src-spec
&optional loc-alist same-number)
(let* ((dst-type (nth 2 dst-spec))
(defsubst elmo-archive-article-exists-p (arc msg type)
(if (not elmo-archive-check-existance-strict)
- t ; nop
- (save-excursion ;; added 980915
+ t ; nop
+ (save-excursion ; added 980915
(let* ((method (elmo-archive-get-method type 'ls))
(args (list arc msg))
(buf (get-buffer-create " *ELMO ARCHIVE query*"))
(narrow-to-region (point-min) header-end)
(elmo-msgdb-create-overview-from-buffer number)))
-(defsubst elmo-archive-msgdb-create-entity (method archive number type &optional prefix) ;; verrrry slow!!
+;; verrrry slow!!
+(defsubst elmo-archive-msgdb-create-entity (method archive number type &optional prefix)
(let* ((msg (elmo-concat-path prefix (int-to-string number)))
(arg-list (list archive msg)))
(when (elmo-archive-article-exists-p archive msg type)
percent))
(setq numlist (cdr numlist)))
(kill-buffer tmp-buf)
- (message "Creating msgdb...done.")
+ (message "Creating msgdb...done")
(list overview number-alist mark-alist)) ))
;;; info-zip agent
(setq overview (append overview (nth 0 result)))
(setq number-alist (append number-alist (nth 1 result)))
(setq mark-alist (append mark-alist (nth 2 result))))
-; ((looking-at delim2) ;; UNIX MAIL
-; (setq result (elmo-archive-parse-unixmail msgs))
-; (setq overview (append overview (nth 0 result)))
-; (setq number-alist (append number-alist (nth 1 result)))
-; (setq mark-alist (append mark-alist (nth 2 result))))
+;;; ((looking-at delim2) ;; UNIX MAIL
+;;; (setq result (elmo-archive-parse-unixmail msgs))
+;;; (setq overview (append overview (nth 0 result)))
+;;; (setq number-alist (append number-alist (nth 1 result)))
+;;; (setq mark-alist (append mark-alist (nth 2 result))))
(t ;; unknown format
- (error "unknown format!")))
+ (error "Unknown format!")))
(when (> num elmo-display-progress-threshold)
(setq i (+ n i))
(setq percent (/ (* i 100) num))
(setq sp (1+ (point)))
(setq ep (prog2 (re-search-forward delim)
(1+ (- (point) (length delim)))))
- (if (>= sp ep) ; no article!
- () ; nop
+ (if (>= sp ep) ; no article!
+ () ; nop
(save-excursion
(narrow-to-region sp ep)
(setq entity (elmo-archive-msgdb-create-entity-subr number))