(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))))
(setq i (1+ i))
(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)))
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 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))
msgs)
- (cond
+ (cond
((vectorp filter)
(cond ((string= (elmo-filter-key filter)
"last")
(setq msgs (elmo-list-folder folder))
- (nthcdr (max (- (length msgs)
+ (nthcdr (max (- (length msgs)
(string-to-int (elmo-filter-value filter)))
0)
msgs))
(setq msgs (elmo-list-folder folder))
(let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
msgs)))
- (mapcar '(lambda (x)
+ (mapcar '(lambda (x)
(delete x msgs)) rest))
msgs)))
((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))
(defvar elmo-imap4-lock nil)
-;; 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*\"")
(defsubst elmo-imap4-debug (message &rest args)
(insert string)
(goto-char (point-min))
;; XXX This doesn't consider literal name response.
- (while (re-search-forward
+ (while (re-search-forward
"\\* LIST (\\([^)]*\\)) \"[^\"]*\" \\([^\n]*\\)$" nil t)
(unless (string-match "noselect"
(elmo-match-buffer 1))
(setq val (elmo-match-buffer 2))
(if (string-match "^\"\\(.*\\)\"$" val)
- (setq val (match-string 1 val)))
- (setq mailbox-list
- (append mailbox-list
+ (setq val (match-string 1 val)))
+ (setq mailbox-list
+ (append mailbox-list
(list val)))))
mailbox-list)))
;; Append delimiter
(if (and root
(not (string= root ""))
- (not (string-match (concat "\\(.*\\)"
+ (not (string-match (concat "\\(.*\\)"
(regexp-quote delim)
"\\'")
root)))
(setq root (concat root delim)))
- (elmo-imap4-send-command (process-buffer process)
+ (elmo-imap4-send-command (process-buffer process)
process
(format "list \"%s\" *" root))
(setq response (elmo-imap4-read-response (process-buffer process)
(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)))))
(unless (eq (setq ssl (elmo-imap4-spec-ssl spec))
elmo-default-imap4-ssl)
(setq append-serv (concat append-serv "!"))))
(mapcar '(lambda (fld)
(concat "%" (elmo-imap4-decode-folder-string fld)
- (and append-serv
+ (and append-serv
(eval append-serv))))
result))))
(elmo-imap4-spec-folder spec)))
(setq response (elmo-imap4-read-response (process-buffer process)
process))
- (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)
user-at-host-on-port)
(if (not (elmo-plugged-p server port))
(error "Unplugged"))
- (setq user-at-host-on-port
+ (setq user-at-host-on-port
(concat user-at-host ":" (int-to-string port)
(if (eq ssl 'starttls) "!!" (if ssl "!"))))
(setq ret-val (assoc user-at-host-on-port
elmo-imap4-connection-cache))
- (if (and ret-val
- (or (eq (setq proc-stat
- (process-status (cadr (cdr ret-val))))
+ (if (and ret-val
+ (or (eq (setq proc-stat
+ (process-status (cadr (cdr ret-val))))
'closed)
(eq proc-stat 'exit)))
;; connection is closed...
(progn
(kill-buffer (car (cdr ret-val)))
- (setq elmo-imap4-connection-cache
+ (setq elmo-imap4-connection-cache
(delete ret-val elmo-imap4-connection-cache))
(setq ret-val nil)))
(if ret-val
- (progn
+ (progn
(setq ret-val (cdr ret-val)) ;; connection cache exists.
ret-val)
(setq result
(elmo-remove-passwd user-at-host)
(delete-process process)
(error "Login failed"))
- (setq elmo-imap4-connection-cache
- (append elmo-imap4-connection-cache
- (list
+ (setq elmo-imap4-connection-cache
+ (append elmo-imap4-connection-cache
+ (list
(cons user-at-host-on-port
- (setq ret-val (list buffer process
+ (setq ret-val (list buffer process
""; current-folder..
))))))
ret-val)))
(defun elmo-imap4-process-filter (process output)
- (save-match-data
+ (save-match-data
(with-current-buffer (process-buffer process)
(goto-char (point-max))
(insert output)
(forward-line -1)
(beginning-of-line)
- (if (looking-at (concat
- "\\(^"
- elmo-imap4-seq-prefix
+ (if (looking-at (concat
+ "\\(^"
+ elmo-imap4-seq-prefix
(int-to-string elmo-imap4-seqno)
"\\|^\\* OK\\|^\\* BYE\\'\\|^\\+\\)[^\n]*\n\\'"))
(progn
(setq response-string
(buffer-substring elmo-imap4-read-point (- match-end 2)))
(goto-char elmo-imap4-read-point)
- (if (looking-at (format "%s[0-9]+ OK.*$\\|\\+.*$"
+ (if (looking-at (format "%s[0-9]+ OK.*$\\|\\+.*$"
elmo-imap4-seq-prefix))
(progn (setq response-continue nil)
(setq elmo-imap4-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 (format "\\(. BYE.*\\|%s[0-9]+ \\(NO\\|BAD\\).*\\)$"
+ (if (looking-at (format "\\(. BYE.*\\|%s[0-9]+ \\(NO\\|BAD\\).*\\)$"
elmo-imap4-seq-prefix))
(progn (setq response-continue nil)
(setq elmo-imap4-read-point match-end)
(setq elmo-imap4-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-imap4-read-point match-end)))
(response-string nil)
match-end)
(goto-char elmo-imap4-read-point)
- (while (not (re-search-forward
- (format "%s[0-9]+ \\(NO\\|BAD\\|OK\\).*$"
+ (while (not (re-search-forward
+ (format "%s[0-9]+ \\(NO\\|BAD\\|OK\\).*$"
elmo-imap4-seq-prefix)
nil t))
(accept-process-output process)
(goto-char elmo-imap4-read-point))
(beginning-of-line)
(setq match-end (point))
- (setq response-string (buffer-substring
+ (setq response-string (buffer-substring
elmo-imap4-read-point match-end))
(if (eq (length response-string) 0)
nil
(with-current-buffer buffer
(setq start elmo-imap4-read-point)
(while (< (point-max) (+ start bytes))
- (accept-process-output process))
+ (accept-process-output process))
(with-current-buffer outbuf
(erase-buffer)
(insert-buffer-substring buffer start (+ start bytes))
(let ((buffer (car connection))
(process (cadr connection)))
(save-excursion
- (elmo-imap4-send-command buffer
+ (elmo-imap4-send-command buffer
process "noop")
(elmo-imap4-read-response buffer process))))
(let ((connection (elmo-imap4-get-connection spec))
response ret-val beg end)
(and (not (null (elmo-imap4-spec-folder spec)))
- (if (not (string= (elmo-imap4-connection-get-cwf connection)
+ (if (not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (if (null (setq response
- (elmo-imap4-select-folder
+ (if (null (setq response
+ (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec)
connection)))
(error "Select folder failed"))
(if elmo-imap4-use-select-to-update-status
- (elmo-imap4-select-folder
+ (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec)
- connection)
+ connection)
(elmo-imap4-check connection)))))))
(defun elmo-imap4-check (connection)
(let ((process (elmo-imap4-connection-get-process connection)))
(save-excursion
- (elmo-imap4-send-command (process-buffer process)
+ (elmo-imap4-send-command (process-buffer process)
process "check")
(elmo-imap4-read-response (process-buffer process) process))))
(unwind-protect
(progn
(elmo-imap4-send-command (process-buffer process)
- process (format "select \"%s\""
+ process (format "select \"%s\""
folder))
- (setq response (elmo-imap4-read-response
+ (setq response (elmo-imap4-read-response
(process-buffer process) process)))
(if (null response)
(progn
response)
(save-excursion
(elmo-imap4-send-command (process-buffer process)
- process
- (format "status \"%s\" (uidvalidity)"
+ process
+ (format "status \"%s\" (uidvalidity)"
(elmo-imap4-spec-folder spec)))
- (setq response (elmo-imap4-read-response
+ (setq response (elmo-imap4-read-response
(process-buffer process) process))
(if (string-match "UIDVALIDITY \\([0-9]+\\)" response)
(string= (elmo-get-file-string validity-file)
response)
(save-excursion
(elmo-imap4-send-command (process-buffer process)
- process
- (format "status \"%s\" (uidvalidity)"
+ process
+ (format "status \"%s\" (uidvalidity)"
(elmo-imap4-spec-folder spec)))
- (setq response (elmo-imap4-read-response
+ (setq response (elmo-imap4-read-response
(process-buffer process) process))
(if (string-match "UIDVALIDITY \\([0-9]+\\)" response)
(progn
(and (elmo-imap4-spec-folder spec)
(if (not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (if (null (setq response
- (elmo-imap4-select-folder
+ (if (null (setq response
+ (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec)
connection)))
(error "Select folder failed"))
;; for status update.
(if elmo-imap4-use-select-to-update-status
- (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
+ (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
connection)
(unless (elmo-imap4-check connection)
;; Check failed...not selected??
- (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
+ (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
connection)))))
(elmo-imap4-send-command (process-buffer process)
process
- (format (if elmo-imap4-use-uid
+ (format (if elmo-imap4-use-uid
"uid search %s"
"search %s") str))
(setq response (elmo-imap4-read-response (process-buffer process)
(if (string-match "\n" response)
(progn
(setq end (match-end 0))
- (setq ret-val (read (concat "(" (substring
- response
+ (setq ret-val (read (concat "(" (substring
+ response
0 end) ")"))))
(error "SEARCH failed"))))
ret-val)))
(string= "before" search-key))
(setq search-key (concat "sent" search-key))
(elmo-imap4-send-command buffer process
- (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))))))
(t
- (setq word (encode-mime-charset-string (elmo-filter-value filter)
+ (setq word (encode-mime-charset-string (elmo-filter-value filter)
elmo-search-mime-charset))
- (elmo-imap4-send-command buffer process
- (format
+ (elmo-imap4-send-command buffer process
+ (format
(if elmo-imap4-use-uid
- "uid search CHARSET %s%s %s {%d}"
+ "uid search CHARSET %s%s %s {%d}"
" search CHARSET %s%s %s {%d}")
(symbol-name elmo-search-mime-charset)
(if (eq (elmo-filter-type filter) 'unmatch)
(if (and (elmo-imap4-spec-folder spec)
(not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (null (elmo-imap4-select-folder
+ (null (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec) connection)))
(error "Select folder failed"))
(while condition
(setq ret-val (nconc ret-val response))
(setq condition (cdr condition)))
(if from-msgs
- (elmo-list-filter
+ (elmo-list-filter
from-msgs
(elmo-uniq-list (sort ret-val '<)))
(elmo-uniq-list (sort ret-val '<))))))
(t
(concat mbox "@" host))))
-(static-cond
+(static-cond
((fboundp 'float)
;; Emacs can parse dot symbol.
(defvar elmo-imap4-rfc822-size "RFC822\.SIZE")
(defvar elmo-imap4-header-fields "HEADER\.FIELDS")
(defmacro elmo-imap4-replace-dot-symbols ()) ;; noop
)
- (t
+ (t
;; Cannot parse dot symbol, replace it.
(defvar elmo-imap4-rfc822-size "RFC822_SIZE")
(defvar elmo-imap4-header-fields "HEADER_FIELDS")
(goto-char (point-min))
(while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t)
(let (str)
- (goto-char (+ (point)
+ (goto-char (+ (point)
(string-to-int (elmo-match-buffer 1))))
- (setq str (save-match-data
- (elmo-replace-in-string
+ (setq str (save-match-data
+ (elmo-replace-in-string
(buffer-substring (match-end 0) (point))
"\r" "")))
(delete-region (match-beginning 0) (point))
(insert string)
(goto-char (point-min))
(setq beg (point))
- (if (re-search-forward "^\* \\([0-9]+\\) FETCH"
+ (if (re-search-forward "^\* \\([0-9]+\\) FETCH"
nil t)
(progn
(setq beg (point))
(unless elmo-imap4-use-uid
(setq number (string-to-int (elmo-match-buffer 1))))
- (while (re-search-forward
- "^\* \\([0-9]+\\) FETCH"
+ (while (re-search-forward
+ "^\* \\([0-9]+\\) FETCH"
nil t)
(setq attr (elmo-imap4-make-attributes-object
(buffer-substring beg (match-beginning 0))))
((eq sym 'BODY)
(setq extra-fields (elmo-collect-field-from-string value t)))
((eq sym 'ENVELOPE)
- ;; According to rfc2060,
+ ;; According to rfc2060,
;; 0 date, 1 subject, 2 from, 3 sender,
;; 4 reply-to, 5 to, 6 cc, 7 bcc, 8 in-reply-to, 9 message-id.
(setq date-string (elmo-imap4-nth 0 value))
(and (or (elmo-imap4-nth 0 from-list)
(elmo-imap4-nth 2 from-list)
(elmo-imap4-nth 3 from-list))
- (elmo-delete-char
+ (elmo-delete-char
?\"
(elmo-imap4-make-address
(elmo-imap4-nth 0 from-list)
(elmo-imap4-nth 0 cc)
(elmo-imap4-nth 2 cc)
(elmo-imap4-nth 3 cc)))
- (elmo-imap4-nth 6 value) ","))
+ (elmo-imap4-nth 6 value) ","))
(setq reference (elmo-msgdb-get-last-message-id
(elmo-imap4-nth 8 value)))
(setq message-id (elmo-imap4-nth 9 value)))))
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 (and (elmo-imap4-spec-folder spec)
(not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (null (elmo-imap4-select-folder
+ (null (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec) connection)))
(error "Select folder failed"))
(setq set-list (elmo-imap4-make-number-set-list msg-list))
(when set-list
(elmo-imap4-send-command (process-buffer process)
process
- (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))
(unless (elmo-imap4-read-response (process-buffer process) process)
(error "Store %s flag failed" mark))
(unless no-expunge
- (elmo-imap4-send-command
+ (elmo-imap4-send-command
(process-buffer process) process "expunge")
(unless (elmo-imap4-read-response (process-buffer process) process)
(error "Expunge failed"))))
(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
seen-mark important-mark seen-list t))
-(defun elmo-imap4-msgdb-create (spec numlist new-mark already-mark seen-mark
+(defun elmo-imap4-msgdb-create (spec numlist new-mark already-mark seen-mark
important-mark seen-list &optional as-num)
"Create msgdb for SPEC."
(when numlist
(error "No IMAP4 capability!!")))))
(setq count 0)
(setq length (length numlist))
- (setq set-list (elmo-imap4-make-number-set-list
+ (setq set-list (elmo-imap4-make-number-set-list
numlist
elmo-imap4-overview-fetch-chop-length))
(message "Getting overview...")
(if (and (elmo-imap4-spec-folder spec)
(not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (null (elmo-imap4-select-folder
+ (null (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec) connection)))
- (error "Select imap folder %s failed"
+ (error "Select imap folder %s failed"
(elmo-imap4-spec-folder spec)))
(while set-list
- (elmo-imap4-send-command
+ (elmo-imap4-send-command
(process-buffer process)
process
;; get overview entity from IMAP4
- (format
+ (format
(if rfc2060
(concat
(if elmo-imap4-use-uid "uid " "")
(with-current-buffer (process-buffer process)
(if ov-str
(setq ret-val
- (elmo-msgdb-append
+ (elmo-msgdb-append
ret-val
- (elmo-imap4-create-msgdb-from-overview-string
+ (elmo-imap4-create-msgdb-from-overview-string
ov-str
(elmo-imap4-spec-folder spec)
new-mark already-mark seen-mark important-mark
(setq ov-str (elmo-imap4-read-contents (process-buffer process)
process))
(elmo-display-progress
- 'elmo-imap4-msgdb-create "Getting overview..."
+ 'elmo-imap4-msgdb-create "Getting overview..."
(/ (* count 100) length))
(setq set-list (cdr set-list)))
;; process last one.
(with-current-buffer (process-buffer process)
(if ov-str
(setq ret-val
- (elmo-msgdb-append
+ (elmo-msgdb-append
ret-val
- (elmo-imap4-create-msgdb-from-overview-string
- ov-str
+ (elmo-imap4-create-msgdb-from-overview-string
+ ov-str
(elmo-imap4-spec-folder spec)
new-mark already-mark seen-mark important-mark
seen-list filter)))))
(setq prefix (elmo-imap4-nth 0 (car cur)))
(setq delim (elmo-imap4-nth 1 (car cur)))
(if (and prefix delim
- (string-match (concat "\\(.*\\)"
+ (string-match (concat "\\(.*\\)"
(regexp-quote delim)
"\\'")
prefix))
(length (car y))))))))
(defun elmo-imap4-open-connection (imap4-server user auth port passphrase ssl)
- "Open Imap connection and returns
+ "Open Imap connection and returns
the list of (process session-buffer current-working-folder).
Return nil if connection failed."
(let ((process nil)
(get-buffer-create (format " *IMAP session to %s:%d" host port)))
(save-excursion
(set-buffer process-buffer)
- (elmo-set-buffer-multibyte nil)
+ (elmo-set-buffer-multibyte nil)
(make-variable-buffer-local 'elmo-imap4-server-capability)
(make-variable-buffer-local 'elmo-imap4-lock)
(erase-buffer))
(setq response
(elmo-imap4-read-response process-buffer process)))
- (string-match
- (concat "^\\(" elmo-imap4-seq-prefix
+ (string-match
+ (concat "^\\(" elmo-imap4-seq-prefix
(int-to-string elmo-imap4-seqno)
"\\|\\*\\) OK")
response))
(and (string= "digest-md5" auth)
(not (memq 'auth=digest-md5 capability))))
(if (or elmo-imap4-force-login
- (y-or-n-p
- (format
+ (y-or-n-p
+ (format
"There's no %s capability in server. continue?" auth)))
(setq auth "login")
(error "Login aborted")))
- (cond
+ (cond
((string= "auth" auth)
(elmo-imap4-send-command
process-buffer process "authenticate login" 'no-lock)
- ;; Base64
+ ;; Base64
(when (null (elmo-imap4-read-response process-buffer process t))
(setq ret-val (cons nil process))
(throw 'done nil))
(throw 'done nil))
(setq ret-val (cons process-buffer process)))
((string= "cram-md5" auth)
- (elmo-imap4-send-command
+ (elmo-imap4-send-command
process-buffer process "authenticate cram-md5" 'no-lock)
- (when (null (setq response
- (elmo-imap4-read-response
+ (when (null (setq response
+ (elmo-imap4-read-response
process-buffer process t)))
(setq ret-val (cons nil process))
(throw 'done nil))
(setq response (cadr (split-string response " ")))
(elmo-imap4-send-string
- process-buffer process
+ process-buffer process
(elmo-base64-encode-string
- (sasl-cram-md5 user passphrase
+ (sasl-cram-md5 user passphrase
(elmo-base64-decode-string response))))
(when (null (elmo-imap4-read-response process-buffer process))
(setq ret-val (cons nil process))
(throw 'done nil))
(setq ret-val (cons process-buffer process)))
((string= "digest-md5" auth)
- (elmo-imap4-send-command
+ (elmo-imap4-send-command
process-buffer process "authenticate digest-md5" 'no-lock)
(when (null (setq response
- (elmo-imap4-read-response
+ (elmo-imap4-read-response
process-buffer process t)))
(setq ret-val (cons nil process))
(throw 'done nil))
(throw 'done nil))
(setq ret-val (cons process-buffer process)))
(t ;; not auth... try login
- (elmo-imap4-send-command
- process-buffer process
- (format "login %s \"%s\"" user
+ (elmo-imap4-send-command
+ process-buffer process
+ (format "login %s \"%s\"" user
(elmo-replace-in-string passphrase
- "\"" "\\\\\""))
+ "\"" "\\\\\""))
nil 'no-log) ;; No LOGGING.
(if (null (elmo-imap4-read-response process-buffer process))
(setq ret-val (cons nil process))
(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))
(elmo-imap4-debug "lock(%d): (No-logging command)." (+ elmo-imap4-seqno 1))
(elmo-imap4-debug "lock(%d): %s" (+ elmo-imap4-seqno 1) command))
(setq elmo-imap4-lock t))
- (process-send-string process (concat (format "%s%d "
- elmo-imap4-seq-prefix
+ (process-send-string process (concat (format "%s%d "
+ elmo-imap4-seq-prefix
(elmo-imap4-get-seqno))
command))
(process-send-string process "\r\n")))
(when (elmo-imap4-spec-folder spec)
(when (not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (if (null (setq response
- (elmo-imap4-select-folder
+ (if (null (setq response
+ (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec) connection)))
(error "Select folder failed")))
(elmo-imap4-send-command (process-buffer process)
process
- (format
- (if elmo-imap4-use-uid
+ (format
+ (if elmo-imap4-use-uid
"uid fetch %s body.peek[%s]"
"fetch %s body.peek[%s]")
msg part))
- (if (null (setq response (elmo-imap4-read-response
- (process-buffer process)
+ (if (null (setq response (elmo-imap4-read-response
+ (process-buffer process)
process t)))
(error "Fetch failed"))
(save-match-data
(while (string-match "^\\* OK" response)
- (if (null (setq response (elmo-imap4-read-response
- (process-buffer process)
+ (if (null (setq response (elmo-imap4-read-response
+ (process-buffer process)
process t)))
(error "Fetch failed"))))
(save-match-data
(string-to-int
(elmo-match-string 1 response)))
(error "Fetch failed")))
- (if (null (setq response (elmo-imap4-read-bytes
+ (if (null (setq response (elmo-imap4-read-bytes
(process-buffer process) process bytes)))
(error "Fetch message failed"))
(setq ret-val response)
(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)
(save-excursion
(let* ((connection (elmo-imap4-get-connection spec))
(when (elmo-imap4-spec-folder spec)
(when (not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (if (null (setq response
- (elmo-imap4-select-folder
- (elmo-imap4-spec-folder spec)
+ (if (null (setq response
+ (elmo-imap4-select-folder
+ (elmo-imap4-spec-folder spec)
connection)))
(error "Select folder failed")))
(elmo-imap4-send-command (process-buffer process)
process
- (format
- (if elmo-imap4-use-uid
- "uid fetch %s body%s[]"
+ (format
+ (if elmo-imap4-use-uid
+ "uid fetch %s body%s[]"
"fetch %s body%s[]")
msg
(if leave-seen-flag-untouched
".peek" "")))
- (if (null (setq response (elmo-imap4-read-response
+ (if (null (setq response (elmo-imap4-read-response
(process-buffer process)
process t)))
(error "Fetch failed"))
(save-match-data
(while (string-match "^\\* OK" response)
- (if (null (setq response (elmo-imap4-read-response
- (process-buffer process)
+ (if (null (setq response (elmo-imap4-read-response
+ (process-buffer process)
process t)))
(error "Fetch failed"))))
(save-match-data
(string-to-int
(elmo-match-string 1 response)))
(error "Fetch failed")))
- (setq ret-val (elmo-imap4-read-body
- (process-buffer process)
+ (setq ret-val (elmo-imap4-read-body
+ (process-buffer process)
process bytes outbuf))
- (elmo-imap4-read-response (process-buffer process)
+ (elmo-imap4-read-response (process-buffer process)
process)) ;; ignore remaining..
)
ret-val)))
(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"))))
(setq message-ids (cdr message-ids)))
(let* ((connection (elmo-imap4-get-connection spec))
(process (elmo-imap4-connection-get-process connection)))
- (elmo-imap4-send-command (process-buffer process)
+ (elmo-imap4-send-command (process-buffer process)
process "expunge")
(if (null (elmo-imap4-read-response (process-buffer process)
process))
(if (and (elmo-imap4-spec-folder spec)
(not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (null (elmo-imap4-select-folder
- (elmo-imap4-spec-folder spec)
+ (null (elmo-imap4-select-folder
+ (elmo-imap4-spec-folder spec)
connection)))
(error "Select folder failed"))
(save-excursion
(elmo-imap4-send-command (process-buffer process)
process
- (format
- (if elmo-imap4-use-uid
+ (format
+ (if elmo-imap4-use-uid
"uid search header message-id \"%s\""
"search header message-id \"%s\"")
msgid))
- (setq response (elmo-imap4-read-response
+ (setq response (elmo-imap4-read-response
(process-buffer process) process))
- (if (and response
+ (if (and response
(string-match "^\\* SEARCH\\([^\n]*\\)$" response))
(setq msgs (read (concat "(" (elmo-match-string 1 response) ")")))
(error "SEARCH failed"))
(if (and (elmo-imap4-spec-folder spec)
(not (string= (elmo-imap4-connection-get-cwf connection)
(elmo-imap4-spec-folder spec)))
- (null (elmo-imap4-select-folder
+ (null (elmo-imap4-select-folder
(elmo-imap4-spec-folder spec) connection)))
(error "Select folder failed"))
(save-excursion
- (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)))
(set-buffer send-buf)
(elmo-imap4-send-command (process-buffer process)
(elmo-imap4-send-command (process-buffer process)
process
(format
- (if elmo-imap4-use-uid
- "uid copy %s %s"
+ (if elmo-imap4-use-uid
+ "uid copy %s %s"
"copy %s %s")
(car mlist) dst-folder))
(if (null (elmo-imap4-read-response (process-buffer process)
(error "Copy failed")
(setq mlist (cdr mlist))))
(when expunge-it
- (elmo-imap4-send-command (process-buffer process)
+ (elmo-imap4-send-command (process-buffer process)
process "expunge")
(if (null (elmo-imap4-read-response (process-buffer process)
process))
(format
"status \"%s\" (unseen messages)"
(elmo-imap4-spec-folder spec)))
- (setq response (elmo-imap4-read-response
+ (setq response (elmo-imap4-read-response
(process-buffer process) process))
(when (string-match "\\* STATUS [^(]* \\(([^)]*)\\)" response)
(setq response (read (downcase (elmo-match-string 1 response))))
(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 number-alist
(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))))
(setq i (1+ i))
(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
- (elmo-msgdb-overview-get-entity-by-number overview
+ (elmo-msgdb-overview-get-entity-by-number overview
(car msg-list))
overview))
(setq number-alist
(defsubst elmo-msgdb-overview-entity-get-from (entity)
(and entity
(aref (cdr entity) 2)
- (decode-mime-charset-string (aref (cdr entity) 2)
+ (decode-mime-charset-string (aref (cdr entity) 2)
elmo-mime-charset)))
(defsubst elmo-msgdb-overview-entity-set-number (entity number)
(and killed-list
(not (listp
(catch 'found
- (mapcar
- (function
+ (mapcar
+ (function
(lambda (entity)
- (cond
+ (cond
((integerp entity)
(if (eq entity msg)
(throw 'found t)))
(while (and dlist (not found))
(setq entity (car dlist))
(if (or (and (integerp entity) (eq entity msg))
- (and (consp entity)
+ (and (consp entity)
(<= (car entity) msg)
(<= msg (cdr entity))))
(setq found t))
(while (and dlist (not found))
(setq entity (car dlist))
(if (integerp entity)
- (cond
+ (cond
((and (<= (car msg) entity)(<= entity (cdr msg)))
(setcar dlist msg)
(setq found t)
ret-val))
(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))))))
(elmo-msgdb-overview-get-entity-by-number overview number))))
(defsubst elmo-msgdb-append (msgdb msgdb-append)
- (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)))
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 (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))
(defun elmo-nntp-get-connection (server user port ssl)
(let* ((user-at-host (format "%s@%s" user server))
- (user-at-host-on-port (concat
+ (user-at-host-on-port (concat
user-at-host ":" (int-to-string port)
(if (eq ssl 'starttls) "!!" (if ssl "!"))))
ret-val result buffer process errmsg proc-stat)
(if (not (elmo-plugged-p server port))
(error "Unplugged"))
(setq ret-val (assoc user-at-host-on-port elmo-nntp-connection-cache))
- (if (and ret-val
- (or (eq (setq proc-stat
+ (if (and ret-val
+ (or (eq (setq proc-stat
(process-status (cadr (cdr ret-val))))
'closed)
(eq proc-stat 'exit)))
;; connection is closed...
(progn
(kill-buffer (car (cdr ret-val)))
- (setq elmo-nntp-connection-cache
+ (setq elmo-nntp-connection-cache
(delete ret-val elmo-nntp-connection-cache))
(setq ret-val nil)))
(if ret-val
(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)))))
(setq retval (elmo-string-to-list response))))
(if use-listgroup
retval
- (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))
(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
(error "Fetching overview failed")))
(setq cur (+ elmo-nntp-overview-fetch-chop-length cur 1))
(elmo-display-progress
- 'elmo-nntp-msgdb-create "Getting overview..."
+ 'elmo-nntp-msgdb-create "Getting overview..."
(/ (* (+ (- (min cur
end-num)
beg-num) 1) 100) length))))
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 ssl))
(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 ssl))
(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 ssl)
- "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 ssl))
(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 ssl))
(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))
(std11-field-body "Newsgroups"))))
(defun elmo-nntp-open-connection (server user portnum ssl)
- "Open NNTP connection and returns
+ "Open NNTP connection and returns
the list of (process session-buffer current-working-folder).
Return nil if connection failed."
(let ((process nil)
(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-ssl 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-ssl))
(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 ssl)))
(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
(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)))
))))
(setq i (1+ i))
(if (elmo-nntp-spec-ssl spec) "!ssl" "")))
(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.
(message "Checking %s..." src)
(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
(setq buffer (car (cdr (car cache))))
(setq process (car (cdr (cdr (car cache)))))
(if (and process
- (not (or (eq (setq proc-stat
- (process-status process))
+ (not (or (eq (setq proc-stat
+ (process-status process))
'closed)
(eq proc-stat 'exit))))
(condition-case ()
user-at-host-on-port)
(if (not (elmo-plugged-p server port))
(error "Unplugged"))
- (setq user-at-host-on-port
+ (setq user-at-host-on-port
(concat user-at-host ":" (int-to-string port)
(if (eq ssl 'starttls) "!!" (if ssl "!"))))
(setq ret-val (assoc user-at-host-on-port elmo-pop3-connection-cache))
- (if (and ret-val
- (or (eq (setq proc-stat
- (process-status (cadr (cdr ret-val))))
+ (if (and ret-val
+ (or (eq (setq proc-stat
+ (process-status (cadr (cdr ret-val))))
'closed)
(eq proc-stat 'exit)))
;; connection is closed...
(progn
(kill-buffer (car (cdr ret-val)))
- (setq elmo-pop3-connection-cache
+ (setq elmo-pop3-connection-cache
(delete ret-val elmo-pop3-connection-cache))
(setq ret-val nil)
))
(if ret-val
(cdr ret-val)
(setq result
- (elmo-pop3-open-connection
+ (elmo-pop3-open-connection
server user port auth
(elmo-get-passwd user-at-host) ssl))
(if (null result)
(delete-process process)
(error "Login failed")
)
- (setq elmo-pop3-connection-cache
- (append elmo-pop3-connection-cache
- (list
+ (setq elmo-pop3-connection-cache
+ (append elmo-pop3-connection-cache
+ (list
(cons user-at-host-on-port
(setq ret-val (list buffer process))))))
ret-val)))
(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)))
(get-buffer-create (format " *POP session to %s:%d" host port)))
(save-excursion
(set-buffer process-buffer)
- (elmo-set-buffer-multibyte nil)
+ (elmo-set-buffer-multibyte nil)
(erase-buffer))
(setq process
(elmo-open-network-stream "POP" process-buffer host port ssl))
(throw 'done nil))
(when (eq ssl 'starttls)
(elmo-pop3-send-command process-buffer process "stls")
- (string-match "^\+OK"
- (elmo-pop3-read-response
+ (string-match "^\+OK"
+ (elmo-pop3-read-response
process-buffer process))
(starttls-negotiate process))
(cond ((string= auth "apop")
;; good, APOP ready server
(progn
(require 'md5)
- (elmo-pop3-send-command
- process-buffer process
- (format "apop %s %s"
+ (elmo-pop3-send-command
+ process-buffer process
+ (format "apop %s %s"
user
- (md5
+ (md5
(concat (match-string 1 response)
passphrase)))))
;; otherwise, fail (only APOP authentication)
(setq ret-val (cons nil process))
(throw 'done nil)))
((string= auth "cram-md5")
- (elmo-pop3-send-command
+ (elmo-pop3-send-command
process-buffer process "auth cram-md5")
(when (null (setq response
(elmo-pop3-read-response
(elmo-pop3-send-command
process-buffer process
(elmo-base64-encode-string
- (sasl-cram-md5 user passphrase
+ (sasl-cram-md5 user passphrase
(elmo-base64-decode-string
(cadr (split-string response " ")))))))
((string= auth "digest-md5")
- (elmo-pop3-send-command
+ (elmo-pop3-send-command
process-buffer process "auth digest-md5")
(when (null (setq response
(elmo-pop3-read-response
server-msg-1
client-msg-1
(setq salted-pass
- (sasl-scram-md5-make-salted-pass
+ (sasl-scram-md5-make-salted-pass
server-msg-1 passphrase)))))
(when (null (setq response
(elmo-pop3-read-response
process-buffer process "") ))
(t
;; try USER/PASS
- (elmo-pop3-send-command process-buffer process
+ (elmo-pop3-send-command process-buffer process
(format "user %s" user))
(when (null (elmo-pop3-read-response process-buffer process t))
(setq ret-val (cons nil process))
(throw 'done nil))
- (elmo-pop3-send-command process-buffer process
+ (elmo-pop3-send-command process-buffer process
(format "pass %s" passphrase))))
;; read PASS or APOP response
(when (null (elmo-pop3-read-response process-buffer process t))
(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
(process (nth 1 connection))
response errmsg ret-val)
(elmo-pop3-msgdb-create-by-header buffer process numlist
- new-mark already-mark
+ new-mark already-mark
seen-mark seen-list))))
(defun elmo-pop3-msgdb-create-by-header (buffer process numlist
- new-mark already-mark
+ new-mark already-mark
seen-mark
seen-list)
(let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))
buffer tmp-buffer process numlist)
(setq ret-val
(elmo-pop3-msgdb-create-message
- tmp-buffer
+ tmp-buffer
(length numlist)
numlist
new-mark already-mark seen-mark seen-list))
(kill-buffer tmp-buffer)
ret-val))
-(defun elmo-pop3-msgdb-create-message (buffer
- num numlist new-mark already-mark
+(defun elmo-pop3-msgdb-create-message (buffer
+ num numlist new-mark already-mark
seen-mark
seen-list)
(save-excursion
(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))
(setq number-alist
(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)))
(let* ((connection (elmo-pop3-get-connection spec))
(buffer (car connection))
(process (cadr connection))
- (cwf (caddr connection))
+ (cwf (caddr connection))
response errmsg msg)
- (elmo-pop3-send-command buffer process
+ (elmo-pop3-send-command buffer process
(format "retr %s" number))
(when (null (setq response (elmo-pop3-read-response
buffer process t)))
(defun elmo-pop3-delete-msg (buffer process number)
(let (response errmsg msg)
- (elmo-pop3-send-command buffer process
+ (elmo-pop3-send-command buffer process
(format "dele %s" number))
(when (null (setq response (elmo-pop3-read-response
buffer process t)))
(let* ((connection (elmo-pop3-get-connection spec))
(buffer (car connection))
(process (cadr connection)))
- (mapcar '(lambda (msg) (elmo-pop3-delete-msg
+ (mapcar '(lambda (msg) (elmo-pop3-delete-msg
buffer process msg))
msgs))))
(if (elmo-pop3-spec-ssl spec) "!ssl" "")))
(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)
(require 'eword-decode)
(require 'utf7)
-(eval-when-compile
- (condition-case nil
+(eval-when-compile
+ (condition-case nil
(progn
(require 'ssl)
(require 'starttls))
;; 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)))
(broken-facility timezone-y2k
"timezone.el does not clear Y2K."
(or (not (featurep 'timezone))
- (string= (aref (timezone-parse-date "Sat, 1 Jan 00 07:00:00 JST") 0)
+ (string= (aref (timezone-parse-date "Sat, 1 Jan 00 07:00:00 JST") 0)
"2000")))
(when-broken timezone-y2k
(if year
(progn
(setq year
- (substring date (match-beginning year)
+ (substring date (match-beginning year)
(match-end year)))
(if (< (length year) 4)
(let ((yr (string-to-int year)))
(+ (match-beginning month) 3))))
(setq month
(int-to-string
- (cdr (assoc (upcase string)
+ (cdr (assoc (upcase string)
timezone-months-assoc)))))
(setq day
(substring date (match-beginning day) (match-end day)))
(setq time
- (substring date (match-beginning time)
+ (substring date (match-beginning time)
(match-end time)))))
(if zone
(setq zone
- (substring date (match-beginning zone)
+ (substring date (match-beginning zone)
(match-end zone))))
(if year
(vector year month day time zone)
(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))
(setq tls (elmo-match-string 3 folder))
(default-tls elmo-default-imap4-ssl)
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-tls))
(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)
(setq auth (if (match-beginning 4)
(elmo-match-substring 4 folder 1)
elmo-default-imap4-authenticate-type))
- (append (list 'imap4
+ (append (list 'imap4
(elmo-imap4-encode-folder-string mailbox)
user auth)
(cdr spec))))))
(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 data (assoc user-at-host elmo-passwd-alist))
(if data
(elmo-base64-decode-string (cdr data))
- (setq pass (elmo-read-passwd (format "Password for %s: "
+ (setq pass (elmo-read-passwd (format "Password for %s: "
user-at-host) t))
(setq elmo-passwd-alist
(append elmo-passwd-alist
- (list (cons user-at-host
+ (list (cons user-at-host
(elmo-base64-encode-string pass)))))
pass)))
(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)
"*Default IMAP4 server.")
(defvar elmo-default-imap4-authenticate-type "auth"
"*Default Authentication type for IMAP4.") ; "auth" or "login"
-(defvar elmo-default-imap4-user (or (getenv "USER")
- (getenv "LOGNAME")
+(defvar elmo-default-imap4-user (or (getenv "USER")
+ (getenv "LOGNAME")
(user-login-name))
"*Default username for IMAP4")
-(defvar elmo-default-imap4-port 143
+(defvar elmo-default-imap4-port 143
"*Default Port number of IMAP.")
(defvar elmo-default-imap4-ssl nil
"*Non-nil forces using SSL by default.")
;; POP3
-(defvar elmo-default-pop3-user (or (getenv "USER")
- (getenv "LOGNAME")
+(defvar elmo-default-pop3-user (or (getenv "USER")
+ (getenv "LOGNAME")
(user-login-name))
"*Default username for POP3")
(defvar elmo-default-pop3-server "localhost"
"*Default NNTP server.")
(defvar elmo-default-nntp-user nil
"*Default User of NNTP. nil means no user authentication.")
-(defvar elmo-default-nntp-port 119
+(defvar elmo-default-nntp-port 119
"*Default Port number of NNTP")
(defvar elmo-default-nntp-ssl nil
"*Non-nil forces using SSL by default.")
(defvar elmo-msgdb-finfo-filename "finfo"
"Folder information cache...list of '(filename . '(new unread all)).")
(defvar elmo-msgdb-append-list-filename "append"
- "Appended messages...Structure is same as number-alist.
+ "Appended messages...Structure is same as number-alist.
For disconnected operations.")
(defvar elmo-msgdb-resume-list-filename "resume"
"Resumed messages. For disconnected operations.")
(defvar elmo-msgdb-lock-list-filename "lock"
- "Locked messages...list of message-id.
+ "Locked messages...list of message-id.
For disconnected operations.")
(defvar elmo-msgdb-global-mark-filename "global-mark"
"Alist of global mark .")
(defvar elmo-imap4-overview-fetch-chop-length 200
"*Number of overviews to fetch in one request in imap4.")
(defvar elmo-nntp-overview-fetch-chop-length 200
- "*Number of overviews to fetch in one request in nntp.")
+ "*Number of overviews to fetch in one request in nntp.")
(defvar elmo-localdir-header-chop-length 2048
"*Number of bytes to get header in one reading from file.")
(defvar elmo-imap4-force-login nil
(defvar elmo-localdir-lockfile-list nil)
(defvar elmo-nntp-max-number-precedes-list-active nil
- "If non-nil, max number of the msgdb is set as the max number of
+ "If non-nil, max number of the msgdb is set as the max number of
'list active' (needed for inn 2.3 or later?). ")
(defvar elmo-pop3-send-command-synchronously nil
"If non-nil, commands are send synchronously.
-If server doesn't accept asynchronous commands, this variable should be
+If server doesn't accept asynchronous commands, this variable should be
set as non-nil.")
(provide 'elmo-vars)
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 (not (elmo-local-file-p folder msg))
(elmo-cache-save message-id
(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))
(unless (elmo-append-msg dst-folder (buffer-string) message-id
(if same-number (car messages))
;; null means all unread.
- (or (null unread-marks)
+ (or (null unread-marks)
unseen))
(error "move: append message to %s failed" dst-folder))))
;; delete src cache if it is partial.
(setq ret-val (append ret-val (list (car messages))))
(setq i (+ i 1))
(setq percent (/ (* i 100) all-msg-num))
- (if no-delete
+ (if no-delete
(elmo-display-progress
'elmo-move-msgs "Copying messages..."
percent)
(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)))
(defun elmo-msgdb-load (folder &optional spec)
(message "Loading msgdb for %s..." folder)
(let* ((path (elmo-msgdb-expand-path folder spec))
- (ret-val
+ (ret-val
(list (elmo-msgdb-overview-load path)
(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-folder spec)))
- (if (null (setq response
- (elmo-imap4-select-folder
+ (if (null (setq response
+ (elmo-imap4-select-folder
(elmo-imap4-spec-folder 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))))
(narrow-to-region (match-end 0) (point-max))
(while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t)
(let (str)
- (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))))
(goto-char (point-min))
- (mmelmo-imap4-parse-bodystructure-object
+ (mmelmo-imap4-parse-bodystructure-object
folder ; folder
number ; number
msgdb ; msgdb
connection)
(elmo-imap4-connection-get-process
connection)
- (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))
(setq mmelmo-imap4-fetched t)))
(mime-buffer-entity-buffer-internal entity))
(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
- (mime-elmo-entity-folder-internal
+ (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-parse-encapsulated entity)))))
;; override generic function for dynamic body fetching.
-(luna-define-method mime-entity-content ((entity
+(luna-define-method mime-entity-content ((entity
mime-elmo-imap4-entity))
(save-excursion
(set-buffer (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
(mime-entity-buffer entity)
(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