(if (and (find-file-name-handler dir 'copy-file) ; ange-ftp, efs
spec)
(progn
- (setq filename (expand-file-name
+ (setq filename (expand-file-name
(concat elmo-archive-basename suffix)
(setq dbdir (elmo-msgdb-expand-path nil spec))))
(if (file-directory-p dbdir)
(arc (elmo-archive-get-archive-name (nth 1 spec) type spec))
(prefix (nth 3 spec))
(method (elmo-archive-get-method type 'cat))
- (args (list arc (elmo-concat-path
+ (args (list arc (elmo-concat-path
prefix (int-to-string number)))))
(set-buffer outbuf)
(erase-buffer)
(setq tmp-dir (substring src-dir 0 (match-beginning 0)))
(setq p-method (elmo-archive-get-method dst-type 'cp-pipe)
n-method (elmo-archive-get-method dst-type 'cp))
- (setq tmp-msgs (mapcar '(lambda (x)
+ (setq tmp-msgs (mapcar '(lambda (x)
(elmo-concat-path prefix (int-to-string x)))
msgs))
(setq do-link nil))
(if (and elmo-archive-use-izip-agent
(elmo-archive-get-method (nth 2 spec) 'cat-headers))
(elmo-archive-msgdb-create-as-numlist-subr2
- spec numlist new-mark already-mark seen-mark important-mark
+ spec numlist new-mark already-mark seen-mark important-mark
seen-list)
(elmo-archive-msgdb-create-as-numlist-subr1
spec numlist new-mark already-mark seen-mark important-mark
(defun elmo-archive-msgdb-create-as-numlist-subr1 (spec numlist new-mark
already-mark seen-mark
- important-mark
+ important-mark
seen-list)
(let* ((type (nth 2 spec))
(file (elmo-archive-get-archive-name (nth 1 spec) type spec))
seen-mark
new-mark))))
(setq mark-alist
- (elmo-msgdb-mark-append
+ (elmo-msgdb-mark-append
mark-alist
(elmo-msgdb-overview-entity-get-number entity)
gmark))))
(list overview number-alist mark-alist)) )
(defun elmo-archive-parse-mmdf (msgs new-mark
- already-mark
- seen-mark
+ already-mark
+ seen-mark
seen-list)
(let ((delim elmo-mmdf-delimiter)
number sp ep rest entity overview number-alist mark-alist ret-val
(car entity)))
(setq message-id (car entity))
(setq seen (member message-id seen-list))
- (if (setq gmark
+ (if (setq gmark
(or (elmo-msgdb-global-mark-get message-id)
(if (elmo-cache-exists-p message-id) ; XXX
(if seen
seen-mark
new-mark))))
(setq mark-alist
- (elmo-msgdb-mark-append
+ (elmo-msgdb-mark-append
mark-alist
(elmo-msgdb-overview-entity-get-number entity)
gmark)))
(elmo-concat-path prefix (int-to-string number))
tmp-dir)))
-(defalias 'elmo-archive-sync-number-alist
+(defalias 'elmo-archive-sync-number-alist
'elmo-generic-sync-number-alist)
-(defalias 'elmo-archive-list-folder-unread
+(defalias 'elmo-archive-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-archive-list-folder-important
'elmo-generic-list-folder-important)
(unless (string-match elmo-cache-dirname path)
(error "%s is not cache file!" path))
(let (message-id)
- (if (or (elmo-msgdb-global-mark-get
+ (if (or (elmo-msgdb-global-mark-get
(setq message-id
(elmo-cache-to-msgid (file-name-nondirectory path))))
(member message-id locked))
nil ;; Don't delete caches with mark (or locked message).
- (if (and path
+ (if (and path
(file-directory-p path))
(progn
(mapcar 'delete-file (directory-files path t "^[^\\.]"))
(if msgid
(let ((path1 (elmo-cache-get-path msgid))
path2)
- (if (and path1
+ (if (and path1
(file-exists-p path1))
(if (and folder
(file-directory-p path1))
- (when (file-exists-p (setq path2
+ (when (file-exists-p (setq path2
(expand-file-name
- (format "%s@%s"
+ (format "%s@%s"
number
(elmo-safe-filename
folder))
(defun elmo-read-float-value-from-minibuffer (prompt &optional initial)
(let ((str (read-from-minibuffer prompt initial)))
- (cond
+ (cond
((string-match "[0-9]*\\.[0-9]+" str)
(string-to-number str))
((string-match "[0-9]+" str)
(t (error "%s is not number" str)))))
(defun elmo-cache-expire-by-size (&optional kbytes)
- "Expire cache file by size.
+ "Expire cache file by size.
If KBYTES is kilo bytes (This value must be float)."
(interactive)
(let ((size (or kbytes
(message "Checking disk usage...done.")
(let ((cfl (elmo-cache-get-sorted-cache-file-list))
(deleted 0)
- oldest
+ oldest
cur-size cur-file)
(while (and (<= size total)
(setq oldest (elmo-cache-get-oldest-cache-file-entity cfl)))
(setq cur-file (expand-file-name (car (cdr oldest)) (car oldest)))
(if (file-directory-p cur-file)
(setq cur-size (elmo-disk-usage cur-file))
- (setq cur-size
+ (setq cur-size
(/ (float (nth 7 (file-attributes cur-file)))
Kbytes)))
(when (elmo-cache-force-delete cur-file locked)
(message "%d cache(s) are expired." count))
(setq deleted (+ deleted cur-size))
(setq total (- total cur-size)))
- (message "%d cache(s) are expired from disk (%d Kbytes/%d Kbytes)."
+ (message "%d cache(s) are expired from disk (%d Kbytes/%d Kbytes)."
count deleted beginning))))
(defun elmo-cache-make-file-entity (filename path)
flist firsts oldest-entity wonlist)
(while cfl
(setq flist (cdr (car cfl)))
- (setq firsts (append firsts (list
- (cons (car (car cfl))
+ (setq firsts (append firsts (list
+ (cons (car (car cfl))
(car flist)))))
(setq cfl (cdr cfl)))
; (prin1 firsts)
oldest-entity))
(defun elmo-cache-get-sorted-cache-file-list ()
- (let ((dirs (directory-files
- (expand-file-name elmo-cache-dirname elmo-msgdb-dir)
+ (let ((dirs (directory-files
+ (expand-file-name elmo-cache-dirname elmo-msgdb-dir)
t "^[^\\.]"))
(i 0) num
elist
(setq num (length dirs))
(message "Collecting cache info...")
(while dirs
- (setq elist (mapcar (lambda (x)
+ (setq elist (mapcar (lambda (x)
(elmo-cache-make-file-entity x (car dirs)))
(directory-files (car dirs) nil "^[^\\.]")))
(setq ret-val (append ret-val
(list (cons
(car dirs)
- (sort
+ (sort
elist
(lambda (x y)
(< (cdr x)
(defun elmo-cache-expire-by-age (&optional days)
(let ((age (or (and days (int-to-string days))
(and (interactive-p)
- (read-from-minibuffer
+ (read-from-minibuffer
(format "Enter days (%s): "
elmo-cache-expire-default-age)))
(int-to-string elmo-cache-expire-default-age)))
- (dirs (directory-files
- (expand-file-name elmo-cache-dirname elmo-msgdb-dir)
+ (dirs (directory-files
+ (expand-file-name elmo-cache-dirname elmo-msgdb-dir)
t "^[^\\.]"))
(locked (elmo-dop-lock-list-load))
(count 0)
(setq age elmo-cache-expire-default-age)
(setq age (string-to-int age)))
(setq curtime (current-time))
- (setq curtime (+ (* (nth 0 curtime)
+ (setq curtime (+ (* (nth 0 curtime)
(float 65536)) (nth 1 curtime)))
(while dirs
(let ((files (directory-files (car dirs) t "^[^\\.]"))
(elmo-cache-get-path msgid folder number)
(elmo-cache-get-path msgid)))
dir tmp-buf)
- (when path
+ (when path
(setq dir (directory-file-name (file-name-directory path)))
(if (not (file-exists-p dir))
(elmo-make-directory dir))
(if (and folder
(file-directory-p path))
(if (file-exists-p (setq path (expand-file-name
- (format "%s@%s"
- (or number "")
+ (format "%s@%s"
+ (or number "")
(elmo-safe-filename
folder))
path)))
ret-val
case-fold-search msg
percent i)
- (setq i 0)
+ (setq i 0)
(while nalist
(if (and (setq cache-file (elmo-cache-exists-p (cdr (car nalist))
- folder
+ folder
(car (car nalist))))
(elmo-file-field-condition-match cache-file condition))
(setq ret-val (append ret-val (list (caar nalist)))))
(defun elmo-cache-collect-sub-directories (init dir &optional recursively)
"Collect subdirectories under 'dir'"
- (let ((dirs
+ (let ((dirs
(delete (expand-file-name elmo-cache-dirname
elmo-msgdb-dir)
(directory-files dir t "^[^\\.]")))
(setq ret-val (append init dirs))
(while (and recursively dirs)
(setq ret-val
- (elmo-cache-collect-sub-directories
+ (elmo-cache-collect-sub-directories
ret-val
(car dirs) recursively))
(setq dirs (cdr dirs)))
ret-val))
(defun elmo-msgid-to-cache (msgid)
- (when (and msgid
+ (when (and msgid
(string-match "<\\(.+\\)>$" msgid))
(elmo-replace-msgid-as-filename (elmo-match-string 1 msgid))))
(expand-file-name
(expand-file-name
(if folder
- (format "%s/%s/%s@%s"
+ (format "%s/%s/%s@%s"
(elmo-cache-get-path-subr msgid)
msgid
(or number "")
(elmo-safe-filename folder))
- (format "%s/%s"
+ (format "%s/%s"
(elmo-cache-get-path-subr msgid)
msgid))
(expand-file-name elmo-cache-dirname
(when (file-exists-p file)
;; Read until header separator is found.
(while (and (eq elmo-localdir-header-chop-length
- (nth 1
- (as-binary-input-file
+ (nth 1
+ (as-binary-input-file
(insert-file-contents
file nil beg
(incf beg elmo-localdir-header-chop-length)))))
nil
new-mark)))
(setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
+ (elmo-msgdb-mark-append
+ mark-alist
num
gmark))))
(when (> len elmo-display-progress-threshold)
(let* ((dir (elmo-cache-get-folder-directory spec))
(flist (mapcar 'file-name-nondirectory
(elmo-delete-if 'file-directory-p
- (directory-files
+ (directory-files
dir t "^[^@]+@[^@]+$" t))))
(folder (concat "'cache/" (nth 1 spec)))
- (number-alist (or (elmo-msgdb-number-load
+ (number-alist (or (elmo-msgdb-number-load
(elmo-msgdb-expand-path folder))
(list nil)))
nlist)
(defun elmo-cache-read-msg (spec number outbuf &optional set-mark)
(save-excursion
(let* ((dir (elmo-cache-get-folder-directory spec))
- (file (expand-file-name
+ (file (expand-file-name
(elmo-cache-number-to-filename spec number) dir)))
(set-buffer outbuf)
(erase-buffer)
(i 0) case-fold-search ret-val)
(while msgs
(if (elmo-file-field-condition-match
- (expand-file-name
+ (expand-file-name
(elmo-msgid-to-cache
(cdr (assq (car msgs) number-alist)))
(elmo-cache-get-folder-directory spec))
(elmo-cache-number-to-filename spec number)
(elmo-cache-get-folder-directory spec)))
-(defalias 'elmo-cache-sync-number-alist
+(defalias 'elmo-cache-sync-number-alist
'elmo-generic-sync-number-alist)
-(defalias 'elmo-cache-list-folder-unread
+(defalias 'elmo-cache-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-cache-list-folder-important
'elmo-generic-list-folder-important)
(and msgid db
(progn
(remove-database msgid db)
- (put-database msgid (prin1-to-string
+ (put-database msgid (prin1-to-string
(list folder number)) db)))))
(defun elmo-database-msgid-delete (msgid)
- (remove-database msgid (elmo-database-get
+ (remove-database msgid (elmo-database-get
'elmo-database-msgid
elmo-database-msgid-filename)))
(defun elmo-database-msgid-get (msgid)
- (let ((match (get-database msgid (elmo-database-get
+ (let ((match (get-database msgid (elmo-database-get
'elmo-database-msgid
elmo-database-msgid-filename))))
(and match (read match))))
(aref datevec 0)))
(defun elmo-date-get-datevec (description)
- (cond
+ (cond
((not elmo-date-match)
(error "date match is not available"))
((string-match "^[ \t]*\\([0-9]+\\)?[ \t]*\\([a-zA-Z]+\\)$" description)
- (let ((today
+ (let ((today
(save-match-data
(timezone-fix-time (current-time-string) (current-time-zone)
nil)))
- (number
+ (number
(string-to-int
(if (match-beginning 1)
(elmo-match-string 1 description)
(elmo-date-get-offset-datevec today number)
(error "%s is not supported yet" suffix)))))
((string-match "[0-9]+-[A-Za-z]+-[0-9]+" description)
- (timezone-fix-time
+ (timezone-fix-time
(concat (elmo-replace-in-string description "-" " ") " 0:00")
nil nil))))
(minute (aref datevec 4))
(second (aref datevec 5))
(timezone (aref datevec 6))
- day-number p
+ day-number p
day-of-month)
(setq p 1)
(setq day-number (- (timezone-day-number month day year)
(let ((operation (list (format "%s" folder) function argument)))
(elmo-dop-queue-load)
(unless (member operation elmo-dop-queue) ;; don't append same operation
- (setq elmo-dop-queue
+ (setq elmo-dop-queue
(append elmo-dop-queue
(list operation)))
(elmo-dop-queue-save))))
(setq count (1+ count)))
(setq queue (cdr queue)))
(when (> count 0)
- (if (elmo-y-or-n-p
+ (if (elmo-y-or-n-p
(format "%d pending operation(s) exists. Perform now?" count)
(not elmo-dop-flush-confirm) t)
(progn
))))
(quit (setq failure t))
(error (setq failure err)))
- (if failure
+ (if failure
;; create-folder was failed.
(when (and (string= func "create-folder-maybe")
- (elmo-y-or-n-p
- (format
+ (elmo-y-or-n-p
+ (format
"Create folder %s failed. Abort creating?"
folder)
(not elmo-dop-flush-confirm) t))
(let ((queue elmo-dop-queue)
new-queue match-queue que)
(while (setq que (car queue))
- (if (and
+ (if (and
(member (cadr que) elmo-dop-merge-funcs)
(setq match-queue
(car (delete nil
(mapcar '(lambda (new-queue)
- (if (and
+ (if (and
(string= (car que) (car new-queue))
(string= (cadr que) (cadr new-queue)))
new-queue))
(defun elmo-dop-queue-load ()
(save-excursion
- (setq elmo-dop-queue
+ (setq elmo-dop-queue
(elmo-object-load
(expand-file-name elmo-queue-filename
elmo-msgdb-dir)))))
(defun elmo-dop-lock-message (message-id &optional lock-list)
(let ((locked (or lock-list
- (elmo-object-load
+ (elmo-object-load
(expand-file-name
elmo-msgdb-lock-list-filename
elmo-msgdb-dir)))))
(defun elmo-dop-unlock-message (message-id &optional lock-list)
(let ((locked (or lock-list
- (elmo-object-load
+ (elmo-object-load
(expand-file-name elmo-msgdb-lock-list-filename
elmo-msgdb-dir)))))
(setq locked (delete message-id locked))
locked)))
(defun elmo-dop-lock-list-load ()
- (elmo-object-load
+ (elmo-object-load
(expand-file-name elmo-msgdb-lock-list-filename
elmo-msgdb-dir)))
lock-list))
(defun elmo-dop-append-list-load (folder &optional resume)
- (elmo-object-load
+ (elmo-object-load
(expand-file-name (if resume
elmo-msgdb-resume-list-filename
elmo-msgdb-append-list-filename)
(let ((folder-numbers (elmo-make-folder-numbers-list folder msgs))
appended-deleting)
(while folder-numbers
- (if (eq (elmo-folder-get-type (car (car folder-numbers)))
+ (if (eq (elmo-folder-get-type (car (car folder-numbers)))
'imap4)
(if elmo-enable-disconnected-operation
(progn
msgs ; virtual number
(elmo-dop-append-list-load folder)))
(if (cdr appended-deleting)
- (elmo-dop-queue-append
+ (elmo-dop-queue-append
(car (car folder-numbers)) ; real folder
"delete-msgids" ;; for secure removal.
(cdr appended-deleting)))
(i 0))
(while append-list
(if (rassoc (car append-list) number-alist)
- (setq alreadies (append alreadies
+ (setq alreadies (append alreadies
(list (car append-list)))))
(setq append-list (cdr append-list)))
(setq append-num (- append-num (length alreadies)))
- (setq max-num
- (or (nth (max (- (length number-list) 1) 0)
+ (setq max-num
+ (or (nth (max (- (length number-list) 1) 0)
number-list) 0))
(while (< i append-num)
(setq number-list
(defun elmo-dop-max-of-folder (folder)
(if (eq (elmo-folder-get-type folder) 'imap4)
(if elmo-enable-disconnected-operation
- (let* ((number-alist (elmo-msgdb-number-load
+ (let* ((number-alist (elmo-msgdb-number-load
(elmo-msgdb-expand-path folder)))
(number-list (mapcar 'car number-alist))
(append-list (elmo-dop-append-list-load folder))
max-num)
(while append-list
(if (rassoc (car append-list) number-alist)
- (setq alreadies (append alreadies
+ (setq alreadies (append alreadies
(list (car append-list)))))
(setq append-list (cdr append-list)))
- (setq max-num
+ (setq max-num
(or (nth (max (- (length number-list) 1) 0) number-list)
0))
(cons (- (+ max-num append-num) (length alreadies))
file-string)
(while append-list
(when (setq file-string (elmo-get-file-string ; message string
- (elmo-cache-get-path
+ (elmo-cache-get-path
(car append-list))))
(elmo-append-msg elmo-lost+found-folder file-string)
(elmo-dop-unlock-message (car append-list)))
(setq append-list (cdr append-list))
(elmo-dop-append-list-save folder nil)))
- (message (format "Saving queued message in %s...done."
+ (message (format "Saving queued message in %s...done."
elmo-lost+found-folder)))
(defun elmo-dop-flush-pending-append-operations (folder &optional appends resume)
(message "Appending queued messages...")
- (let* ((append-list (or appends
+ (let* ((append-list (or appends
(elmo-dop-append-list-load folder)))
(appendings append-list)
(i 0)
(when resume
;; Resume msgdb changed by elmo-dop-msgdb-create.
(let* ((resumed-list (elmo-dop-append-list-load folder t))
- (number-alist (elmo-msgdb-number-load
+ (number-alist (elmo-msgdb-number-load
(elmo-msgdb-expand-path folder)))
(appendings append-list)
pair dels)
(while appendings
(setq failure nil)
(setq file-string (elmo-get-file-string ; message string
- (elmo-cache-get-path
+ (elmo-cache-get-path
(car appendings))))
(when file-string
(condition-case ()
(insert string)
(elmo-cache-save message-id nil folder msg (current-buffer))))
(let ((append-list (elmo-dop-append-list-load folder))
- (number-alist (elmo-msgdb-number-load
+ (number-alist (elmo-msgdb-number-load
(elmo-msgdb-expand-path folder))))
(when (and ; not in current folder.
(not (rassoc message-id number-alist))
(if (or (eq (elmo-folder-get-type folder) 'imap4)
(eq (elmo-folder-get-type folder) 'nntp))
(if elmo-enable-disconnected-operation
- (let* ((num-alist (elmo-msgdb-number-load
+ (let* ((num-alist (elmo-msgdb-number-load
(elmo-msgdb-expand-path folder)))
(number-list (mapcar 'car num-alist))
(ov (elmo-msgdb-overview-load
0))
(while numlist
(if (setq msgid
- (nth (+ (length append-list)
+ (nth (+ (length append-list)
(- (car numlist) max-num 1 num))
append-list))
(progn
(setq seen (member msgid seen-list))
(if (setq gmark
(or (elmo-msgdb-global-mark-get msgid)
- (if (elmo-cache-exists-p
+ (if (elmo-cache-exists-p
msgid
folder
(car number-alist))
(elmo-msgdb-mark-append
mark-alist (car numlist) gmark))))
- (when (setq ov-entity (assoc
+ (when (setq ov-entity (assoc
(cdr (assq (car numlist) num-alist))
ov))
(setq overview
;;
(require 'elmo-msgdb)
-(defun elmo-filter-msgdb-create (spec numlist new-mark already-mark
+(defun elmo-filter-msgdb-create (spec numlist new-mark already-mark
seen-mark important-mark seen-list)
(if (eq (nth 2 spec) 'partial)
(elmo-msgdb-create (nth 2 spec)
- numlist
+ numlist
new-mark
already-mark
seen-mark important-mark seen-list)
seen-mark important-mark seen-list)))
(defun elmo-filter-msgdb-create-as-numlist (spec numlist new-mark already-mark
- seen-mark important-mark
+ seen-mark important-mark
seen-list)
(elmo-msgdb-create-as-numlist (nth 2 spec)
numlist
(let ((filter (nth 1 spec))
(folder (nth 2 spec))
numbers)
- (cond
+ (cond
((vectorp filter)
(cond ((string= (elmo-filter-key filter)
"last")
(setq numbers (elmo-list-folder folder))
- (nthcdr (max (- (length numbers)
+ (nthcdr (max (- (length numbers)
(string-to-int (elmo-filter-value filter)))
0)
numbers))
(setq numbers (elmo-list-folder folder))
(let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
numbers)))
- (mapcar '(lambda (x)
+ (mapcar '(lambda (x)
(delete x numbers)) rest))
numbers)))
((listp filter)
(let ((filter (nth 1 spec))
(folder (nth 2 spec))
msgs pair)
- (cond
+ (cond
((vectorp filter)
(cond ((string= (elmo-filter-key filter)
"last")
- (setq msgs (elmo-list-folder-unread folder mark-alist
+ (setq msgs (elmo-list-folder-unread folder mark-alist
unread-marks))
- (nthcdr (max (- (length msgs)
+ (nthcdr (max (- (length msgs)
(string-to-int (elmo-filter-value filter)))
0)
msgs))
unread-marks))
(let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
msgs)))
- (mapcar '(lambda (x)
+ (mapcar '(lambda (x)
(delete x msgs)) rest))
msgs)))
((listp filter)
- (elmo-list-filter
+ (elmo-list-filter
(elmo-search folder filter)
(elmo-list-folder-unread folder mark-alist unread-marks))))))
(let ((filter (nth 1 spec))
(folder (nth 2 spec))
msgs pair)
- (cond
+ (cond
((vectorp filter)
(cond ((string= (elmo-filter-key filter)
"last")
(setq msgs (elmo-list-folder-important folder overview))
- (nthcdr (max (- (length msgs)
+ (nthcdr (max (- (length msgs)
(string-to-int (elmo-filter-value filter)))
0)
msgs))
(setq msgs (elmo-list-folder-important folder overview))
(let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
msgs)))
- (mapcar '(lambda (x)
+ (mapcar '(lambda (x)
(delete x msgs)) rest))
msgs)))
((listp filter)
- (elmo-list-filter
+ (elmo-list-filter
(mapcar
'(lambda (x) (elmo-msgdb-overview-entity-get-number x))
overview)
(defun elmo-filter-search (spec condition &optional numlist)
;; search from messages in this folder
- (elmo-list-filter
- numlist
- (elmo-call-func (nth 2 spec) "search" condition
+ (elmo-list-filter
+ numlist
+ (elmo-call-func (nth 2 spec) "search" condition
(elmo-filter-list-folder spec))))
(defun elmo-filter-use-cache-p (spec number)
(require 'sasl))
(error))
(defun-maybe sasl-cram-md5 (username passphrase challenge))
- (defun-maybe sasl-digest-md5-digest-response
+ (defun-maybe sasl-digest-md5-digest-response
(digest-challenge username passwd serv-type host &optional realm))
- (defun-maybe starttls-negotiate (a))
+ (defun-maybe starttls-negotiate (a))
(defun-maybe elmo-generic-list-folder-unread (spec mark-alist unread-marks))
(defsubst-maybe utf7-decode-string (string &optional imap) string))
(defconst elmo-imap4-literal-threshold 1024
"Limitation of characters that can be used in a quoted string.")
-;; For debugging.
+;; For debugging.
(defvar elmo-imap4-debug nil
- "Non-nil forces IMAP4 folder as debug mode.
+ "Non-nil forces IMAP4 folder as debug mode.
Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"")
(defvar elmo-imap4-debug-inhibit-logging nil)
; command)))
(defun elmo-imap4-send-command-wait (session command)
- "Send COMMAND to the SESSION.
+ "Send COMMAND to the SESSION.
Returns RESPONSE (parsed lisp object) of IMAP session.
If response is not `OK', causes error with IMAP response text."
(elmo-imap4-accept-ok session
command)))
(defun elmo-imap4-send-command (session command)
- "Send COMMAND to the SESSION.
+ "Send COMMAND to the SESSION.
Returns a TAG string which is assigned to the COMAND."
(let* ((command-args (if (listp command)
command
;; Append delimiter
(if (and root
(not (string= root ""))
- (not (string-match (concat "\\(.*\\)"
+ (not (string-match (concat "\\(.*\\)"
(regexp-quote delim)
"\\'")
root)))
(unless (string= (elmo-imap4-spec-username spec)
elmo-default-imap4-user)
(setq append-serv (concat ":" (elmo-imap4-spec-username spec))))
- (unless (string= (elmo-imap4-spec-hostname spec)
+ (unless (string= (elmo-imap4-spec-hostname spec)
elmo-default-imap4-server)
(setq append-serv (concat append-serv "@" (elmo-imap4-spec-hostname
spec))))
(unless (eq (elmo-imap4-spec-port spec)
elmo-default-imap4-port)
- (setq append-serv (concat append-serv ":"
- (int-to-string
+ (setq append-serv (concat append-serv ":"
+ (int-to-string
(elmo-imap4-spec-port spec)))))
(setq type (elmo-imap4-spec-stream-type spec))
(unless (eq (elmo-network-stream-type-symbol type)
type)))))
(mapcar (lambda (fld)
(concat "%" (elmo-imap4-decode-folder-string fld)
- (and append-serv
+ (and append-serv
(eval append-serv))))
result)))
(- (elmo-imap4-response-value status 'uidnext) 1)
(elmo-imap4-response-value status 'messages))))
-; (when (and response (string-match
+; (when (and response (string-match
; "\\* STATUS [^(]* \\(([^)]*)\\)" response))
; (setq response (read (downcase (elmo-match-string 1 response))))
; (cons (- (cadr (memq 'uidnext response)) 1)
session
(nth 1 (assq 'read-only (assq 'ok response)))))
(elmo-imap4-session-set-current-mailbox-internal session nil)
- (error (or
+ (error (or
(elmo-imap4-response-error-text response)
(format "Select %s failed" mailbox))))))))
(setq search-key (concat "sent" search-key))
(elmo-imap4-response-value
(elmo-imap4-send-command-wait session
- (format
+ (format
(if elmo-imap4-use-uid
- "uid search %s %s"
+ "uid search %s %s"
" search %s %s")
search-key
(elmo-date-get-description
- (elmo-date-get-datevec
+ (elmo-date-get-datevec
(elmo-filter-value filter)))))
'search))
(t
(if elmo-imap4-use-uid
"uid search CHARSET "
"search CHARSET ")
- (elmo-imap4-astring
+ (elmo-imap4-astring
(symbol-name charset))
(if (eq (elmo-filter-type filter)
'unmatch)
(let* ((session (elmo-imap4-get-session spec))
response matched)
(elmo-imap4-session-select-mailbox
- session
+ session
(elmo-imap4-spec-mailbox spec))
(while condition
(setq response (elmo-imap4-search-internal session
(setq matched (nconc matched response))
(setq condition (cdr condition)))
(if from-msgs
- (elmo-list-filter
+ (elmo-list-filter
from-msgs
(elmo-uniq-list (sort matched '<)))
(elmo-uniq-list (sort matched '<))))))
(not (string-match elmo-imap4-disuse-server-flag-mailbox-regexp
(elmo-imap4-spec-mailbox spec))))
-(static-cond
+(static-cond
((fboundp 'float)
;; Emacs can parse dot symbol.
(defvar elmo-imap4-rfc822-size "RFC822\.SIZE")
(defalias 'elmo-imap4-fetch-read 'read)
(defalias 'elmo-imap4-read 'read)
)
- (t
+ (t
;;; For Nemacs.
;; Cannot parse dot symbol.
(defvar elmo-imap4-rfc822-size "RFC822_SIZE")
(defvar elmo-imap4-header-fields "HEADER_FIELDS")
(defvar elmo-imap4-rfc822-size "RFC822_SIZE")
(defvar elmo-imap4-rfc822-text "RFC822_TEXT")
- (defvar elmo-imap4-rfc822-header "RFC822_HEADER")
+ (defvar elmo-imap4-rfc822-header "RFC822_HEADER")
(defvar elmo-imap4-header-fields "HEADER_FIELDS")
(defun elmo-imap4-fetch-read (buffer)
(with-current-buffer buffer
entity found)
(while (and elist (not found))
(setq entity (car elist))
- (cond
+ (cond
((and (consp entity)
(eq (+ 1 (cdr entity)) msg))
(setcdr entity msg)
(setcar elist (cons entity msg))
(setq found t))
((or (and (integerp entity) (eq entity msg))
- (and (consp entity)
+ (and (consp entity)
(<= (car entity) msg)
(<= msg (cdr entity)))) ; included
(setq found t))); noop
(setq chop-length (length msg-list)))
(while (and (not (null msg-list))
(< count chop-length))
- (setq cont-list
- (elmo-imap4-add-to-cont-list
+ (setq cont-list
+ (elmo-imap4-add-to-cont-list
cont-list (car msg-list)))
(incf count)
(setq msg-list (cdr msg-list)))
- (setq set-list
+ (setq set-list
(cons
(cons
count
If optional argument UNMARK is non-nil, unmark."
(let ((session (elmo-imap4-get-session spec))
set-list)
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
(setq set-list (elmo-imap4-make-number-set-list msgs))
(when set-list
(elmo-imap4-send-command-wait
session
- (format
- (if elmo-imap4-use-uid
+ (format
+ (if elmo-imap4-use-uid
"uid store %s %sflags.silent (%s)"
"store %s %sflags.silent (%s)")
(cdr (car set-list))
(defun elmo-imap4-unmark-important (spec msgs)
(and (elmo-imap4-use-flag-p spec)
- (elmo-imap4-mark-set-on-msgs spec msgs "\\Flagged" 'unmark
+ (elmo-imap4-mark-set-on-msgs spec msgs "\\Flagged" 'unmark
'no-expunge)))
(defun elmo-imap4-mark-as-unread (spec msgs)
(defun elmo-imap4-delete-msgs-no-expunge (spec msgs)
(elmo-imap4-mark-set-on-msgs spec msgs "\\Deleted" nil 'no-expunge))
-(defun elmo-imap4-msgdb-create-as-numlist (spec numlist new-mark already-mark
- seen-mark important-mark
+(defun elmo-imap4-msgdb-create-as-numlist (spec numlist new-mark already-mark
+ seen-mark important-mark
seen-list)
"Create msgdb for SPEC for NUMLIST."
(elmo-imap4-msgdb-create spec numlist new-mark already-mark
'("Subject" "From" "To" "Cc" "Date"
"Message-Id" "References" "In-Reply-To")
elmo-msgdb-extra-fields))
- (total 0)
+ (total 0)
(length (length numlist))
rfc2060 set-list)
(setq rfc2060 (memq 'imap4rev1
(elmo-imap4-session-capability-internal
session)))
(message "Getting overview...")
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
(setq set-list (elmo-imap4-make-number-set-list
numlist
(when (> length elmo-display-progress-threshold)
(setq total (+ total (car (car set-list))))
(elmo-display-progress
- 'elmo-imap4-msgdb-create "Getting overview..."
+ 'elmo-imap4-msgdb-create "Getting overview..."
(/ (* total 100) length)))
(setq set-list (cdr set-list)))
(message "Getting overview...done.")
(signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
(elmo-imap4-send-string session
(elmo-base64-encode-string
- (elmo-get-passwd
+ (elmo-get-passwd
(elmo-network-session-password-key session))))
(or (elmo-imap4-read-ok session tag)
(signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
(defun elmo-imap4-login (session)
(let ((elmo-imap4-debug-inhibit-logging t))
- (or
+ (or
(elmo-imap4-read-ok
session
(elmo-imap4-send-command
(setq elmo-imap4-seqno 0)
(setq elmo-imap4-status 'initial)))
-(luna-define-method elmo-network-initialize-session ((session
+(luna-define-method elmo-network-initialize-session ((session
elmo-imap4-session))
(let ((process (elmo-network-session-process-internal session))
response capability mechanism)
(elmo-imap4-send-command-wait session "starttls")
(starttls-negotiate process)))))
-(luna-define-method elmo-network-authenticate-session ((session
+(luna-define-method elmo-network-authenticate-session ((session
elmo-imap4-session))
(with-current-buffer (process-buffer
(elmo-network-session-process-internal session))
'elmo-imap4-login)))
(funcall authenticator session)))))
-(luna-define-method elmo-network-setup-session ((session
+(luna-define-method elmo-network-setup-session ((session
elmo-imap4-session))
(with-current-buffer (elmo-network-session-buffer session)
(when (memq 'namespace (elmo-imap4-session-capability-internal session))
(elmo-set-buffer-multibyte nil)
(insert string)
(goto-char (point-min))
- (if (eq (re-search-forward "^$" nil t)
+ (if (eq (re-search-forward "^$" nil t)
(point-max))
(insert "\n"))
(goto-char (point-min))
(defun elmo-imap4-read-part (folder msg part)
(let* ((spec (elmo-folder-get-spec folder))
(session (elmo-imap4-get-session spec)))
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
(elmo-delete-cr
(elmo-imap4-response-bodydetail-text
(elmo-imap4-response-value
(elmo-imap4-send-command-wait session
- (format
- (if elmo-imap4-use-uid
+ (format
+ (if elmo-imap4-use-uid
"uid fetch %s body[%s]"
"fetch %s body[%s]")
msg part))
(defun elmo-imap4-prefetch-msg (spec msg outbuf)
(elmo-imap4-read-msg spec msg outbuf 'unseen))
-(defun elmo-imap4-read-msg (spec msg outbuf
+(defun elmo-imap4-read-msg (spec msg outbuf
&optional leave-seen-flag-untouched)
(let ((session (elmo-imap4-get-session spec))
response)
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
(with-current-buffer (elmo-network-session-buffer session)
(setq elmo-imap4-fetch-callback nil)
(setq elmo-imap4-fetch-callback-data nil))
(setq response
(elmo-imap4-send-command-wait session
- (format
- (if elmo-imap4-use-uid
- "uid fetch %s rfc822%s"
+ (format
+ (if elmo-imap4-use-uid
+ "uid fetch %s rfc822%s"
"fetch %s rfc822%s")
msg
(if leave-seen-flag-untouched
(elmo-imap4-response-value-all
response 'fetch )
'rfc822))
- (with-current-buffer outbuf
+ (with-current-buffer outbuf
(erase-buffer)
(insert response)
(elmo-delete-cr-get-content-type)))))
(defun elmo-imap4-setup-send-buffer-from-file (file)
- (let ((tmp-buf (get-buffer-create
+ (let ((tmp-buf (get-buffer-create
" *elmo-imap4-setup-send-buffer-from-file*")))
(save-excursion
(save-match-data
(as-binary-input-file
(insert-file-contents file))
(goto-char (point-min))
- (if (eq (re-search-forward "^$" nil t)
+ (if (eq (re-search-forward "^$" nil t)
(point-max))
- (insert "\n"))
+ (insert "\n"))
(goto-char (point-min))
(while (search-forward "\n" nil t)
(replace-match "\r\n"))))
(defun elmo-imap4-delete-msg-by-id (spec msgid)
(let* ((session (elmo-imap4-get-session spec))
response msgs)
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
(elmo-imap4-delete-msgs-no-expunge
spec
(elmo-imap4-response-value
(elmo-imap4-send-command-wait session
(list
- (if elmo-imap4-use-uid
+ (if elmo-imap4-use-uid
"uid search header message-id "
"search header message-id ")
(elmo-imap4-field-body msgid)))
(defun elmo-imap4-append-msg-by-id (spec msgid)
(let ((session (elmo-imap4-get-session spec))
send-buf)
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
- (setq send-buf (elmo-imap4-setup-send-buffer-from-file
+ (setq send-buf (elmo-imap4-setup-send-buffer-from-file
(elmo-cache-get-path msgid)))
(unwind-protect
(elmo-imap4-send-command-wait
(defun elmo-imap4-append-msg (spec string &optional msg no-see)
(let ((session (elmo-imap4-get-session spec))
send-buf)
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox spec))
(setq send-buf (elmo-imap4-setup-send-buffer string))
(unwind-protect
(let ((src-folder (elmo-imap4-spec-mailbox src-spec))
(dst-folder (elmo-imap4-spec-mailbox dst-spec))
(session (elmo-imap4-get-session src-spec)))
- (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-session-select-mailbox session
(elmo-imap4-spec-mailbox src-spec))
(while msgs
(elmo-imap4-send-command-wait session
(list
(format
- (if elmo-imap4-use-uid
- "uid copy %s "
+ (if elmo-imap4-use-uid
+ "uid copy %s "
"copy %s ")
(car msgs))
(elmo-imap4-mailbox dst-folder)))
(elmo-imap4-commit spec)
(setq response
(elmo-imap4-send-command-wait (elmo-imap4-get-session spec)
- (list
+ (list
"status "
(elmo-imap4-mailbox
(elmo-imap4-spec-mailbox spec))
(goto-char (point-min))
(unwind-protect
(cond ((eq elmo-imap4-status 'initial)
- (setq elmo-imap4-current-response
+ (setq elmo-imap4-current-response
(elmo-imap4-parse-greeting)))
((or (eq elmo-imap4-status 'auth)
(eq elmo-imap4-status 'nonauth)
(eq elmo-imap4-status 'selected)
(eq elmo-imap4-status 'examine))
(setq elmo-imap4-current-response
- (cons
+ (cons
(elmo-imap4-parse-response)
elmo-imap4-current-response)))
(t
- (message "Unknown state %s in arrival filter"
+ (message "Unknown state %s in arrival filter"
elmo-imap4-status))))
(delete-region (point-min) (point-max)))))))
(defsubst elmo-imap4-parse-astring ()
(or (elmo-imap4-parse-string)
- (buffer-substring (point)
+ (buffer-substring (point)
(if (re-search-forward "[(){ \r\n%*\"\\]" nil t)
(goto-char (1- (match-end 0)))
(end-of-line)
(LIST (list 'list (elmo-imap4-parse-data-list)))
(LSUB (list 'lsub (elmo-imap4-parse-data-list)))
(SEARCH (list
- 'search
+ 'search
(elmo-imap4-read (concat "("
(buffer-substring (point) (point-max))
")"))))
(nreverse strlist))))
(defsubst elmo-imap4-parse-fetch-body-section ()
- (let ((section
+ (let ((section
(buffer-substring (point)
(1-
(progn (re-search-forward "[] ]" nil t)
(point))))))
(if (eq (char-before) ? )
(prog1
- (mapconcat 'identity
+ (mapconcat 'identity
(cons section (elmo-imap4-parse-header-list)) " ")
(search-forward "]" nil t))
section)))
(list
'bodydetail
(upcase (elmo-imap4-parse-fetch-body-section))
- (and
+ (and
(eq (char-after) ?<)
(buffer-substring (1+ (point))
(progn
(list 'unseen (elmo-imap4-read (current-buffer))))
(t
(message
- "Unknown status data %s in mailbox %s ignored"
+ "Unknown status data %s in mailbox %s ignored"
token mailbox))))
status))))
(list 'status status)))
(list 'namespace
(nconc
(copy-sequence elmo-imap4-extra-namespace-alist)
- (elmo-imap4-parse-namespace-subr
+ (elmo-imap4-parse-namespace-subr
(elmo-imap4-read (concat "(" (buffer-substring
(point) (point-max))
")"))))))
(when (eq (char-after) ?\ );; body-ext-1part:
(elmo-imap4-forward)
(push (elmo-imap4-parse-nstring) body);; body-fld-md5
- (setq body
+ (setq body
(append (elmo-imap4-parse-body-ext) body)));; body-ext-1part..
(assert (eq (char-after) ?\)))
(defun elmo-internal-list-folder-by-location (spec location &optional msgdb)
(let* ((path (elmo-msgdb-expand-path nil spec))
- (location-alist
+ (location-alist
(if msgdb
(elmo-msgdb-get-location msgdb)
(elmo-msgdb-location-load path)))
(list (cons (car pair) (car location)))))
(setq i (1+ i))
(setq result (append result
- (list
+ (list
(cons (+ location-max i) (car location))))))
(setq location (cdr location))))
(setq result (sort result '(lambda (x y)
(mapcar 'car result)))
(defun elmo-internal-list-location (directive arg)
- (let ((mark-alist
+ (let ((mark-alist
(or elmo-msgdb-global-mark-alist
(setq elmo-msgdb-global-mark-alist
- (elmo-object-load (expand-file-name
+ (elmo-object-load (expand-file-name
elmo-msgdb-global-mark-filename
elmo-msgdb-dir)))))
result)
number
(elmo-cache-get-path (cdr (assq number loc-alist)))))
-(defun elmo-internal-msgdb-create (spec numlist new-mark
- already-mark seen-mark
- important-mark
+(defun elmo-internal-msgdb-create (spec numlist new-mark
+ already-mark seen-mark
+ important-mark
seen-list
&optional msgdb)
(when numlist
(let* ((directive (nth 1 spec))
(arg (nth 2 spec))
(loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec))))
(loc-list (elmo-internal-list-location directive arg))
overview number-alist mark-alist entity
(car numlist) loc-alist))
(if (null entity)
()
- (setq overview
+ (setq overview
(elmo-msgdb-append-element
overview entity))
(setq number-alist
(unless (memq location seen-list)
(setq mark-alist
(elmo-msgdb-mark-append
- mark-alist
+ mark-alist
(elmo-msgdb-overview-entity-get-number
entity)
;(nth 0 entity)
- (or (elmo-msgdb-global-mark-get
+ (or (elmo-msgdb-global-mark-get
(elmo-msgdb-overview-entity-get-id
entity))
- (if (elmo-cache-exists-p
+ (if (elmo-cache-exists-p
(elmo-msgdb-overview-entity-get-id
entity))
already-mark
(let* ((msgid (elmo-field-body "message-id"))
(path (elmo-cache-get-path msgid))
dir)
- (when path
+ (when path
(setq dir (directory-file-name (file-name-directory path)))
(if (not (file-exists-p dir))
(elmo-make-directory dir))
(defun elmo-internal-delete-msgs (spec msgs &optional msgdb)
(let ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec)))))
(mapcar '(lambda (msg) (elmo-internal-delete-msg spec msg
loc-alist))
(defun elmo-internal-read-msg (spec number outbuf &optional msgdb)
(save-excursion
(let* ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec))))
(file (elmo-cache-get-path (cdr (assq number loc-alist)))))
(set-buffer outbuf)
nil)
(defun elmo-internal-search (spec condition &optional from-msgs msgdb)
- (let* ((mark-alist
+ (let* ((mark-alist
(or elmo-msgdb-global-mark-alist
(setq elmo-msgdb-global-mark-alist
- (elmo-object-load (expand-file-name
+ (elmo-object-load (expand-file-name
elmo-msgdb-global-mark-filename
elmo-msgdb-dir)))))
(loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
- nil spec))))
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ nil spec))))
cache-file
ret-val
case-fold-search msg
)
(defalias 'elmo-internal-sync-number-alist 'elmo-generic-sync-number-alist)
-(defalias 'elmo-internal-list-folder-unread
+(defalias 'elmo-internal-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-internal-list-folder-important
'elmo-generic-list-folder-important)
(when (file-exists-p file)
;; Read until header separator is found.
(while (and (eq elmo-localdir-header-chop-length
- (nth 1
- (as-binary-input-file
+ (nth 1
+ (as-binary-input-file
(insert-file-contents
file nil beg
(incf beg elmo-localdir-header-chop-length)))))
(elmo-localdir-insert-header file)
(error (throw 'done nil)))
(goto-char (point-min))
- (setq header-end
+ (setq header-end
(if (re-search-forward "\\(^--.*$\\)\\|\\(\n\n\\)" nil t)
(point)
(point-max)))
(elmo-localdir-msgdb-create-overview-entity-from-file
number (expand-file-name (int-to-string number) dir)))
-(defun elmo-localdir-msgdb-create-as-numlist (spec numlist new-mark
- already-mark seen-mark
+(defun elmo-localdir-msgdb-create-as-numlist (spec numlist new-mark
+ already-mark seen-mark
important-mark seen-list)
(when numlist
(let ((dir (elmo-localdir-get-folder-directory spec))
(message "Creating msgdb...")
(while numlist
(setq entity
- (elmo-localdir-msgdb-create-entity
+ (elmo-localdir-msgdb-create-entity
dir (car numlist)))
(if (null entity)
()
(setq num (elmo-msgdb-overview-entity-get-number entity))
- (setq overview
+ (setq overview
(elmo-msgdb-append-element
overview entity))
(setq message-id (elmo-msgdb-overview-entity-get-id entity))
(setq seen (member message-id seen-list))
(if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
(if (elmo-cache-exists-p message-id) ; XXX
- (if seen
+ (if seen
nil
already-mark)
- (if seen
+ (if seen
nil ;;seen-mark
new-mark))))
(setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
+ (elmo-msgdb-mark-append
+ mark-alist
num
gmark))))
(when (> len elmo-display-progress-threshold)
(setq dirent (cdr dirent))
(setq abspath (expand-file-name relpath curdir))
(and
- (not (string-match
+ (not (string-match
elmo-localdir-list-folders-filter-regexp
relpath))
(eq (nth 0 (setq attr (file-attributes abspath))) t)
(setq file (expand-file-name number dir))
(if (and (string-match "[0-9]+" number) ; for safety.
(file-exists-p file)
- (file-writable-p file)
+ (file-writable-p file)
(not (file-directory-p file)))
(progn (delete-file file)
t))))
(defun elmo-localdir-check-validity (spec validity-file)
(let* ((dir (elmo-localdir-get-folder-directory spec))
(cur-val (nth 5 (file-attributes dir)))
- (file-val (read
+ (file-val (read
(or (elmo-get-file-string validity-file)
"nil"))))
(cond
(prin1 (nth 5 (file-attributes dir)) tmp-buffer)
(princ "\n" tmp-buffer)
(if (file-writable-p validity-file)
- (write-region (point-min) (point-max)
+ (write-region (point-min) (point-max)
validity-file nil 'no-msg)
(message (format "%s is not writable." number-file)))
(kill-buffer tmp-buffer))))
t))))
(defsubst elmo-localdir-field-condition-match (spec number condition)
- (elmo-file-field-condition-match
+ (elmo-file-field-condition-match
(expand-file-name (int-to-string number)
(elmo-localdir-get-folder-directory spec))
condition))
t)
(defun elmo-localdir-get-msg-filename (spec number &optional loc-alist)
- (expand-file-name
+ (expand-file-name
(int-to-string number)
(elmo-localdir-get-folder-directory spec)))
(throw 'found t))
(setq lock (cdr lock)))))))
-(defalias 'elmo-localdir-sync-number-alist
+(defalias 'elmo-localdir-sync-number-alist
'elmo-generic-sync-number-alist)
-(defalias 'elmo-localdir-list-folder-unread
+(defalias 'elmo-localdir-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-localdir-list-folder-important
'elmo-generic-list-folder-important)
(elmo-localdir-get-msg-filename spec number loc-alist)))
(defalias 'elmo-localnews-sync-number-alist 'elmo-generic-sync-number-alist)
-(defalias 'elmo-localnews-list-folder-unread
+(defalias 'elmo-localnews-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-localnews-list-folder-important
'elmo-generic-list-folder-important)
nil "^[^.].*$" t))
seen-list seen sym list)
(setq list
- (mapcar
+ (mapcar
(lambda (x)
(if (string-match "^\\([^:]+\\):\\([^:]+\\)$" x)
(progn
(let ((cur-time (current-time))
(count 0)
last-accessed)
- (mapcar (function
+ (mapcar (function
(lambda (file)
(setq last-accessed (nth 4 (file-attributes file)))
(when (or (> (- (car cur-time)(car last-accessed)) 1)
(elmo-maildir-cleanup-temporal maildir)
;; move new msgs to cur directory.
(mapcar (lambda (x)
- (rename-file
+ (rename-file
(expand-file-name x (expand-file-name "new" maildir))
(expand-file-name (concat x ":2,")
(expand-file-name "cur" maildir))))
(defun elmo-maildir-set-mark (filename mark)
"Mark the file in the maildir. MARK is a character."
(if (string-match "^\\([^:]+:2,\\)\\(.*\\)$" filename)
- (let ((flaglist (string-to-char-list (elmo-match-string
+ (let ((flaglist (string-to-char-list (elmo-match-string
2 filename))))
(unless (memq mark flaglist)
(setq flaglist (sort (cons mark flaglist) '<))
(defun elmo-maildir-delete-mark (filename mark)
"Mark the file in the maildir. MARK is a character."
(if (string-match "^\\([^:]+:2,\\)\\(.*\\)$" filename)
- (let ((flaglist (string-to-char-list (elmo-match-string
+ (let ((flaglist (string-to-char-list (elmo-match-string
2 filename))))
(when (memq mark flaglist)
(setq flaglist (delq mark flaglist))
(defun elmo-maildir-mark-as-unread (spec msgs &optional msgdb)
(elmo-maildir-delete-mark-msgs spec ?S msgs msgdb))
-(defun elmo-maildir-msgdb-create (spec numlist new-mark
- already-mark seen-mark
- important-mark
+(defun elmo-maildir-msgdb-create (spec numlist new-mark
+ already-mark seen-mark
+ important-mark
seen-list
&optional msgdb)
(when numlist
(let* ((dir (elmo-maildir-get-folder-directory spec))
(loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec))))
(loc-seen (elmo-maildir-list-location dir))
(loc-list (car loc-seen))
dir (car numlist) loc-alist))
(if (null entity)
()
- (setq overview
+ (setq overview
(elmo-msgdb-append-element
overview entity))
(setq number-alist
(setq location (cdr (assq (car numlist) loc-alist)))
(unless (member location seen-list)
(setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
+ (elmo-msgdb-mark-append
+ mark-alist
(elmo-msgdb-overview-entity-get-number
entity)
- (or (elmo-msgdb-global-mark-get
+ (or (elmo-msgdb-global-mark-get
(elmo-msgdb-overview-entity-get-id
entity))
new-mark)))))
(not (or (listp folder) (elmo-folder-exists-p folder)))))
folders)))
-(static-cond
+(static-cond
((>= emacs-major-version 19)
(defun elmo-maildir-make-unique-string ()
"This function generates a string that can be used as a unique
-file name for maildir directories."
+file name for maildir directories."
(let ((cur-time (current-time)))
(format "%.0f.%d_%d.%s"
(+ (* (car cur-time)
(float-to-string
(f+ (f* (f (car time))
(f 65536))
- (f (cadr time))))
- 0 5)
+ (f (cadr time))))
+ 0 5)
(cadr time)
(% (abs (random t)) 10000); dummy pid
(system-name))))))
(defun elmo-maildir-temporal-filename (basedir)
- (let ((filename (expand-file-name
+ (let ((filename (expand-file-name
(concat "tmp/" (elmo-maildir-make-unique-string))
basedir)))
(unless (file-exists-p (file-name-directory filename))
(make-directory (file-name-directory filename)))
(while (file-exists-p filename)
;; (sleep-for 2) ; I don't want to wait.
- (setq filename
- (expand-file-name
+ (setq filename
+ (expand-file-name
(concat "tmp/" (elmo-maildir-make-unique-string))
basedir)))
filename))
;; add link from new.
(elmo-add-name-to-file
filename
- (expand-file-name
+ (expand-file-name
(concat "new/" (file-name-nondirectory filename))
basedir))
t)
(let ((dir (elmo-maildir-get-folder-directory spec))
file)
(setq file (elmo-maildir-number-to-filename dir number loc-alist))
- (if (and (file-writable-p file)
+ (if (and (file-writable-p file)
(not (file-directory-p file)))
(progn (delete-file file)
t))))
(defun elmo-maildir-read-msg (spec number outbuf &optional msgdb)
(save-excursion
(let* ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec))))
(dir (elmo-maildir-get-folder-directory spec))
(file (elmo-maildir-number-to-filename dir number loc-alist)))
(defun elmo-maildir-delete-msgs (spec msgs &optional msgdb)
(let ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec)))))
(mapcar '(lambda (msg) (elmo-maildir-delete-msg spec msg
loc-alist))
(defsubst elmo-maildir-list-folder-subr (spec &optional nonsort)
(let* ((dir (elmo-maildir-get-folder-directory spec))
- (flist (elmo-list-folder-by-location
+ (flist (elmo-list-folder-by-location
spec
(car (elmo-maildir-list-location dir))))
(news (car (elmo-maildir-list-location dir "new"))))
(save-excursion
(let* ((msgs (or from-msgs (elmo-maildir-list-folder spec)))
(loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
- (elmo-msgdb-location-load (elmo-msgdb-expand-path
+ (elmo-msgdb-location-load (elmo-msgdb-expand-path
nil spec))))
(dir (elmo-maildir-get-folder-directory spec))
(i 0)
msg-num)
(while msgs
(setq msg-num (car msgs))
- (if (elmo-file-field-condition-match
+ (if (elmo-file-field-condition-match
(elmo-maildir-number-to-filename
dir (car msgs) loc-alist)
condition)
ret-val)))
;;; (maildir) -> maildir
-(defun elmo-maildir-copy-msgs (dst-spec msgs src-spec
+(defun elmo-maildir-copy-msgs (dst-spec msgs src-spec
&optional loc-alist same-number)
(let (srcfile)
(while msgs
- (setq srcfile
+ (setq srcfile
(elmo-maildir-get-msg-filename src-spec (car msgs) loc-alist))
(elmo-copy-file
;; src file
srcfile
;; dst file
- (expand-file-name
+ (expand-file-name
(file-name-nondirectory srcfile)
(concat (elmo-maildir-get-folder-directory dst-spec) "/cur")))
(setq msgs (cdr msgs))))
t)
(defun elmo-maildir-get-msg-filename (spec number &optional loc-alist)
- (elmo-maildir-number-to-filename
+ (elmo-maildir-number-to-filename
(elmo-maildir-get-folder-directory spec)
- number (or loc-alist (elmo-msgdb-location-load
- (elmo-msgdb-expand-path
+ number (or loc-alist (elmo-msgdb-location-load
+ (elmo-msgdb-expand-path
nil spec)))))
-(defalias 'elmo-maildir-sync-number-alist
+(defalias 'elmo-maildir-sync-number-alist
'elmo-generic-sync-number-alist)
-(defalias 'elmo-maildir-list-folder-unread
+(defalias 'elmo-maildir-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-maildir-list-folder-important
'elmo-generic-list-folder-important)
(let* ((spec (or spec (elmo-folder-get-spec folder)))
(type (car spec))
fld)
- (cond
+ (cond
((eq type 'imap4)
(setq fld (elmo-imap4-spec-mailbox spec))
(if (string= "inbox" (downcase fld))
(setq fld "inbox"))
(if (eq (string-to-char fld) ?/)
(setq fld (substring fld 1 (length fld))))
- (expand-file-name
+ (expand-file-name
fld
(expand-file-name (or (elmo-imap4-spec-username spec) "nobody")
- (expand-file-name (or
+ (expand-file-name (or
(elmo-imap4-spec-hostname spec)
"nowhere")
- (expand-file-name
+ (expand-file-name
"imap"
elmo-msgdb-dir)))))
((eq type 'nntp)
- (expand-file-name
+ (expand-file-name
(elmo-nntp-spec-group spec)
(expand-file-name (or (elmo-nntp-spec-hostname spec) "nowhere")
(expand-file-name "nntp"
(expand-file-name "filter"
elmo-msgdb-dir)))
((eq type 'archive)
- (expand-file-name
+ (expand-file-name
(directory-file-name
(concat
- (elmo-replace-in-string
+ (elmo-replace-in-string
(elmo-replace-in-string
- (elmo-replace-in-string
+ (elmo-replace-in-string
(nth 1 spec)
"/" "_")
":" "__")
"~" "___")
"/" (nth 3 spec)))
- (expand-file-name (concat (symbol-name type) "/"
+ (expand-file-name (concat (symbol-name type) "/"
(symbol-name (nth 2 spec)))
elmo-msgdb-dir)))
((eq type 'pop3)
- (expand-file-name
+ (expand-file-name
(elmo-safe-filename (elmo-pop3-spec-username spec))
(expand-file-name (elmo-pop3-spec-hostname spec)
(expand-file-name
;;
(defsubst elmo-msgdb-number-add (alist number id)
(let ((ret-val alist))
- (setq ret-val
+ (setq ret-val
(elmo-msgdb-append-element ret-val (cons number id)))
ret-val))
(let* ((path (expand-file-name
elmo-msgdb-global-mark-filename
elmo-msgdb-dir))
- (malist (or elmo-msgdb-global-mark-alist
- (setq elmo-msgdb-global-mark-alist
+ (malist (or elmo-msgdb-global-mark-alist
+ (setq elmo-msgdb-global-mark-alist
(elmo-object-load path))))
match)
(when (setq match (assoc msgid malist))
(let* ((path (expand-file-name
elmo-msgdb-global-mark-filename
elmo-msgdb-dir))
- (malist (or elmo-msgdb-global-mark-alist
- (setq elmo-msgdb-global-mark-alist
+ (malist (or elmo-msgdb-global-mark-alist
+ (setq elmo-msgdb-global-mark-alist
(elmo-object-load path))))
match)
(if (setq match (assoc msgid malist))
(elmo-object-save path elmo-msgdb-global-mark-alist)))
(defun elmo-msgdb-global-mark-get (msgid)
- (cdr (assoc msgid (or elmo-msgdb-global-mark-alist
- (setq elmo-msgdb-global-mark-alist
- (elmo-object-load
+ (cdr (assoc msgid (or elmo-msgdb-global-mark-alist
+ (setq elmo-msgdb-global-mark-alist
+ (elmo-object-load
(expand-file-name
elmo-msgdb-global-mark-filename
elmo-msgdb-dir)))))))
(defsubst elmo-msgdb-location-add (alist number location)
(let ((ret-val alist))
- (setq ret-val
+ (setq ret-val
(elmo-msgdb-append-element ret-val (cons number location)))
ret-val))
(defsubst elmo-msgdb-location-save (dir alist)
- (elmo-object-save
+ (elmo-object-save
(expand-file-name
elmo-msgdb-location-filename
dir) alist))
locations-in-db))
(setq modified new-locs)
(setq i (or (elmo-max-of-list (mapcar 'car location-alist)) 0))
- (mapcar
- (function
+ (mapcar
+ (function
(lambda (x)
(setq location-alist
(delq (rassoc x location-alist) location-alist))))
(setq ret-val (delq entity alist))
;; set mark
(setcar (cdr entity) mark))
- (if mark
+ (if mark
(setq ret-val (elmo-msgdb-append-element ret-val
(list id mark)))))
ret-val))
(while (re-search-forward (concat "^" name ":[ \t]*") nil t)
(setq field-body
(nconc field-body
- (list (buffer-substring-no-properties
+ (list (buffer-substring-no-properties
(match-end 0) (std11-field-end))))))
field-body))))
(buffer-substring beg (point)) "\n[ \t]*" ""))))))))
(defun elmo-msgdb-number-load (dir)
- (elmo-object-load
+ (elmo-object-load
(expand-file-name elmo-msgdb-number-filename dir)))
(defun elmo-msgdb-overview-load (dir)
- (elmo-object-load
+ (elmo-object-load
(expand-file-name elmo-msgdb-overview-filename dir)))
(defun elmo-msgdb-mark-load (dir)
- (elmo-object-load
+ (elmo-object-load
(expand-file-name elmo-msgdb-mark-filename dir)))
(defsubst elmo-msgdb-seen-load (dir)
dir)))
(defun elmo-msgdb-number-save (dir obj)
- (elmo-object-save
+ (elmo-object-save
(expand-file-name elmo-msgdb-number-filename dir)
obj))
(defun elmo-msgdb-mark-save (dir obj)
- (elmo-object-save
+ (elmo-object-save
(expand-file-name elmo-msgdb-mark-filename dir)
obj))
(defsubst elmo-msgdb-seen-save (dir obj)
- (elmo-object-save
+ (elmo-object-save
(expand-file-name elmo-msgdb-seen-filename dir)
obj))
(defsubst elmo-msgdb-overview-save (dir overview)
- (elmo-object-save
+ (elmo-object-save
(expand-file-name elmo-msgdb-overview-filename dir)
overview))
(defun elmo-msgdb-delete-msgs (folder msgs msgdb &optional reserve-cache)
- "Delete MSGS from FOLDER in MSGDB.
+ "Delete MSGS from FOLDER in MSGDB.
content of MSGDB is changed."
(save-excursion
(let* ((msg-list msgs)
;; remove from current database.
(while msg-list
(setq message-id (cdr (assq (car msg-list) number-alist)))
- (if (and (not reserve-cache) message-id)
+ (if (and (not reserve-cache) message-id)
(elmo-cache-delete message-id
folder (car msg-list)))
;; This is no good!!!!
;(setq overview (delete (assoc message-id overview) overview))
- (setq overview
+ (setq overview
(delq
(setq ov-entity
(elmo-msgdb-overview-get-entity (car msg-list) newmsgdb))
msgs))))
(defun elmo-msgdb-finfo-load ()
- (elmo-object-load (expand-file-name
+ (elmo-object-load (expand-file-name
elmo-msgdb-finfo-filename
elmo-msgdb-dir)
elmo-mime-charset t))
alist))
(defsubst elmo-msgdb-create-overview-from-buffer (number &optional size time)
- "Create overview entity from current buffer.
+ "Create overview entity from current buffer.
Header region is supposed to be narrowed."
(save-excursion
(let ((extras elmo-msgdb-extra-fields)
(elmo-field-body "references"))))
(setq from (elmo-mime-string (elmo-delete-char
?\"
- (or
+ (or
(elmo-field-body "from")
elmo-no-from))))
(setq subject (elmo-mime-string (or (elmo-field-body "subject")
(setq extra (cons (cons (downcase (car extras))
field-body) extra)))
(setq extras (cdr extras)))
- (cons message-id (vector number references
+ (cons message-id (vector number references
from subject date to cc
size extra))
)))
(defun elmo-msgdb-overview-sort-by-date (overview)
(sort overview
(function
- (lambda (x y)
+ (lambda (x y)
(condition-case nil
(string<
- (timezone-make-date-sortable
+ (timezone-make-date-sortable
(elmo-msgdb-overview-entity-get-date x))
- (timezone-make-date-sortable
+ (timezone-make-date-sortable
(elmo-msgdb-overview-entity-get-date y)))
(error))))))
nil))
(defsubst elmo-msgdb-append (msgdb msgdb-append &optional set-hash)
- (list
+ (list
(nconc (car msgdb) (car msgdb-append))
(nconc (cadr msgdb) (cadr msgdb-append))
(nconc (caddr msgdb) (caddr msgdb-append))
(defun elmo-multi-msgdb (msgdb base)
(list (mapcar (function
- (lambda (x)
+ (lambda (x)
(elmo-msgdb-overview-entity-set-number
x
(+ base
(setq one-list-list (elmo-multi-get-intlist-list numlist))
(setq cur-number 0)
(while (< cur-number (length flds))
- (setq ret-val
- (elmo-msgdb-append
+ (setq ret-val
+ (elmo-msgdb-append
ret-val
(elmo-multi-msgdb
(elmo-msgdb-create-as-numlist (nth cur-number flds)
;; returns append-msgdb
(defun elmo-multi-delete-crossposts (already-msgdb append-msgdb)
(let* ((number-alist (elmo-msgdb-get-number-alist append-msgdb))
- (dummy (copy-sequence (append
+ (dummy (copy-sequence (append
number-alist
(elmo-msgdb-get-number-alist already-msgdb))))
(cur number-alist)
;; base is also same...delete it!
(setq to-be-deleted (append to-be-deleted (list (car cur))))))
(setq cur (cdr cur)))
- (setq overview (elmo-delete-if
+ (setq overview (elmo-delete-if
(function
(lambda (x)
(assq
(elmo-msgdb-overview-entity-get-number x)
to-be-deleted)))
(elmo-msgdb-get-overview append-msgdb)))
- (setq mark-alist (elmo-delete-if
+ (setq mark-alist (elmo-delete-if
(function
(lambda (x)
(assq
(setq one-list-list (elmo-multi-get-intlist-list numlist))
(setq cur-number 0)
(while (< cur-number (length flds))
- (setq ret-val
- (elmo-msgdb-append
+ (setq ret-val
+ (elmo-msgdb-append
ret-val
(elmo-multi-msgdb
(elmo-msgdb-create (nth cur-number flds)
(cur-number 0))
(setq one-list-list (elmo-multi-get-intlist-list msgs))
(while (< cur-number (length flds))
- (elmo-delete-msgs (nth cur-number flds)
+ (elmo-delete-msgs (nth cur-number flds)
(nth cur-number one-list-list))
(setq cur-number (+ 1 cur-number)))
t))
(* elmo-multi-divide-number cur-number))
elmo-multi-divide-number)))
(setq one-alist (nconc
- one-alist
- (list
+ one-alist
+ (list
(list (% (car (car mark-alist))
(* elmo-multi-divide-number cur-number))
(cadr (car mark-alist))))))
(setq mark-alist-list (elmo-multi-mark-alist-list mark-alist))
(while flds
(setq cur-number (+ cur-number 1))
- (setq ret-val (append
+ (setq ret-val (append
ret-val
- (mapcar
+ (mapcar
(function
(lambda (x)
- (+
+ (+
(* elmo-multi-divide-number cur-number) x)))
(elmo-list-folder-unread (car flds)
- (car mark-alist-list)
+ (car mark-alist-list)
unread-marks))))
(setq mark-alist-list (cdr mark-alist-list))
(setq flds (cdr flds)))
ret-val)
(while flds
(setq cur-number (+ cur-number 1))
- (setq ret-val (append
+ (setq ret-val (append
ret-val
- (mapcar
+ (mapcar
(function
(lambda (x)
- (+
+ (+
(* elmo-multi-divide-number cur-number) x)))
(elmo-list-folder-important (car flds) overview))))
(setq flds (cdr flds)))
numbers)
(while flds
(setq cur-number (+ cur-number 1))
- (setq numbers (append
+ (setq numbers (append
numbers
- (mapcar
+ (mapcar
(function
(lambda (x)
- (+
+ (+
(* elmo-multi-divide-number cur-number) x)))
(elmo-list-folder (car flds)))))
(setq flds (cdr flds)))
(if (null cur-numlist)
;; t means filter all.
(setq cur-numlist t)))
- (setq ret-val (append
+ (setq ret-val (append
ret-val
- (elmo-list-filter
+ (elmo-list-filter
cur-numlist
- (mapcar
+ (mapcar
(function
(lambda (x)
- (+
+ (+
(* elmo-multi-divide-number cur-number) x)))
(elmo-call-func
(car flds) "search" condition)))))
ret-val))
(defun elmo-multi-use-cache-p (spec number)
- (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1)
+ (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1)
(cdr spec))
- "use-cache-p"
+ "use-cache-p"
(% number elmo-multi-divide-number)))
(defun elmo-multi-local-file-p (spec number)
- (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1)
+ (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1)
(cdr spec))
- "local-file-p"
+ "local-file-p"
(% number elmo-multi-divide-number)))
(defun elmo-multi-commit (spec)
(incf multi-base)
(setq append-alist
(elmo-call-func (nth (- multi-base 1) (cdr spec)) ;; folder name
- "sync-number-alist"
+ "sync-number-alist"
(nth (- multi-base 1) number-alist-list)))
- (mapcar
+ (mapcar
(function
(lambda (x)
- (setcar x
+ (setcar x
(+ (* elmo-multi-divide-number multi-base) (car x)))))
append-alist)
(setq result-alist (nconc result-alist append-alist))
(elmo-network-session-process-internal
(cdr pair)))
'(closed exit)))
- (setq elmo-network-session-cache
+ (setq elmo-network-session-cache
(delq pair elmo-network-session-cache))
(elmo-network-close-session (cdr pair))
(setq pair nil))
(elmo-network-initialize-session session)
(elmo-network-authenticate-session session)
(elmo-network-setup-session session)))
- (error
+ (error
(when (eq (car error) 'elmo-authenticate-error)
(elmo-remove-passwd (elmo-network-session-password-key session)))
(elmo-network-close-session session)
(if (looking-at "[23][0-9]+ .*$")
(progn (setq response-continue nil)
(setq elmo-nntp-read-point match-end)
- (setq return-value
- (if return-value
+ (setq return-value
+ (if return-value
(concat return-value "\n" response-string)
response-string)))
(if (looking-at "[^23][0-9]+ .*$")
(setq elmo-nntp-read-point match-end)
(if not-command
(setq response-continue nil))
- (setq return-value
- (if return-value
+ (setq return-value
+ (if return-value
(concat return-value "\n" response-string)
response-string)))
(setq elmo-nntp-read-point match-end)))
(goto-char elmo-nntp-read-point))
(setq match-end (point))
(elmo-delete-cr
- (buffer-substring elmo-nntp-read-point
+ (buffer-substring elmo-nntp-read-point
(- match-end 3))))))
(defun elmo-nntp-read-body (buffer process outbuf)
(condition-case ()
(if (not (string= cwf folder))
(progn
- (elmo-nntp-send-command buffer
- process
+ (elmo-nntp-send-command buffer
+ process
(format "group %s" folder))
(if (elmo-nntp-read-response buffer process)
(setcar (cddr connection) folder)))
(defun elmo-nntp-list-folders (spec &optional hierarchy)
(elmo-nntp-setting spec
- (let* ((cwf (caddr connection))
+ (let* ((cwf (caddr connection))
(tmp-buffer (get-buffer-create " *ELMO NNTP list folders TMP*"))
response ret-val top-ng append-serv use-list-active start)
(save-excursion
(concat "-" fld
(and user
(concat ":" user))
- (and append-serv
+ (and append-serv
(concat append-serv)))))
ret-val)))))
(error "Fetching listgroup failed"))
(setq numbers (elmo-string-to-list response))))
(unless use-listgroup
- (elmo-nntp-send-command buffer
- process
+ (elmo-nntp-send-command buffer
+ process
(format "group %s" folder))
(if (null (setq response (elmo-nntp-read-response buffer process)))
(error "Select folder failed"))
(setcar (cddr connection) folder)
(if (and
- (string-match
- "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
+ (string-match
+ "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
response)
(> (string-to-int (elmo-match-string 1 response)) 0))
(setq numbers (elmo-nntp-make-msglist
(if (not connection)
(error "Connection failed"))
(save-excursion
- (elmo-nntp-send-command buffer
- process
+ (elmo-nntp-send-command buffer
+ process
(format "group %s" folder))
(setq response (elmo-nntp-read-response buffer process))
- (if (and response
- (string-match
- "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
+ (if (and response
+ (string-match
+ "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
response))
(progn
(setq end-num (string-to-int
("lines" . 7)
("xref" . 8)))
-(defun elmo-nntp-create-msgdb-from-overview-string (str
+(defun elmo-nntp-create-msgdb-from-overview-string (str
folder
new-mark
already-mark
(setq extra (cons (cons ext field) extra)))
(setq extras (cdr extras)))
(setq overview
- (elmo-msgdb-append-element
+ (elmo-msgdb-append-element
overview
(cons (aref ov-entity 4)
(vector num
- (elmo-msgdb-get-last-message-id
+ (elmo-msgdb-get-last-message-id
(aref ov-entity 5))
;; from
- (elmo-mime-string (elmo-delete-char
+ (elmo-mime-string (elmo-delete-char
?\"
- (or
- (aref ov-entity 2)
+ (or
+ (aref ov-entity 2)
elmo-no-from) 'uni))
;; subject
(elmo-mime-string (or (aref ov-entity 1)
seen-mark)
new-mark))))
(setq mark-alist
- (elmo-msgdb-mark-append mark-alist
+ (elmo-msgdb-mark-append mark-alist
num gmark))))
(setq ov-list (cdr ov-list)))
(list overview number-alist mark-alist)))
t))
(defun elmo-nntp-msgdb-create (spec numlist new-mark already-mark
- seen-mark important-mark
+ seen-mark important-mark
seen-list &optional as-num)
(when numlist
(save-excursion
length (+ (- end-num beg-num) 1))
(message "Getting overview...")
(while (<= cur end-num)
- (elmo-nntp-send-command buffer process
- (format
- "xover %s-%s"
+ (elmo-nntp-send-command buffer process
+ (format
+ "xover %s-%s"
(int-to-string cur)
- (int-to-string
- (+ cur
+ (int-to-string
+ (+ cur
elmo-nntp-overview-fetch-chop-length))))
(with-current-buffer buffer
(if ov-str
- (setq ret-val
+ (setq ret-val
(elmo-msgdb-append
ret-val
- (elmo-nntp-create-msgdb-from-overview-string
+ (elmo-nntp-create-msgdb-from-overview-string
ov-str
folder
new-mark
(setq cur (+ elmo-nntp-overview-fetch-chop-length cur 1))
(when (> length elmo-display-progress-threshold)
(elmo-display-progress
- 'elmo-nntp-msgdb-create "Getting overview..."
+ 'elmo-nntp-msgdb-create "Getting overview..."
(/ (* (+ (- (min cur end-num)
beg-num) 1) 100) length))))
(when (> length elmo-display-progress-threshold)
new-mark already-mark seen-mark seen-list))
(with-current-buffer buffer
(if ov-str
- (setq ret-val
+ (setq ret-val
(elmo-msgdb-append
ret-val
- (elmo-nntp-create-msgdb-from-overview-string
+ (elmo-nntp-create-msgdb-from-overview-string
ov-str
folder
new-mark
;; to max-number(inn 2.3?).
(when (and (elmo-nntp-max-number-precedes-list-active-p)
(elmo-nntp-list-active-p server port))
- (elmo-nntp-send-command buffer process
+ (elmo-nntp-send-command buffer process
(format "list active %s" folder))
(if (null (elmo-nntp-read-response buffer process))
(progn
(elmo-nntp-set-list-active server port nil)
(error "NNTP list command failed")))
- (elmo-nntp-catchup-msgdb
- ret-val
- (nth 1 (read (concat "(" (elmo-nntp-read-contents
+ (elmo-nntp-catchup-msgdb
+ ret-val
+ (nth 1 (read (concat "(" (elmo-nntp-read-contents
buffer process) ")")))))
ret-val)))))
number-alist))))
(defun elmo-nntp-msgdb-create-by-header (folder buffer process numlist
- new-mark already-mark
+ new-mark already-mark
seen-mark seen-list)
(let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))
ret-val)
buffer tmp-buffer process numlist)
(setq ret-val
(elmo-nntp-msgdb-create-message
- tmp-buffer (length numlist) folder new-mark already-mark
+ tmp-buffer (length numlist) folder new-mark already-mark
seen-mark seen-list))
(kill-buffer tmp-buffer)
ret-val))
(while (not (eobp))
(end-of-line)
(setq ret-list (save-match-data
- (apply 'vector (split-string
- (buffer-substring beg (point))
+ (apply 'vector (split-string
+ (buffer-substring beg (point))
"\t"))))
(beginning-of-line)
(forward-line 1)
(let* ((connection (elmo-nntp-get-connection server user port type))
(buffer (car connection))
(process (cadr connection))
-; (cwf (caddr connection))
- response errmsg ov-str)
+; (cwf (caddr connection))
+ response errmsg ov-str)
(catch 'done
(if folder
(if (null (elmo-nntp-goto-folder server folder user port type))
(progn
(setq errmsg (format "group %s not found." folder))
(throw 'done nil))))
- (elmo-nntp-send-command buffer process
+ (elmo-nntp-send-command buffer process
(format "xover %s-%s" beg end))
(if (null (setq response (elmo-nntp-read-response
buffer process t)))
(setq ov-str response)
)
(if errmsg
- (progn
+ (progn
(message errmsg)
nil)
ov-str))))
(defun elmo-nntp-get-message (server user number folder outbuf port type)
- "Get nntp message on FOLDER at SERVER.
+ "Get nntp message on FOLDER at SERVER.
Returns message string."
(save-excursion
(let* ((connection (elmo-nntp-get-connection server user port type))
(buffer (car connection))
(process (cadr connection))
- (cwf (caddr connection))
+ (cwf (caddr connection))
response errmsg)
(catch 'done
(if (and folder
(progn
(setq errmsg (format "group %s not found." folder))
(throw 'done nil))))
- (elmo-nntp-send-command buffer process
+ (elmo-nntp-send-command buffer process
(format "article %s" number))
(if (null (setq response (elmo-nntp-read-response
buffer process t)))
(forward-line))
)
(if errmsg
- (progn
+ (progn
(message errmsg)
nil))
response)))
(let* ((connection (elmo-nntp-get-connection server user port type))
(buffer (car connection))
(process (cadr connection)))
- (elmo-nntp-send-command buffer process
+ (elmo-nntp-send-command buffer process
(format "head %s" msgid))
(if (elmo-nntp-read-response buffer process)
(elmo-nntp-read-contents buffer process))
(defun elmo-nntp-read-msg (spec msg outbuf)
(elmo-nntp-get-message (elmo-nntp-spec-hostname spec)
(elmo-nntp-spec-username spec)
- msg
+ msg
(elmo-nntp-spec-group spec)
- outbuf
+ outbuf
(elmo-nntp-spec-port spec)
(elmo-nntp-spec-stream-type spec)))
(defun elmo-nntp-post (hostname content-buf)
(let* (;(folder (nth 1 spec))
- (connection
- (elmo-nntp-get-connection
- hostname
+ (connection
+ (elmo-nntp-get-connection
+ hostname
elmo-default-nntp-user
elmo-default-nntp-port elmo-default-nntp-stream-type))
(buffer (car connection))
(delete-region (match-beginning 0)(match-end 0)))
(setq has-message-id (std11-field-body "message-id"))
(elmo-nntp-send-command buffer process "post")
- (if (string-match "^340" (setq response
- (elmo-nntp-read-raw-response
+ (if (string-match "^340" (setq response
+ (elmo-nntp-read-raw-response
buffer process)))
(if (string-match "recommended ID \\(<[^@]+@[^>]+>\\)" response)
(unless has-message-id
(elmo-nntp-send-data process content-buf)
(elmo-nntp-send-command buffer process ".")
;(elmo-nntp-read-response buffer process t)
- (if (not (string-match
+ (if (not (string-match
"^2" (setq response (elmo-nntp-read-raw-response
buffer process))))
(error (concat "NNTP error: " response))))))
(setq key (cons (cons buffer process)
(vector 0 server user port type)))
(setq connection-keys (nconc connection-keys (list key))))
- (elmo-nntp-send-command buffer
- process
+ (elmo-nntp-send-command buffer
+ process
(format "group %s" folder)
t ;; don't erase-buffer
)
;; end of from Gnus
-(defun elmo-nntp-msgdb-create-message (buffer len folder new-mark
+(defun elmo-nntp-msgdb-create-message (buffer len folder new-mark
already-mark seen-mark seen-list)
(save-excursion
(let (beg
(setq beg (save-excursion (forward-line 1) (point)))
(setq num
(and (looking-at "^2[0-9]*[ ]+\\([0-9]+\\)")
- (string-to-int
+ (string-to-int
(elmo-match-buffer 1))))
(elmo-nntp-next-result-arrived-p)
(when num
(setq entity
(elmo-msgdb-create-overview-from-buffer num))
(when entity
- (setq overview
+ (setq overview
(elmo-msgdb-append-element
overview entity))
(setq number-alist
- (elmo-msgdb-number-add
+ (elmo-msgdb-number-add
number-alist
(elmo-msgdb-overview-entity-get-number entity)
(car entity)))
(setq message-id (car entity))
(setq seen (member message-id seen-list))
- (if (setq gmark
+ (if (setq gmark
(or (elmo-msgdb-global-mark-get message-id)
(if (elmo-cache-exists-p message-id);; XXX
(if seen
seen-mark)
new-mark))))
(setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
+ (elmo-msgdb-mark-append
+ mark-alist
num gmark)))
))))
(when (> len elmo-display-progress-threshold)
(elmo-nntp-spec-stream-type spec)))))))
(defsubst elmo-nntp-portinfo (spec)
- (list (elmo-nntp-spec-hostname spec)
+ (list (elmo-nntp-spec-hostname spec)
(elmo-nntp-spec-port spec)))
(defun elmo-nntp-plugged-p (spec)
(append (elmo-nntp-portinfo spec)
(list nil nil (quote (elmo-nntp-port-label spec)) add))))
-(defalias 'elmo-nntp-list-folder-unread
+(defalias 'elmo-nntp-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-nntp-list-folder-important
'elmo-generic-list-folder-important)
(defalias 'elmo-pipe-msgdb-create 'elmo-pipe-msgdb-create-as-numlist)
(defun elmo-pipe-msgdb-create-as-numlist (spec numlist new-mark already-mark
- seen-mark important-mark
+ seen-mark important-mark
seen-list)
(elmo-msgdb-create-as-numlist (elmo-pipe-spec-dst spec)
numlist new-mark already-mark
(defun elmo-pipe-read-msg (spec number outbuf)
(elmo-call-func (elmo-pipe-spec-dst spec)
- "read-msg"
+ "read-msg"
number outbuf))
(defun elmo-pipe-delete-msgs (spec msgs)
(defun elmo-pipe-drain (src dst)
(let ((msgdb (elmo-msgdb-load src))
- elmo-nntp-use-cache
+ elmo-nntp-use-cache
elmo-imap4-use-cache
elmo-pop3-use-cache ; Inhibit caching while moving messages.
elmo-pop3-use-uidl) ; No need to use UIDL
(elmo-get-msg-filename (elmo-pipe-spec-dst spec) number loc-alist))
(defun elmo-pipe-sync-number-alist (spec number-alist)
- (elmo-call-func (elmo-pipe-spec-src spec)
+ (elmo-call-func (elmo-pipe-spec-src spec)
"sync-number-alist" number-alist)) ; ??
(defun elmo-pipe-server-diff (spec)
(require 'sasl))
(error))
(defun-maybe md5 (a))
- (defun-maybe sasl-digest-md5-digest-response
- (digest-challenge username passwd serv-type host &optional realm))
+ (defun-maybe sasl-digest-md5-digest-response
+ (digest-challenge username passwd serv-type host &optional realm))
(defun-maybe sasl-scram-md5-client-msg-1
(authenticate-id &optional authorize-id))
(defun-maybe sasl-scram-md5-client-msg-2
(server-msg-1 client-msg-1 salted-pass))
(defun-maybe sasl-scram-md5-make-salted-pass
(server-msg-1 passphrase))
- (defun-maybe sasl-cram-md5 (username passphrase challenge))
+ (defun-maybe sasl-cram-md5 (username passphrase challenge))
(defun-maybe sasl-scram-md5-authenticate-server
(server-msg-1 server-msg-2 client-msg-1 salted-pass))
(defun-maybe starttls-negotiate (a)))
(buffer-substring elmo-pop3-read-point (- match-end 2)))
(goto-char elmo-pop3-read-point)
(if (looking-at "\\+.*$")
- (progn
+ (progn
(setq response-continue nil)
(setq elmo-pop3-read-point match-end)
- (setq return-value
- (if return-value
+ (setq return-value
+ (if return-value
(concat return-value "\n" response-string)
response-string)))
(if (looking-at "\\-.*$")
- (progn
+ (progn
(setq response-continue nil)
(setq elmo-pop3-read-point match-end)
(setq return-value nil))
(setq elmo-pop3-read-point match-end)
(if not-command
(setq response-continue nil))
- (setq return-value
- (if return-value
+ (setq return-value
+ (if return-value
(concat return-value "\n" response-string)
response-string)))
(setq elmo-pop3-read-point match-end)))
(let ((process (elmo-network-session-process-internal session)))
;; try USER/PASS
(elmo-pop3-send-command
- process
+ process
(format "user %s" (elmo-network-session-user-internal session)))
(or (elmo-pop3-read-response process t)
(signal 'elmo-authenticate-error
'(elmo-pop-auth-user)))
- (elmo-pop3-send-command process
+ (elmo-pop3-send-command process
(format
"pass %s"
(elmo-get-passwd
;; good, APOP ready server
(progn
(require 'md5)
- (elmo-pop3-send-command
+ (elmo-pop3-send-command
(elmo-network-session-process-internal session)
- (format "apop %s %s"
+ (format "apop %s %s"
(elmo-network-session-user-internal session)
- (md5
+ (md5
(concat (match-string
1
(elmo-network-session-greeting-internal session))
server-msg-1
client-msg-1
(setq salted-pass
- (sasl-scram-md5-make-salted-pass
+ (sasl-scram-md5-make-salted-pass
server-msg-1
(elmo-get-passwd
(elmo-network-session-password-key session)))))))
(with-current-buffer buffer
(mapcar 'make-variable-buffer-local elmo-pop3-local-variables)))
-(luna-define-method elmo-network-initialize-session ((session
+(luna-define-method elmo-network-initialize-session ((session
elmo-pop3-session))
(let ((process (elmo-network-session-process-internal session))
response capability mechanism)
(elmo-network-session-stream-type-internal session))
'starttls)
(elmo-pop3-send-command process "stls")
- (if (string-match "^\+OK"
+ (if (string-match "^\+OK"
(elmo-pop3-read-response process))
(starttls-negotiate process)
(signal 'elmo-open-error
'(elmo-network-intialize-session)))))))
-(luna-define-method elmo-network-authenticate-session ((session
+(luna-define-method elmo-network-authenticate-session ((session
elmo-pop3-session))
(let (authenticator)
;; defaults to 'user.
(elmo-network-session-auth-internal session)))
(funcall authenticator session)))
-(luna-define-method elmo-network-setup-session ((session
+(luna-define-method elmo-network-setup-session ((session
elmo-pop3-session))
(let ((process (elmo-network-session-process-internal session))
response)
(goto-char elmo-pop3-read-point))
(setq match-end (point))
(elmo-delete-cr
- (buffer-substring elmo-pop3-read-point
+ (buffer-substring elmo-pop3-read-point
(- match-end 3))))))
;; dummy functions
(elmo-msgdb-location-load
(elmo-msgdb-expand-path nil spec)))))
(elmo-pop3-msgdb-create-by-header process numlist
- new-mark already-mark
+ new-mark already-mark
seen-mark seen-list
loc-alist))))
elmo-pop3-size-hash))
(defun elmo-pop3-msgdb-create-by-header (process numlist
- new-mark already-mark
+ new-mark already-mark
seen-mark
seen-list
loc-alist)
(with-current-buffer (process-buffer process)
(if loc-alist ; use uidl.
(setq numlist
- (delq
+ (delq
nil
- (mapcar
+ (mapcar
(lambda (number)
(elmo-pop3-uidl-to-number (cdr (assq number loc-alist))))
numlist))))
tmp-buffer process numlist)
(prog1
(elmo-pop3-msgdb-create-message
- tmp-buffer
+ tmp-buffer
process
(length numlist)
numlist
new-mark already-mark seen-mark seen-list loc-alist)
(kill-buffer tmp-buffer)))))
-(defun elmo-pop3-msgdb-create-message (buffer
+(defun elmo-pop3-msgdb-create-message (buffer
process
num
- numlist new-mark already-mark
+ numlist new-mark already-mark
seen-mark
seen-list
loc-alist)
(save-restriction
(narrow-to-region beg (point))
(setq entity
- (elmo-msgdb-create-overview-from-buffer
+ (elmo-msgdb-create-overview-from-buffer
(car numlist)))
(setq numlist (cdr numlist))
(when entity
- (setq overview
+ (setq overview
(elmo-msgdb-append-element
overview entity))
(with-current-buffer (process-buffer process)
(setq message-id (car entity))
(setq seen (member message-id seen-list))
(if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
- (if (elmo-cache-exists-p
+ (if (elmo-cache-exists-p
message-id) ; XXX
(if seen
nil
seen-mark)
new-mark))))
(setq mark-alist
- (elmo-msgdb-mark-append
+ (elmo-msgdb-mark-append
mark-alist
(elmo-msgdb-overview-entity-get-number entity)
gmark))))))
(setq number (elmo-pop3-uidl-to-number
(cdr (assq number loc-alist)))))
(when number
- (elmo-pop3-send-command process
+ (elmo-pop3-send-command process
(format "retr %s" number))
(when (null (setq response (elmo-pop3-read-response
process t)))
(cdr (assq number loc-alist)))))
(if number
(progn
- (elmo-pop3-send-command process
+ (elmo-pop3-send-command process
(format "dele %s" number))
(when (null (setq response (elmo-pop3-read-response
process t)))
(elmo-msgdb-expand-path nil spec)))))
(process (elmo-network-session-process-internal
(elmo-pop3-get-session spec))))
- (mapcar '(lambda (msg) (elmo-pop3-delete-msg
+ (mapcar '(lambda (msg) (elmo-pop3-delete-msg
process msg loc-alist))
msgs)))
(elmo-pop3-spec-stream-type spec)))))))
(defsubst elmo-pop3-portinfo (spec)
- (list (elmo-pop3-spec-hostname spec)
+ (list (elmo-pop3-spec-hostname spec)
(elmo-pop3-spec-port spec)))
(defun elmo-pop3-plugged-p (spec)
(append (elmo-pop3-portinfo spec)
(list nil nil (quote (elmo-pop3-port-label spec)) add))))
-(defalias 'elmo-pop3-sync-number-alist
+(defalias 'elmo-pop3-sync-number-alist
'elmo-generic-sync-number-alist)
-(defalias 'elmo-pop3-list-folder-unread
+(defalias 'elmo-pop3-list-folder-unread
'elmo-generic-list-folder-unread)
(defalias 'elmo-pop3-list-folder-important
'elmo-generic-list-folder-important)
;; base64 encoding/decoding
(require 'mel)
-(fset 'elmo-base64-encode-string
+(fset 'elmo-base64-encode-string
(mel-find-function 'mime-encode-string "base64"))
(fset 'elmo-base64-decode-string
(mel-find-function 'mime-decode-string "base64"))
;; Check make-symbolic-link() instead. -- 981002 by Fuji
(if (fboundp 'make-symbolic-link) ;; xxx
(defalias 'elmo-add-name-to-file 'add-name-to-file)
- (defun elmo-add-name-to-file
+ (defun elmo-add-name-to-file
(filename newname &optional ok-if-already-exists)
(copy-file filename newname ok-if-already-exists t)))
(defmacro elmo-match-substring (pos string from)
"Substring of POSth matched string of STRING. "
- (` (substring (, string)
+ (` (substring (, string)
(+ (match-beginning (, pos)) (, from))
(match-end (, pos)))))
(elmo-set-buffer-multibyte default-enable-multibyte-characters)
(decode-mime-charset-region (point-min) (point-max) mime-charset))
(condition-case nil
- (read (current-buffer))
+ (read (current-buffer))
(error (unless no-err
(message "Warning: Loading object from %s failed."
filename)
(setq server (elmo-match-substring 1 folder 1))
(setq server default-server))
(if (match-beginning 2)
- (setq port
+ (setq port
(string-to-int (elmo-match-substring 2 folder 1)))
(setq port default-port))
(if (match-beginning 3)
(default-stream-type elmo-default-imap4-stream-type)
spec mailbox user auth)
(when (string-match "\\(.*\\)@\\(.*\\)" default-server)
- ;; case: default-imap4-server is specified like
+ ;; case: default-imap4-server is specified like
;; "hoge%imap.server@gateway".
(setq default-user (elmo-match-string 1 default-server))
(setq default-server (elmo-match-string 2 default-server)))
- (setq spec (elmo-network-get-spec
+ (setq spec (elmo-network-get-spec
folder default-server default-port default-stream-type))
(setq folder (car spec))
(when (string-match
"^\\(%\\)\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?"
folder)
(progn
- (setq mailbox (if (match-beginning 2)
+ (setq mailbox (if (match-beginning 2)
(elmo-match-string 2 folder)
elmo-default-imap4-mailbox))
(setq user (if (match-beginning 3)
(when (string-match
"^\\(-\\)\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?"
folder)
- (setq group
+ (setq group
(if (match-beginning 2)
(elmo-match-string 2 folder)))
- (setq user
- (if (match-beginning 3)
+ (setq user
+ (if (match-beginning 3)
(elmo-match-substring 3 folder 1)
elmo-default-nntp-user))
(append (list 'nntp group user)
(defsubst elmo-nntp-spec-group (spec)
(nth 1 spec))
-(defsubst elmo-nntp-spec-username (spec)
+(defsubst elmo-nntp-spec-username (spec)
(nth 2 spec))
;; future use?
(elmo-match-string 2 folder))) 0)
(setq fld-name "")
)
- (list 'localnews
+ (list 'localnews
(elmo-replace-in-string fld-name "\\." "/")))))
(defun elmo-cache-get-spec (folder)
term ret-val)
(while terms
(setq term (car terms))
- (cond
+ (cond
((string-match "^\\([a-zA-Z\\-]+\\)=\\(.*\\)$" term)
(if (save-match-data
(string-match "tocc" (elmo-match-string 1 term))) ;; syntax sugar
(elmo-match-string 2 term))
(vector 'match "cc"
(elmo-match-string 2 term)))))
- (setq ret-val (cons (vector 'match
+ (setq ret-val (cons (vector 'match
(elmo-match-string 1 term)
(elmo-match-string 2 term))
ret-val))))
(elmo-match-string 2 term))
(vector 'unmatch "cc"
(elmo-match-string 2 term)))))
- (setq ret-val (cons (vector 'unmatch
+ (setq ret-val (cons (vector 'unmatch
(elmo-match-string 1 term)
(elmo-match-string 2 term))
ret-val))))
(elmo-set-work-buf
(as-binary-output-file
(insert string)
- (write-region (point-min) (point-max)
+ (write-region (point-min) (point-max)
filename nil 'no-msg))
)))
(defun elmo-max-of-list (nlist)
- (let ((l nlist)
+ (let ((l nlist)
(max-num 0))
(while l
(if (< max-num (car l))
elmo-msgdb-dir))
(tmp-buffer (get-buffer-create " *elmo-passwd-alist-tmp*"))
insert-file-contents-pre-hook ; To avoid autoconv-xmas...
- insert-file-contents-post-hook
+ insert-file-contents-post-hook
ret-val)
(if (not (file-readable-p filename))
()
(insert-file-contents filename)
(setq ret-val
(condition-case nil
- (read (current-buffer))
+ (read (current-buffer))
(error nil nil))))
(kill-buffer tmp-buffer)
ret-val)))
; (error "%s is not safe.chmod 600 %s!" filename filename))
(if (file-writable-p filename)
(progn
- (write-region (point-min) (point-max)
+ (write-region (point-min) (point-max)
filename nil 'no-msg)
(set-file-modes filename 384))
(message (format "%s is not writable." filename)))
(setq pair (assoc key elmo-passwd-alist))
(if pair
(elmo-base64-decode-string (cdr pair))
- (setq pass (elmo-read-passwd (format "Password for %s: "
+ (setq pass (elmo-read-passwd (format "Password for %s: "
key) t))
(setq elmo-passwd-alist
(append elmo-passwd-alist
- (list (cons key
+ (list (cons key
(elmo-base64-encode-string pass)))))
(if elmo-passwd-life-time
(run-with-timer elmo-passwd-life-time nil
(defun elmo-delete-plugged (&optional server port alist)
(let* ((alist (or alist elmo-plugged-alist))
(alist2 alist))
- (cond ((and (not port) (not server))
+ (cond ((and (not port) (not server))
(setq alist nil))
((not port)
;; delete plugged all port of server
(defun elmo-disk-usage (path)
"Get disk usage (bytes) in PATH."
- (let ((file-attr
+ (let ((file-attr
(condition-case () (file-attributes path) (error nil))))
(if file-attr
(if (nth 0 file-attr) ; directory
- (let ((files (condition-case ()
+ (let ((files (condition-case ()
(directory-files path t "^[^\\.]")
(error nil)))
(result 0.0))
(while numbers
(setq cur-number (+ cur-number 1))
(setq one-list nil)
- (while (and numbers
+ (while (and numbers
(eq 0
(/ (- (car numbers)
(* elmo-multi-divide-number cur-number))
elmo-multi-divide-number)))
(setq one-list (nconc
- one-list
- (list
+ one-list
+ (list
(if as-is
(car numbers)
(% (car numbers)
ret-val))
(defun elmo-list-diff (list1 list2 &optional mes)
- (if mes
+ (if mes
(message mes))
(let ((clist1 (copy-sequence list1))
(clist2 (copy-sequence list2)))
result
dels news)
(while (or list1-list list2-list)
- (setq result (elmo-list-bigger-diff (car list1-list) (car list2-list)
+ (setq result (elmo-list-bigger-diff (car list1-list) (car list2-list)
mes))
(setq dels (append dels (car result)))
(setq news (append news (cadr result)))
(while condition
(goto-char (point-min))
(setq term (car condition))
- (cond
+ (cond
((and (eq (elmo-filter-type term) 'date)
(string= (elmo-filter-key term) "since"))
(let ((date (elmo-date-get-datevec (elmo-filter-value term))))
(if (string<
- (timezone-make-sortable-date (aref date 0)
+ (timezone-make-sortable-date (aref date 0)
(aref date 1)
(aref date 2)
(timezone-make-time-string
- (aref date 3)
- (aref date 4)
+ (aref date 3)
+ (aref date 4)
(aref date 5)))
(timezone-make-date-sortable (std11-field-body "date")))
(throw 'done t))))
(let ((date (elmo-date-get-datevec (elmo-filter-value term))))
(if (string<
(timezone-make-date-sortable (std11-field-body "date"))
- (timezone-make-sortable-date (aref date 0)
+ (timezone-make-sortable-date (aref date 0)
(aref date 1)
(aref date 2)
(timezone-make-time-string
- (aref date 3)
- (aref date 4)
+ (aref date 3)
+ (aref date 4)
(aref date 5))))
(throw 'done t))))
((eq (elmo-filter-type term) 'match)
(defvar elmo-msgid-replace-chars nil)
(defsubst elmo-replace-msgid-as-filename (msgid)
- "Replace message-id string as filename."
+ "Replace message-id string as filename."
(setq msgid (elmo-replace-in-string msgid " " " "))
(if (null elmo-msgid-replace-chars)
- (setq elmo-msgid-replace-chars
- (regexp-quote (mapconcat
+ (setq elmo-msgid-replace-chars
+ (regexp-quote (mapconcat
'car elmo-msgid-replace-string-alist ""))))
(while (string-match (concat "[" elmo-msgid-replace-chars "]")
msgid)
- (setq msgid (concat
+ (setq msgid (concat
(substring msgid 0 (match-beginning 0))
- (cdr (assoc
- (substring msgid
+ (cdr (assoc
+ (substring msgid
(match-beginning 0) (match-end 0))
elmo-msgid-replace-string-alist))
(substring msgid (match-end 0)))))
"Recover Message-ID from filename."
(let (tmp result)
(while (string-match " " filename)
- (setq tmp (substring filename
+ (setq tmp (substring filename
(match-beginning 0)
(+ (match-end 0) 1)))
(if (string= tmp " ")
(setq tmp " ")
- (setq tmp (car (rassoc tmp
+ (setq tmp (car (rassoc tmp
elmo-msgid-replace-string-alist))))
(setq result
- (concat result
+ (concat result
(substring filename 0 (match-beginning 0))
tmp))
(setq filename (substring filename (+ (match-end 0) 1))))
"Any element of list1 is deleted from list2."
(while list1
(setq list2 (delete (car list1) list2))
- (setq list1 (cdr list1)))
+ (setq list1 (cdr list1)))
list2)
(defun elmo-list-member (list1 list2)
(errobj error-object)
err-mes)
(while errobj
- (setq err-mes (concat err-mes (format
+ (setq err-mes (concat err-mes (format
(if (stringp (car errobj))
"%s"
(if (boundp 'nemacs-version)
cache-file)
(with-temp-buffer
(elmo-call-func folder "read-msg" number (current-buffer))
- (as-binary-output-file
+ (as-binary-output-file
(write-region (point-min) (point-max) cache-file nil 'no-msg)))))))
(defun elmo-prefetch-msg (folder msg outbuf msgdb)
"Read message into outbuf with cacheing."
(save-excursion
- (let* ((number-alist (elmo-msgdb-get-number-alist
+ (let* ((number-alist (elmo-msgdb-get-number-alist
(or msgdb (elmo-msgdb-load folder))))
(dir (elmo-msgdb-expand-path folder))
(message-id (cdr (assq msg number-alist)))
type
- cache-status
+ cache-status
ret-val part-num real-fld-num)
(set-buffer outbuf)
(if (elmo-cache-exists-p message-id)
folder msg))
(setq type (elmo-folder-get-type (car real-fld-num)))
(cond ((eq type 'imap4)
- (setq ret-val (elmo-imap4-prefetch-msg
+ (setq ret-val (elmo-imap4-prefetch-msg
(elmo-folder-get-spec (car real-fld-num))
- (cdr real-fld-num)
+ (cdr real-fld-num)
outbuf)))
((elmo-folder-local-p (car real-fld-num)))
- (t (setq ret-val (elmo-call-func (car real-fld-num)
- "read-msg"
+ (t (setq ret-val (elmo-call-func (car real-fld-num)
+ "read-msg"
(cdr real-fld-num) outbuf))))
(if ret-val
(elmo-cache-save message-id
(setq msgs (cdr msgs)))))
;; elmo-read-msg (folder msg outbuf msgdb)
-;;; read message
+;;; read message
(defun elmo-read-msg (folder msg outbuf msgdb &optional force-reload)
"Read message into outbuf."
(let ((inhibit-read-only t))
;; (elmo-read-msg-no-cache folder msg outbuf)
(elmo-read-msg-with-cache folder msg outbuf msgdb force-reload)))
-(defun elmo-read-msg-with-cache (folder msg outbuf msgdb
+(defun elmo-read-msg-with-cache (folder msg outbuf msgdb
&optional force-reload)
"Read message into outbuf with cacheing."
- (let* ((number-alist (elmo-msgdb-get-number-alist
+ (let* ((number-alist (elmo-msgdb-get-number-alist
(or msgdb (elmo-msgdb-load folder))))
(dir (elmo-msgdb-expand-path folder))
(message-id (cdr (assq msg number-alist)))
(type (elmo-folder-number-get-type folder msg))
- cache-status
+ cache-status
ret-val part-num real-fld-num)
(set-buffer outbuf)
(if (and (not force-reload)
(not (elmo-local-file-p folder msg)))
(setq ret-val (elmo-cache-read message-id folder msg)))
- (if ret-val
+ (if ret-val
t
;; cache doesn't exist.
(setq real-fld-num (elmo-get-real-folder-number
folder msg))
- (if (setq ret-val (elmo-call-func (car real-fld-num)
- "read-msg"
+ (if (setq ret-val (elmo-call-func (car real-fld-num)
+ "read-msg"
(cdr real-fld-num) outbuf))
(if (and message-id
(not (elmo-local-file-p folder msg))
(elmo-call-func dst-folder "copy-msgs"
msgs src-spec loc-alist same-number))))
-(defun elmo-move-msgs (src-folder msgs dst-folder
+(defun elmo-move-msgs (src-folder msgs dst-folder
&optional msgdb all done
no-delete-info
no-delete
dst-folder))
;; online and identical system...so copy 'em!
(unless
- (elmo-copy-msgs (car real-fld-num)
+ (elmo-copy-msgs (car real-fld-num)
(list (cdr real-fld-num))
- dst-folder
+ dst-folder
db
same-number)
(error "Copy message to %s failed" dst-folder))
(kill-buffer tmp-buf)
(if (and (not no-delete) ret-val)
(progn
- (if (not no-delete-info)
+ (if (not no-delete-info)
(message "Cleaning up src folder..."))
(if (and (elmo-delete-msgs src-folder ret-val db)
(elmo-msgdb-delete-msgs src-folder ret-val db t))
(elmo-call-func folder "search" condition from-msgs)
(elmo-cache-search-all folder condition from-msgs))))
-(defun elmo-msgdb-create (folder numlist new-mark already-mark
+(defun elmo-msgdb-create (folder numlist new-mark already-mark
seen-mark important-mark seen-list)
(if (elmo-folder-plugged-p folder)
- (elmo-call-func folder "msgdb-create" numlist new-mark already-mark
+ (elmo-call-func folder "msgdb-create" numlist new-mark already-mark
seen-mark important-mark seen-list)
(elmo-dop-msgdb-create folder numlist new-mark already-mark
seen-mark important-mark seen-list)))
(let ((folder-numbers (elmo-make-folder-numbers-list folder msgs))
type)
(while folder-numbers
- (if (or (eq
+ (if (or (eq
(setq type (car
- (elmo-folder-get-spec
+ (elmo-folder-get-spec
(car (car folder-numbers)))))
'imap4)
(memq type '(maildir internal)))
(elmo-call-func (car (car folder-numbers)) func-name
(cdr (car folder-numbers)))
(if elmo-enable-disconnected-operation
- (elmo-dop-call-func-on-msgs
+ (elmo-dop-call-func-on-msgs
(car (car folder-numbers)) ; real folder
- func-name
+ func-name
(cdr (car folder-numbers)) ; real number
msgdb)
(error "Unplugged"))))
(defun elmo-mark-as-unread (folder msgs msgdb)
(elmo-call-func-on-markable-msgs folder "mark-as-unread" msgs msgdb))
-(defun elmo-msgdb-create-as-numlist (folder numlist new-mark already-mark
+(defun elmo-msgdb-create-as-numlist (folder numlist new-mark already-mark
seen-mark important-mark seen-list)
(if (elmo-folder-plugged-p folder)
- (elmo-call-func folder "msgdb-create-as-numlist" numlist
+ (elmo-call-func folder "msgdb-create-as-numlist" numlist
new-mark already-mark seen-mark important-mark seen-list)
- (elmo-dop-msgdb-create-as-numlist
+ (elmo-dop-msgdb-create-as-numlist
folder numlist new-mark already-mark
seen-mark important-mark seen-list)))
(message "Loading msgdb for %s..." folder)
(let* ((path (elmo-msgdb-expand-path folder spec))
(overview (elmo-msgdb-overview-load path))
- (ret-val
+ (ret-val
(list overview
(elmo-msgdb-number-load path)
(elmo-msgdb-mark-load path)
(elmo-call-func folder "append-msg" string msg no-see)))))
(defun elmo-check-validity (folder)
- (elmo-call-func folder "check-validity"
+ (elmo-call-func folder "check-validity"
(expand-file-name
elmo-msgdb-validity-filename
(elmo-msgdb-expand-path folder))))
(error "pack-number not supported"))))
(defun elmo-sync-validity (folder)
- (elmo-call-func folder "sync-validity"
+ (elmo-call-func folder "sync-validity"
(expand-file-name
elmo-msgdb-validity-filename
(elmo-msgdb-expand-path folder))))
number-alist)
(defun elmo-generic-list-folder-unread (spec mark-alist unread-marks)
- (elmo-delete-if
+ (elmo-delete-if
'null
- (mapcar
+ (mapcar
(function (lambda (x)
(if (member (cadr (assq (car x) mark-alist)) unread-marks)
(car x))))
(let* ((numlist (elmo-msgdb-get-number-alist msgdb))
(len (length numlist))
new-numlist)
- (if (eq (length (setq
+ (if (eq (length (setq
new-numlist
(elmo-call-func folder "sync-number-alist" numlist)))
len)
"Available if elmo-local-file-p is t."
(elmo-call-func folder "get-msg-filename" number loc-alist))
-(defun elmo-strict-folder-diff (fld &optional number-alist)
+(defun elmo-strict-folder-diff (fld &optional number-alist)
(interactive)
(let* ((dir (elmo-msgdb-expand-path fld))
- (nalist (or number-alist
+ (nalist (or number-alist
(elmo-msgdb-number-load dir)))
(in-db (sort (mapcar 'car nalist) '<))
(in-folder (elmo-list-folder fld))
))
(setq append-list (car diff))
(setq delete-list (cadr diff))
- (if append-list
+ (if append-list
(length append-list)
(if delete-list
(- 0 (length delete-list))
(car overview)
(if (assoc (elmo-msgdb-overview-entity-get-id (car overview))
elmo-msgdb-global-mark-alist)
- (setq importants (cons
+ (setq importants (cons
(elmo-msgdb-overview-entity-get-number
(car overview))
importants)))
(elmo-multi-folder-diff fld))
((and (eq type 'filter)
(or (elmo-multi-p fld)
- (not
+ (not
(vectorp (nth 1 (elmo-folder-get-spec fld)))))
;; not partial...unsync number is unknown.
- (cons nil
- (cdr (elmo-folder-diff
+ (cons nil
+ (cdr (elmo-folder-diff
(nth 2 (elmo-folder-get-spec fld)))))))
((and (eq type 'imap4)
elmo-use-server-diff)
(elmo-call-func fld "server-diff")) ;; imap4 server side diff.
- (t
+ (t
(let ((cached-in-db-max (elmo-folder-get-info-max fld))
(in-folder (elmo-max-of-folder fld))
(in-db t)
(if (or number-alist
(not cached-in-db-max))
(let* ((dir (elmo-msgdb-expand-path fld))
- (nalist (or number-alist
+ (nalist (or number-alist
(elmo-msgdb-number-load dir))))
;; No info-cache.
(setq in-db (sort (mapcar 'car nalist) '<))
;; Number-alist is not used.
(elmo-folder-set-info-hashtb fld in-db-max
nil))
-;; (or
-;; (and in-db (length in-db))
+;; (or
+;; (and in-db (length in-db))
;; 0)))
)
;; info-cache exists.
(setq in-db-max cached-in-db-max))
- (setq unsync (if (and in-db
+ (setq unsync (if (and in-db
(car in-folder))
(- (car in-folder) in-db-max)
(if (and in-folder
(* elmo-multi-divide-number cur-number))
elmo-multi-divide-number)))
(setq one-alist (nconc
- one-alist
+ one-alist
(list
(cons
(% num (* elmo-multi-divide-number cur-number))
(defun elmo-multi-folder-diff (fld)
(let ((flds (cdr (elmo-folder-get-spec fld)))
(num-alist-list
- (elmo-multi-get-number-alist-list
+ (elmo-multi-get-number-alist-list
(elmo-msgdb-number-load (elmo-msgdb-expand-path fld))))
(count 0)
diffs (unsync 0) (nomif 0))
(while flds
- (setq diffs (nconc diffs (list (elmo-folder-diff (car flds)
- (nth count
+ (setq diffs (nconc diffs (list (elmo-folder-diff (car flds)
+ (nth count
num-alist-list)
))))
(setq count (+ 1 count))
((eq type 'multi)
(elmo-multi-get-real-folder-number folder number))
((eq type 'pipe)
- (elmo-get-real-folder-number
+ (elmo-get-real-folder-number
(elmo-pipe-spec-dst (elmo-folder-get-spec folder) )
number))
((eq type 'filter)
(let ((cur-spec (elmo-folder-get-spec folder)))
(catch 'done
(while cur-spec
- (cond
+ (cond
((eq (car cur-spec) 'filter)
(setq cur-spec (elmo-folder-get-spec (nth 2 cur-spec))))
((eq (car cur-spec) 'pipe)
(defun elmo-folder-contains-type (folder type)
(let ((spec (elmo-folder-get-spec folder)))
- (cond
+ (cond
((eq (car spec) 'filter)
(elmo-folder-contains-type (nth 2 spec) type))
((eq (car spec) 'pipe)
(mm-define-backend elmo (buffer))
(mm-define-method initialize-instance ((entity elmo))
- (mime-entity-set-buffer-internal
+ (mime-entity-set-buffer-internal
entity
(get-buffer-create (concat mmelmo-entity-buffer-name "0")))
(save-excursion
(setq header-start (point-min))
(setq body-end (point-max))
(goto-char header-start)
- (if (re-search-forward
+ (if (re-search-forward
(concat "^" (regexp-quote mail-header-separator) "$\\|^$" )
nil t)
(setq header-end (match-beginning 0)
(let ((i (length node-id))
result)
(while (> i 0)
- (setq result
- (concat result
- (if result
- (concat "." (int-to-string
+ (setq result
+ (concat result
+ (if result
+ (concat "." (int-to-string
(+ 1 (nth (- i 1) node-id))))
- (int-to-string (or
+ (int-to-string (or
(+ 1 (nth (- i 1) node-id))
0)))))
(setq i (- i 1)))
)
(mime-entity-set-children-internal ret-val children)
(setq content-type (list (cons 'type 'multipart)))
- (setq content-type (append content-type
- (list (cons 'subtype
- (intern
+ (setq content-type (append content-type
+ (list (cons 'subtype
+ (intern
(downcase (car entity)))))))
- (setq content-type (append content-type
+ (setq content-type (append content-type
(mime-parse-parameters-from-list
(elmo-imap4-nth 1 entity))))
(mime-entity-set-content-type-internal ret-val content-type)
ret-val))
(t ;; singlepart
(let (content-type result)
- ;; append size information into location
+ ;; append size information into location
(setq location (append location (list (nth 6 entity))))
(setq content-type (list (cons 'type (intern (downcase (car entity))))))
(if (elmo-imap4-nth 1 entity)
(setq content-type (append content-type
- (list
- (cons 'subtype
- (intern
+ (list
+ (cons 'subtype
+ (intern
(downcase
(elmo-imap4-nth 1 entity))))))))
(if (elmo-imap4-nth 2 entity)
- (setq content-type (append content-type
+ (setq content-type (append content-type
(mime-parse-parameters-from-list
(elmo-imap4-nth 2 entity)))))
(setq result (make-mime-entity-internal 'elmo-imap4
location
content-type ; content-type
nil ; children
- parent ; parent
+ parent ; parent
node-id ; node-id
))
- (mime-entity-set-encoding-internal result
+ (mime-entity-set-encoding-internal result
(and (elmo-imap4-nth 5 entity)
- (downcase
+ (downcase
(elmo-imap4-nth 5 entity))))
result))))
(when (search-forward "FETCH" nil t)
(narrow-to-region (match-end 0) (point-max))
(while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t)
- (goto-char (+ (point)
+ (goto-char (+ (point)
(string-to-int (elmo-match-buffer 1))))
(setq str (buffer-substring (match-end 0) (point)))
(delete-region (match-beginning 0) (point))
(insert (prin1-to-string str))); (insert "\""))
- (setq entity
- (nth 1 (memq 'BODYSTRUCTURE
+ (setq entity
+ (nth 1 (memq 'BODYSTRUCTURE
(read (buffer-string)))))
(set-buffer raw-buffer)
(mmelmo-imap4-parse-bodystructure-entity location nil entity nil)
(save-excursion
(when (not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-mailbox spec)))
- (if (null (setq response
- (elmo-imap4-select-folder
+ (if (null (setq response
+ (elmo-imap4-select-folder
(elmo-imap4-spec-mailbox spec) connection)))
(error "Select folder failed")))
(elmo-imap4-send-command (process-buffer process)
process
- (format "uid fetch %s bodystructure"
+ (format "uid fetch %s bodystructure"
msg))
(if (null (setq response (elmo-imap4-read-contents
(process-buffer process) process)))
(error "Fetching body structure failed")))
- (mmelmo-imap4-parse-bodystructure-string location
+ (mmelmo-imap4-parse-bodystructure-string location
response); make mime-entity
))))
(if (or (not mmelmo-imap4-threshold)
(not (nth 4 location))
(and (nth 4 location)
- mmelmo-imap4-threshold
+ mmelmo-imap4-threshold
(<= (nth 4 location) mmelmo-imap4-threshold)))
(cond ((mmelmo-imap4-multipart-p entity)) ; noop
(t
- (insert (elmo-imap4-read-part
+ (insert (elmo-imap4-read-part
(nth 0 location)
(nth 1 location)
- (mmelmo-imap4-node-id-to-string
+ (mmelmo-imap4-node-id-to-string
(nth 3 location))))
(mime-entity-set-body-start-internal entity (point-min))
(mime-entity-set-body-end-internal entity (point-max))))
- (setq mmelmo-imap4-skipped-parts
+ (setq mmelmo-imap4-skipped-parts
(append
mmelmo-imap4-skipped-parts
- (list (mmelmo-imap4-node-id-to-string
+ (list (mmelmo-imap4-node-id-to-string
(nth 3 location)))))))
(defun mmelmo-imap4-read-body (entity)
(if (or (not mmelmo-imap4-threshold)
(not (nth 4 location))
(and (nth 4 location)
- mmelmo-imap4-threshold
+ mmelmo-imap4-threshold
(<= (nth 4 location) mmelmo-imap4-threshold)))
(insert (elmo-imap4-read-part (nth 0 location)
(nth 1 location)
"1"
))
- (setq mmelmo-imap4-skipped-parts
+ (setq mmelmo-imap4-skipped-parts
(append
mmelmo-imap4-skipped-parts
- (list
- (mmelmo-imap4-node-id-to-string
+ (list
+ (mmelmo-imap4-node-id-to-string
(nth 3 location))))))))
;;; mm-backend definitions for elmo-imap4
(mm-define-backend elmo-imap4 (elmo))
(mm-define-method initialize-instance ((entity elmo-imap4))
- (let ((new-entity (mmelmo-imap4-get-mime-entity
+ (let ((new-entity (mmelmo-imap4-get-mime-entity
(mime-entity-location-internal entity))))
;; ...
(aset entity 1
(mime-entity-location-internal new-entity))
- (mime-entity-set-content-type-internal
+ (mime-entity-set-content-type-internal
entity
(mime-entity-content-type-internal new-entity))
- (mime-entity-set-encoding-internal
+ (mime-entity-set-encoding-internal
entity
(mime-entity-encoding-internal new-entity))
(mime-entity-set-children-internal
(mime-entity-body-end-internal new-entity))))
(mm-define-method entity-buffer ((entity elmo-imap4))
- (let ((buffer (get-buffer-create
+ (let ((buffer (get-buffer-create
(concat mmelmo-entity-buffer-name
- (mmelmo-imap4-node-id-to-string
+ (mmelmo-imap4-node-id-to-string
(mime-entity-node-id-internal entity)))))
(location (mime-entity-location-internal entity)))
(set-buffer buffer)
(mm-define-method fetch-field ((entity elmo-imap4) field-name)
(save-excursion
(let ((buf (mime-entity-buffer-internal entity)))
- (when buf
+ (when buf
(set-buffer buf)
(save-restriction
(if (and (mime-entity-header-start-internal entity)
(mime-entity-header-end-internal entity))
(progn
- (narrow-to-region
+ (narrow-to-region
(mime-entity-header-start-internal entity)
(mime-entity-header-end-internal entity))
(std11-fetch-field field-name))
(let ((i (length node-id))
result)
(while (> i 0)
- (setq result
- (concat result
- (if result
- (concat "." (int-to-string
+ (setq result
+ (concat result
+ (if result
+ (concat "." (int-to-string
(+ 1 (nth (- i 1) node-id))))
- (int-to-string (or
+ (int-to-string (or
(+ 1 (nth (- i 1) node-id))
0)))))
(setq i (- i 1)))
(or result "0")))
;; parse IMAP4 body structure entity recursively.
-(defun mmelmo-imap4-parse-bodystructure-object (folder
+(defun mmelmo-imap4-parse-bodystructure-object (folder
number msgdb
node-id object parent)
(cond
(mime-entity-set-children-internal ret-val children)
(setq content-type (list (cons 'type 'multipart)))
(if (elmo-imap4-nth 0 object)
- (setq content-type (append content-type
- (list (cons 'subtype
- (intern
+ (setq content-type (append content-type
+ (list (cons 'subtype
+ (intern
(downcase
(elmo-imap4-nth
0
object))))))))
- (setq content-type (append content-type
+ (setq content-type (append content-type
(mime-parse-parameters-from-list
(elmo-imap4-nth 1 object))))
(mime-entity-set-content-type-internal ret-val content-type)
(setq content-type (list (cons 'type (intern (downcase (car object))))))
(if (elmo-imap4-nth 1 object)
(setq content-type (append content-type
- (list
- (cons 'subtype
- (intern
+ (list
+ (cons 'subtype
+ (intern
(downcase
(elmo-imap4-nth 1 object))))))))
(if (elmo-imap4-nth 2 object)
- (setq content-type (append content-type
+ (setq content-type (append content-type
(mime-parse-parameters-from-list
(elmo-imap4-nth 2 object)))))
- (setq ret-val
+ (setq ret-val
(luna-make-entity
(mm-expand-class-name 'elmo-imap4)
:folder folder
:node-id node-id))
(mime-entity-set-encoding-internal ret-val
(and (elmo-imap4-nth 5 object)
- (downcase
+ (downcase
(elmo-imap4-nth 5 object))))
ret-val))))
(elmo-imap4-response-value
(elmo-imap4-send-command-wait
session
- (format
+ (format
(if elmo-imap4-use-uid
"uid fetch %s bodystructure"
"fetch %s bodystructure")
mmelmo-imap4-threshold)))
(progn
(cond ((mmelmo-imap4-multipart-p entity)) ; noop
- (t (insert (elmo-imap4-read-part
+ (t (insert (elmo-imap4-read-part
(mime-elmo-entity-folder-internal entity)
(mime-elmo-entity-number-internal entity)
- (mmelmo-imap4-node-id-to-string
+ (mmelmo-imap4-node-id-to-string
(mime-entity-node-id-internal entity))))))
(setq mmelmo-imap4-fetched t)
(mime-buffer-entity-set-body-start-internal entity (point-min))
(setq mmelmo-imap4-fetched nil)
(mime-buffer-entity-set-body-start-internal entity (point-min))
(mime-buffer-entity-set-body-end-internal entity (point-min))
- (setq mmelmo-imap4-skipped-parts
+ (setq mmelmo-imap4-skipped-parts
(append
mmelmo-imap4-skipped-parts
- (list (mmelmo-imap4-node-id-to-string
+ (list (mmelmo-imap4-node-id-to-string
(mime-entity-node-id-internal entity)))))))
(defun mmelmo-imap4-insert-body (entity)
(if (or (not mmelmo-imap4-threshold)
(not (mime-elmo-entity-size-internal entity))
(and (mime-elmo-entity-size-internal entity)
- mmelmo-imap4-threshold
+ mmelmo-imap4-threshold
(<= (mime-elmo-entity-size-internal entity)
mmelmo-imap4-threshold)))
(insert (elmo-imap4-read-part
(mime-elmo-entity-folder-internal entity)
(mime-elmo-entity-number-internal entity) "1"))
- (setq mmelmo-imap4-skipped-parts
+ (setq mmelmo-imap4-skipped-parts
(append
mmelmo-imap4-skipped-parts
- (list (mmelmo-imap4-node-id-to-string
+ (list (mmelmo-imap4-node-id-to-string
(mime-entity-node-id-internal entity)))))))
;;; mime-elmo-imap4-entity class definitions.
(luna-define-method initialize-instance ((entity mime-elmo-imap4-entity)
&rest init-args)
"The initialization method for elmo-imap4.
-mime-elmo-entity has its own instance variable
+mime-elmo-entity has its own instance variable
`imap', `folder', `msgdb', and `size'.
-These value must be specified as argument for `luna-make-entity'."
+These value must be specified as argument for `luna-make-entity'."
(apply (car (luna-class-find-functions
(luna-find-class 'standard-object)
'initialize-instance))
(mime-buffer-entity-buffer-internal entity))
;; No buffer exist.
(save-excursion
- (set-buffer (get-buffer-create
+ (set-buffer (get-buffer-create
(concat mmelmo-entity-buffer-name
- (mmelmo-imap4-node-id-to-string
+ (mmelmo-imap4-node-id-to-string
(mime-entity-node-id-internal entity)))))
(mmelmo-original-mode)
(mime-buffer-entity-set-buffer-internal entity (current-buffer))
(setq mime-message-structure entity)
(setq mmelmo-imap4-skipped-parts nil)
;; insert header
- (insert (elmo-imap4-read-part
+ (insert (elmo-imap4-read-part
(mime-elmo-entity-folder-internal entity)
(mime-elmo-entity-number-internal entity)
"header"))
- (mime-buffer-entity-set-header-start-internal
+ (mime-buffer-entity-set-header-start-internal
entity (point-min))
(mime-buffer-entity-set-header-end-internal
entity (max (- (point) 1) 1))
(if (null (mime-entity-children-internal entity))
(progn
- (mime-buffer-entity-set-body-start-internal
+ (mime-buffer-entity-set-body-start-internal
entity (point))
;; insert body if size is OK.
(mmelmo-imap4-insert-body entity)
- (mime-buffer-entity-set-body-end-internal
+ (mime-buffer-entity-set-body-end-internal
entity (point)))))
- (setq mime-message-structure
+ (setq mime-message-structure
mmelmo-imap4-current-message-structure)
(mmelmo-imap4-read-part entity)))
(current-buffer))))
; mime-entity-children
;; override generic function for dynamic body fetching.
-(luna-define-method mime-entity-body ((entity
+(luna-define-method mime-entity-body ((entity
mime-elmo-imap4-entity))
(save-excursion
(set-buffer (mmelmo-imap4-mime-entity-buffer entity))
(buffer-substring (mime-buffer-entity-body-start-internal entity)
(mime-buffer-entity-body-end-internal entity))))
-(luna-define-method mime-entity-content ((entity
+(luna-define-method mime-entity-content ((entity
mime-elmo-imap4-entity))
(save-excursion
(set-buffer (mmelmo-imap4-mime-entity-buffer entity))
(mime-buffer-entity-body-end-internal entity))
(mime-entity-encoding entity))))
-(luna-define-method mime-entity-fetch-field ((entity mime-elmo-imap4-entity)
+(luna-define-method mime-entity-fetch-field ((entity mime-elmo-imap4-entity)
field-name)
(save-excursion
(save-restriction
(if (and (mime-buffer-entity-header-start-internal entity)
(mime-buffer-entity-header-end-internal entity))
(progn
- (narrow-to-region
+ (narrow-to-region
(mime-buffer-entity-header-start-internal entity)
(mime-buffer-entity-header-end-internal entity))
(std11-fetch-field field-name))
nil)))))
(luna-define-method mime-insert-header ((entity mime-elmo-imap4-entity)
- &optional invisible-fields
+ &optional invisible-fields
visible-fields)
(mmelmo-insert-sorted-header-from-buffer
(mmelmo-imap4-mime-entity-buffer entity)
(mmelmo-imap4-mime-entity-buffer entity))
(message "Fetching skipped part...done.")))
(with-current-buffer (mime-buffer-entity-buffer-internal entity)
- (mime-write-decoded-region
+ (mime-write-decoded-region
(mime-buffer-entity-body-start-internal entity)
(mime-buffer-entity-body-end-internal entity)
filename
(if (not ret-val)
(save-excursion
(set-buffer (setq ret-val
- (get-buffer-create
+ (get-buffer-create
(concat mmelmo-entity-buffer-name "0"))))
(mmelmo-original-mode)))
ret-val))
(kill-buffer x)))
(mapcar 'buffer-name (buffer-list))))
-(defun mmelmo-insert-sorted-header-from-buffer (buffer
+(defun mmelmo-insert-sorted-header-from-buffer (buffer
start end
&optional invisible-fields
visible-fields
;;; LDAP primitive functions.
;;
-;; LDAP object is
+;; LDAP object is
;; (__ldap-object HOSTNAME PLIST)
(defun ldapp (object)
ldap-verbose))
(ldap-close ldap)
(with-temp-buffer
- (set-buffer-multibyte nil)
+ (set-buffer-multibyte nil)
(if ldap-ignore-attribute-codings
result
(mapcar (function