change in elmo-msgdb-make-message-entity.
(wl-summary-buffer-set-folder): Don't call
wl-summary-detect-mark-position here.
(wl-summary-rescan): Call elmo-message-entity-number.
(wl-summary-sync-update): Ditto.
(wl-summary-goto-folder-subr): Call wl-summary-detect-mark-position.
* wl-score.el (wl-score-header-index): Redefine 2th element.
(wl-score-overview-entity-get-extra): Abolish.
(wl-score-ov-entity-get): Rewrite.
(wl-score-string-index<, wl-score-string-func<): Abolish.
(wl-score-string<): New function.
(wl-score-string-sort): Use it.
* wl-refile.el (wl-refile-guess-by-history): Use
elmo-message-entity-field.
(wl-refile-guess-by-from): Ditto.
(wl-refile-guess-by-msgid): Ditto.
* modb.el (elmo-message-entity-db): New function.
(elmo-msgdb-make-message-entity): New API.
(elmo-msgdb-message-entity-number): Ditto.
(elmo-msgdb-message-entity-set-number): Ditto.
(elmo-msgdb-message-entity-field): Ditto.
(elmo-msgdb-message-entity-set-field): Ditto.
(elmo-msgdb-copy-message-entity): Ditto.
(elmo-msgdb-create-message-entity-from-file): Ditto.
(elmo-msgdb-create-message-entity-from-buffer): Ditto.
(elmo-msgdb-match-condition-internal): Ditto.
* modb-standard.el (modb-legacy): Require modb-legacy.
(modb-standard-make-message-entity): New inline function.
(elmo-msgdb-make-message-entity): Define.
(elmo-msgdb-create-message-entity-from-file): Ditto.
(elmo-msgdb-create-message-entity-from-buffer): Ditto.
(elmo-msgdb-message-entity-field): Ditto.
(elmo-msgdb-message-entity-set-field): Ditto.
(elmo-msgdb-copy-message-entity): Ditto.
(elmo-msgdb-match-condition-internal): Ditto.
* modb-legacy.el: Don't require modb-entity.
(elmo-msgdb-decoded-cache-hashtb): Moved from elmo-msgdb.el
(elmo-msgdb-match-condition-primitive): Ditto.
(elmo-msgdb-get-decoded-cache): Ditto.
(elmo-msgdb-overview-entity-get-id): Ditto.
(elmo-msgdb-overview-entity-get-number): Ditto.
(elmo-msgdb-overview-entity-set-number): Ditto.
(elmo-msgdb-overview-entity-get-references): Ditto.
(elmo-msgdb-overview-entity-set-references): Ditto.
(elmo-msgdb-overview-entity-get-from-no-decode): Ditto.
(elmo-msgdb-overview-entity-get-from): Ditto.
(elmo-msgdb-overview-entity-set-from): Ditto.
(elmo-msgdb-overview-entity-get-subject): Ditto.
(elmo-msgdb-overview-entity-get-subject-no-decode): Ditto.
(elmo-msgdb-overview-entity-set-subject): Ditto.
(elmo-msgdb-overview-entity-get-date): Ditto.
(elmo-msgdb-overview-entity-set-date): Ditto.
(elmo-msgdb-overview-entity-get-to): Ditto.
(elmo-msgdb-overview-entity-get-cc): Ditto.
(elmo-msgdb-overview-entity-get-size): Ditto.
(elmo-msgdb-overview-entity-set-size): Ditto.
(elmo-msgdb-overview-entity-get-extra): Ditto.
(elmo-msgdb-overview-entity-set-extra): Ditto.
(elmo-msgdb-overview-entity-get-extra-field): Ditto.
(elmo-msgdb-overview-entity-set-extra-field): Ditto.
(elmo-msgdb-number-load): Ditto.
(elmo-msgdb-overview-load): Ditto.
(elmo-msgdb-mark-load): Ditto.
(elmo-msgdb-number-save): Ditto.
(elmo-msgdb-mark-save): Ditto.
(elmo-msgdb-overview-save): Ditto.
(modb-legacy-make-message-entity): New inline function.
(elmo-msgdb-insert-file-header): Ditto.
(elmo-msgdb-make-message-entity): Define.
(elmo-msgdb-create-message-entity-from-file): Ditto.
(elmo-msgdb-create-message-entity-from-buffer): Ditto.
(elmo-msgdb-message-entity-number): Ditto.
(elmo-msgdb-message-entity-set-number): Ditto.
(elmo-msgdb-message-entity-field): Ditto.
(elmo-msgdb-message-entity-set-field): Ditto.
(elmo-msgdb-copy-message-entity): Ditto.
(elmo-msgdb-match-condition-internal): Ditto.
* elmo.el (elmo-find-fetch-strategy): Use elmo-message-entity-field.
(elmo-message-copy-entity): Rewrite.
(elmo-message-entity-number): Ditto.
(elmo-message-entity-set-number): Ditto.
(elmo-message-entity-field): Use elmo-message-entity-db.
(elmo-message-entity-set-field): Ditto.
(elmo-message-field): Rewrite.
* elmo-util.el (elmo-msgdb-get-last-message-id): Moved from
elmo-msgdb.el
(elmo-msgdb-get-message-id-from-buffer): Ditto.
* elmo-shimbun.el (elmo-shimbun-folder-entity-hash): Use
elmo-message-entity-field.
(elmo-shimbun-folder-shimbun-header): Ditto.
(elmo-shimbun-entity-to-header): Ditto.
(elmo-folder-msgdb-create): Ditto.
(elmo-shimbun-msgdb-create-entity): Ditto;
Use elmo-msgdb-create-message-entity-from-buffer.
(elmo-shimbun-update-overview): Use elmo-message-entity-set-field.
(elmo-map-folder-list-message-locations): elmo-message-entity-field.
* elmo-sendlog.el (elmo-folder-msgdb-create): Use
elmo-msgdb-create-message-entity-from-file and
elmo-message-entity-field.
* elmo-pop3.el (elmo-pop3-sort-msgdb-by-original-number): Use
elmo-message-entity-number.
(elmo-pop3-msgdb-create-message): Use
elmo-msgdb-create-message-entity-from-buffer,
elmo-message-entity-set-field, elmo-message-entity-number and
elmo-message-entity-set-number.
* elmo-nntp.el (elmo-nntp-create-msgdb-from-overview-string): Follow
the API change in elmo-msgdb-make-message-entity.
(elmo-nntp-msgdb-create-message): Use
elmo-msgdb-create-message-entity-from-buffer.
* elmo-nmz.el (elmo-nmz-msgdb-create-entity): Use
elmo-message-entity-field and
elmo-msgdb-create-message-entity-from-file.
* elmo-msgdb.el (toplevel): Don't require modb-entity.
(elmo-msgdb-get-field): Abolish.
(elmo-msgdb-get-number): Rewrite.
(elmo-msgdb-sort-by-date): Use elmo-message-entity-field.
(elmo-msgdb-flag-table): Ditto.
(elmo-msgdb-get-last-message-id,
elmo-msgdb-number-load, elmo-msgdb-overview-load,
elmo-msgdb-mark-load, elmo-msgdb-number-save,
elmo-msgdb-mark-save, elmo-msgdb-overview-save): Moved to modb-legacy.
(elmo-msgdb-create-overview-from-buffer,
elmo-msgdb-overview-get-parent-entity): Abolish.
* elmo-mime.el (elmo-mime-display-as-is): Use
elmo-message-entity-field.
* elmo-map.el (elmo-folder-pack-numbers): Use
elmo-message-entity-set-number.
* elmo-maildir.el (elmo-folder-msgdb-create):
elmo-msgdb-create-message-entity-from-file instead of
elmo-msgdb-create-overview-entity-from-file.
* elmo-localdir.el (elmo-localdir-msgdb-create-entity): Added argument
msgdb.
(elmo-folder-msgdb-create): Use elmo-message-entity-field.
(elmo-folder-pack-numbers): Use elmo-message-entity-set-number.
* elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Use
elmo-messge-entity-field and elmo-message-entity-number.
(elmo-imap4-fetch-callback-1): Call
elmo-msgdb-create-message-entity-from-buffer instead of
elmo-msgdb-create-overview-from-buffer.
(elmo-folder-msgdb-create-plugged): Use elmo-messge-entity-field.
(elmo-find-fetch-strategy): Likewise.
* elmo-flag.el (elmo-folder-msgdb-create): Call
elmo-localdir-msgdb-create-entity with argument msgdb.
* elmo-dop.el (elmo-dop-msgdb): Use elmo-message-entity-number
and elmo-message-entity-set-number.
* elmo-cache.el (elmo-folder-msgdb-create): Use
elmo-message-entity-field.
(elmo-folder-msgdb-create): Call
elmo-msgdb-create-message-entity-from-file instead of
elmo-msgdb-create-overview-entity-from-file.
* elmo-archive.el (elmo-archive-msgdb-create-entity-subr): Added
argument msgdb; Call elmo-msgdb-create-message-from-buffer
instead of elmo-msgdb-create-overview-from-buffer.
(elmo-archive-msgdb-create-entity): Ditto.
(elmo-archive-msgdb-create-as-numlist-subr1): Use
elmo-message-entity-field.
(elmo-archive-parse-mmdf): Ditto.
* WL-ELS (ELMO-MODULES): Removed modb-entity.
+2003-09-21 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * WL-ELS (ELMO-MODULES): Removed modb-entity.
+
2003-09-19 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* WL-ELS (ELMO-MODULES): Added modb-standard.
elmo-archive elmo-pipe elmo-cache
elmo-internal elmo-flag elmo-sendlog
elmo-dop elmo-nmz elmo-split
- modb modb-entity modb-legacy modb-standard
+ modb modb-legacy modb-standard
))
\f
2003-09-21 Yuuichi Teranishi <teranisi@gohome.org>
+ * modb.el (elmo-message-entity-db): New function.
+ (elmo-msgdb-make-message-entity): New API.
+ (elmo-msgdb-message-entity-number): Ditto.
+ (elmo-msgdb-message-entity-set-number): Ditto.
+ (elmo-msgdb-message-entity-field): Ditto.
+ (elmo-msgdb-message-entity-set-field): Ditto.
+ (elmo-msgdb-copy-message-entity): Ditto.
+ (elmo-msgdb-create-message-entity-from-file): Ditto.
+ (elmo-msgdb-create-message-entity-from-buffer): Ditto.
+ (elmo-msgdb-match-condition-internal): Ditto.
+
+ * modb-standard.el (modb-legacy): Require modb-legacy.
+ (modb-standard-make-message-entity): New inline function.
+ (elmo-msgdb-make-message-entity): Define.
+ (elmo-msgdb-create-message-entity-from-file): Ditto.
+ (elmo-msgdb-create-message-entity-from-buffer): Ditto.
+ (elmo-msgdb-message-entity-field): Ditto.
+ (elmo-msgdb-message-entity-set-field): Ditto.
+ (elmo-msgdb-copy-message-entity): Ditto.
+ (elmo-msgdb-match-condition-internal): Ditto.
+
+ * modb-legacy.el: Don't require modb-entity.
+ (elmo-msgdb-decoded-cache-hashtb): Moved from elmo-msgdb.el
+ (elmo-msgdb-match-condition-primitive): Ditto.
+ (elmo-msgdb-get-decoded-cache): Ditto.
+ (elmo-msgdb-overview-entity-get-id): Ditto.
+ (elmo-msgdb-overview-entity-get-number): Ditto.
+ (elmo-msgdb-overview-entity-set-number): Ditto.
+ (elmo-msgdb-overview-entity-get-references): Ditto.
+ (elmo-msgdb-overview-entity-set-references): Ditto.
+ (elmo-msgdb-overview-entity-get-from-no-decode): Ditto.
+ (elmo-msgdb-overview-entity-get-from): Ditto.
+ (elmo-msgdb-overview-entity-set-from): Ditto.
+ (elmo-msgdb-overview-entity-get-subject): Ditto.
+ (elmo-msgdb-overview-entity-get-subject-no-decode): Ditto.
+ (elmo-msgdb-overview-entity-set-subject): Ditto.
+ (elmo-msgdb-overview-entity-get-date): Ditto.
+ (elmo-msgdb-overview-entity-set-date): Ditto.
+ (elmo-msgdb-overview-entity-get-to): Ditto.
+ (elmo-msgdb-overview-entity-get-cc): Ditto.
+ (elmo-msgdb-overview-entity-get-size): Ditto.
+ (elmo-msgdb-overview-entity-set-size): Ditto.
+ (elmo-msgdb-overview-entity-get-extra): Ditto.
+ (elmo-msgdb-overview-entity-set-extra): Ditto.
+ (elmo-msgdb-overview-entity-get-extra-field): Ditto.
+ (elmo-msgdb-overview-entity-set-extra-field): Ditto.
+ (elmo-msgdb-number-load): Ditto.
+ (elmo-msgdb-overview-load): Ditto.
+ (elmo-msgdb-mark-load): Ditto.
+ (elmo-msgdb-number-save): Ditto.
+ (elmo-msgdb-mark-save): Ditto.
+ (elmo-msgdb-overview-save): Ditto.
+ (modb-legacy-make-message-entity): New inline function.
+ (elmo-msgdb-insert-file-header): Ditto.
+ (elmo-msgdb-make-message-entity): Define.
+ (elmo-msgdb-create-message-entity-from-file): Ditto.
+ (elmo-msgdb-create-message-entity-from-buffer): Ditto.
+ (elmo-msgdb-message-entity-number): Ditto.
+ (elmo-msgdb-message-entity-set-number): Ditto.
+ (elmo-msgdb-message-entity-field): Ditto.
+ (elmo-msgdb-message-entity-set-field): Ditto.
+ (elmo-msgdb-copy-message-entity): Ditto.
+ (elmo-msgdb-match-condition-internal): Ditto.
+
+ * elmo.el (elmo-find-fetch-strategy): Use elmo-message-entity-field.
+ (elmo-message-copy-entity): Rewrite.
+ (elmo-message-entity-number): Ditto.
+ (elmo-message-entity-set-number): Ditto.
+ (elmo-message-entity-field): Use elmo-message-entity-db.
+ (elmo-message-entity-set-field): Ditto.
+ (elmo-message-field): Rewrite.
+
+ * elmo-util.el (elmo-msgdb-get-last-message-id): Moved from
+ elmo-msgdb.el
+ (elmo-msgdb-get-message-id-from-buffer): Ditto.
+
+ * elmo-shimbun.el (elmo-shimbun-folder-entity-hash): Use
+ elmo-message-entity-field.
+ (elmo-shimbun-folder-shimbun-header): Ditto.
+ (elmo-shimbun-entity-to-header): Ditto.
+ (elmo-folder-msgdb-create): Ditto.
+ (elmo-shimbun-msgdb-create-entity): Ditto;
+ Use elmo-msgdb-create-message-entity-from-buffer.
+ (elmo-shimbun-update-overview): Use elmo-message-entity-set-field.
+ (elmo-map-folder-list-message-locations): elmo-message-entity-field.
+
+ * elmo-sendlog.el (elmo-folder-msgdb-create): Use
+ elmo-msgdb-create-message-entity-from-file and
+ elmo-message-entity-field.
+
+ * elmo-pop3.el (elmo-pop3-sort-msgdb-by-original-number): Use
+ elmo-message-entity-number.
+ (elmo-pop3-msgdb-create-message): Use
+ elmo-msgdb-create-message-entity-from-buffer,
+ elmo-message-entity-set-field, elmo-message-entity-number and
+ elmo-message-entity-set-number.
+
+ * elmo-nntp.el (elmo-nntp-create-msgdb-from-overview-string): Follow
+ the API change in elmo-msgdb-make-message-entity.
+ (elmo-nntp-msgdb-create-message): Use
+ elmo-msgdb-create-message-entity-from-buffer.
+
+ * elmo-nmz.el (elmo-nmz-msgdb-create-entity): Use
+ elmo-message-entity-field and
+ elmo-msgdb-create-message-entity-from-file.
+
+ * elmo-msgdb.el (toplevel): Don't require modb-entity.
+ (elmo-msgdb-get-field): Abolish.
+ (elmo-msgdb-get-number): Rewrite.
+ (elmo-msgdb-sort-by-date): Use elmo-message-entity-field.
+ (elmo-msgdb-flag-table): Ditto.
+ (elmo-msgdb-get-last-message-id,
+ elmo-msgdb-number-load, elmo-msgdb-overview-load,
+ elmo-msgdb-mark-load, elmo-msgdb-number-save,
+ elmo-msgdb-mark-save, elmo-msgdb-overview-save): Moved to modb-legacy.
+ (elmo-msgdb-create-overview-from-buffer,
+ elmo-msgdb-overview-get-parent-entity): Abolish.
+
+ * elmo-mime.el (elmo-mime-display-as-is): Use
+ elmo-message-entity-field.
+
+ * elmo-map.el (elmo-folder-pack-numbers): Use
+ elmo-message-entity-set-number.
+
+ * elmo-maildir.el (elmo-folder-msgdb-create):
+ elmo-msgdb-create-message-entity-from-file instead of
+ elmo-msgdb-create-overview-entity-from-file.
+
+ * elmo-localdir.el (elmo-localdir-msgdb-create-entity): Added argument
+ msgdb.
+ (elmo-folder-msgdb-create): Use elmo-message-entity-field.
+ (elmo-folder-pack-numbers): Use elmo-message-entity-set-number.
+
+ * elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Use
+ elmo-messge-entity-field and elmo-message-entity-number.
+ (elmo-imap4-fetch-callback-1): Call
+ elmo-msgdb-create-message-entity-from-buffer instead of
+ elmo-msgdb-create-overview-from-buffer.
+ (elmo-folder-msgdb-create-plugged): Use elmo-messge-entity-field.
+ (elmo-find-fetch-strategy): Likewise.
+
+ * elmo-flag.el (elmo-folder-msgdb-create): Call
+ elmo-localdir-msgdb-create-entity with argument msgdb.
+
+ * elmo-dop.el (elmo-dop-msgdb): Use elmo-message-entity-number
+ and elmo-message-entity-set-number.
+
+ * elmo-cache.el (elmo-folder-msgdb-create): Use
+ elmo-message-entity-field.
+ (elmo-folder-msgdb-create): Call
+ elmo-msgdb-create-message-entity-from-file instead of
+ elmo-msgdb-create-overview-entity-from-file.
+
+ * elmo-archive.el (elmo-archive-msgdb-create-entity-subr): Added
+ argument msgdb; Call elmo-msgdb-create-message-from-buffer
+ instead of elmo-msgdb-create-overview-from-buffer.
+ (elmo-archive-msgdb-create-entity): Ditto.
+ (elmo-archive-msgdb-create-as-numlist-subr1): Use
+ elmo-message-entity-field.
+ (elmo-archive-parse-mmdf): Ditto.
+
+ * modb-entity.el: Removed.
+
* elmo-version.el (elmo-version): Up to 2.11.16.
2003-09-20 Yuuichi Teranishi <teranisi@gohome.org>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; MessageDB functions (from elmo-localdir.el)
-(defsubst elmo-archive-msgdb-create-entity-subr (number)
+(defsubst elmo-archive-msgdb-create-entity-subr (msgdb number)
(let (header-end)
(elmo-set-buffer-multibyte default-enable-multibyte-characters)
(goto-char (point-min))
(setq header-end (point))
(setq header-end (point-max)))
(narrow-to-region (point-min) header-end)
- (elmo-msgdb-create-overview-from-buffer number)))
+ (elmo-msgdb-create-message-entity-from-buffer msgdb number)))
;; verrrry slow!!
-(defsubst elmo-archive-msgdb-create-entity (method archive number type &optional prefix)
+(defsubst elmo-archive-msgdb-create-entity (msgdb
+ method
+ archive number type
+ &optional prefix)
(let* ((msg (elmo-concat-path prefix (int-to-string number)))
(arg-list (list archive msg)))
(when (elmo-archive-article-exists-p archive msg type)
;; insert article.
(as-binary-process
(elmo-archive-call-method method arg-list t))
- (elmo-archive-msgdb-create-entity-subr number))))
+ (elmo-archive-msgdb-create-entity-subr msgdb number))))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-archive-folder)
numbers flag-table)
(erase-buffer)
(setq entity
(elmo-archive-msgdb-create-entity
+ new-msgdb
method file (car numlist) type
(elmo-archive-folder-archive-prefix-internal folder)))
(when entity
- (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+ (setq message-id (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table message-id))
(elmo-global-flags-set flags folder (car numlist) message-id)
(elmo-msgdb-append-entity new-msgdb entity flags))
() ; nop
(save-excursion
(narrow-to-region sp ep)
- (setq entity (elmo-archive-msgdb-create-entity-subr number)
- message-id (elmo-msgdb-overview-entity-get-id entity)
+ (setq entity (elmo-archive-msgdb-create-entity-subr new-msgdb number)
+ message-id (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table message-id))
(elmo-global-flags-set flags folder number message-id)
(elmo-msgdb-append-entity new-msgdb entity flags)
(message "Creating msgdb...")
(while numbers
(setq entity
- (elmo-msgdb-create-overview-entity-from-file
+ (elmo-msgdb-create-message-entity-from-file
+ new-msgdb
(car numbers) (elmo-message-file-name folder (car numbers))))
(when entity
- (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+ (setq message-id (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table message-id))
(elmo-global-flags-set flags folder (car numbers) message-id)
(elmo-msgdb-append-entity new-msgdb entity flags))
(unless (elmo-folder-exists-p folder)
(elmo-folder-create folder)))
-;;; Util
+;;; Util XXX Oh my god...
(defun elmo-dop-msgdb (msgdb)
(list (mapcar (function
(lambda (x)
- (elmo-msgdb-overview-entity-set-number
+ (elmo-message-entity-set-number
x
(* -1
- (elmo-msgdb-overview-entity-get-number x)))))
+ (elmo-message-entity-number x)))))
(nth 0 msgdb))
(mapcar (function
(lambda (x) (cons
(message "Creating msgdb...")
(while numbers
(when (setq entity (elmo-localdir-msgdb-create-entity
- dir (car numbers)))
+ new-msgdb dir (car numbers)))
(elmo-msgdb-append-entity new-msgdb entity
(list (elmo-flag-folder-flag-internal
folder))))
"A msgdb entity callback function."
(let ((use-flag (elmo-folder-use-flag-p (cdr app-data)))
(flag-table (car app-data))
- (msg-id (elmo-msgdb-overview-entity-get-id entity))
+ (msg-id (elmo-message-entity-field entity 'message-id))
saved-flags flag-list)
;; (when (elmo-string-member-ignore-case "\\Flagged" flags)
;; (elmo-msgdb-global-mark-set msg-id elmo-msgdb-important-mark))
(memq 'answered flag-list))
(memq 'unread flag-list))
(setq elmo-imap4-seen-messages
- (cons (elmo-msgdb-overview-entity-get-number entity)
+ (cons (elmo-message-entity-number entity)
elmo-imap4-seen-messages)))
(elmo-msgdb-append-entity elmo-imap4-current-msgdb
entity
(goto-char (point-min))
(while (search-forward "\r\n" nil t)
(replace-match "\n"))
- (elmo-msgdb-create-overview-from-buffer
+ (elmo-msgdb-create-message-entity-from-buffer
+ (elmo-folder-msgdb-internal (cdr app-data))
(elmo-imap4-response-value element 'uid)
- (elmo-imap4-response-value element 'rfc822size)))
+ :size (elmo-imap4-response-value element 'rfc822size)))
(elmo-imap4-response-value element 'flags)
app-data))
(elmo-global-flags-set (elmo-msgdb-flags elmo-imap4-current-msgdb
number)
folder number
- (elmo-msgdb-message-entity-field
+ (elmo-message-entity-field
(elmo-msgdb-message-entity
elmo-imap4-current-msgdb number)
'message-id)))
(luna-define-method elmo-find-fetch-strategy
((folder elmo-imap4-folder) entity &optional ignore-cache)
- (let ((number (elmo-msgdb-overview-entity-get-number entity))
+ (let ((number (elmo-message-entity-number entity))
cache-file size message-id)
- (setq size (elmo-msgdb-overview-entity-get-size entity))
- (setq message-id (elmo-msgdb-overview-entity-get-id entity))
+ (setq size (elmo-message-entity-field entity 'size))
+ (setq message-id (elmo-message-entity-field entity 'message-id))
(setq cache-file (elmo-file-cache-get message-id))
(if (or ignore-cache
(null (elmo-file-cache-status cache-file)))
(incf cur-number))
temp-dir))
-(defun elmo-localdir-msgdb-create-entity (dir number)
- (elmo-msgdb-create-overview-entity-from-file
- number (expand-file-name (int-to-string number) dir)))
+(defun elmo-localdir-msgdb-create-entity (msgdb dir number)
+ (elmo-msgdb-create-message-entity-from-file
+ msgdb number (expand-file-name (int-to-string number) dir)))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-localdir-folder)
numbers
(while numbers
(setq entity
(elmo-localdir-msgdb-create-entity
- dir (car numbers)))
+ new-msgdb dir (car numbers)))
(when entity
- (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+ (setq message-id (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table message-id))
(elmo-global-flags-set flags folder (car numbers) message-id)
(elmo-msgdb-append-entity new-msgdb entity flags))
;; xxx nfs,hardlink
(rename-file (int-to-string old-number)
(int-to-string new-number) t))
- (elmo-msgdb-overview-entity-set-number entity new-number))
+ (elmo-message-entity-set-number entity new-number))
(elmo-msgdb-append-entity new-msgdb entity
(elmo-msgdb-flags msgdb old-number))
(setq new-number (1+ new-number))))
(dolist (number numbers)
(setq location (elmo-map-message-location folder number))
(setq entity
- (elmo-msgdb-create-overview-entity-from-file
+ (elmo-msgdb-create-message-entity-from-file
+ new-msgdb
number
(elmo-maildir-message-file-name folder location)))
(when entity
(elmo-folder-pack-numbers total "Packing...")
(dolist (old-number numbers)
(setq entity (elmo-msgdb-message-entity msgdb old-number))
- (elmo-msgdb-overview-entity-set-number entity number)
+ (elmo-message-entity-set-number entity number)
(elmo-msgdb-append-entity new-msgdb entity
(elmo-msgdb-flags msgdb old-number))
(setq location
cache-file strategy use-cache)
(when entity
(setq cache-file (elmo-file-cache-get
- (elmo-msgdb-overview-entity-get-id entity)))
+ (elmo-message-entity-field entity 'message-id)))
(setq use-cache (and (elmo-message-use-cache-p folder number)
(eq (elmo-file-cache-status cache-file) 'entire))))
(setq strategy (elmo-make-fetch-strategy
(require 'std11)
(require 'mime)
(require 'modb)
-(require 'modb-entity)
;;; MSGDB interface.
;;
;; MSGDB elmo-load-msgdb PATH
;; NUMBER elmo-msgdb-get-number MSGDB MESSAGE-ID
-;; FIELD-VALUE elmo-msgdb-get-field MSGDB NUMBER FIELD
;; elmo-msgdb-sort-by-date MSGDB
;; elmo-flag-table-load
(defsubst elmo-msgdb-get-number (msgdb message-id)
"Get number of the message which corrensponds to MESSAGE-ID from MSGDB."
- (elmo-msgdb-overview-entity-get-number
- (elmo-msgdb-message-entity msgdb message-id)))
-
-(defsubst elmo-msgdb-get-field (msgdb number field)
- "Get FIELD value of the message with NUMBER from MSGDB."
- (case field
- (message-id (elmo-msgdb-overview-entity-get-id
- (elmo-msgdb-message-entity
- msgdb number)))
- (subject (elmo-msgdb-overview-entity-get-subject
- (elmo-msgdb-message-entity
- msgdb number)))
- (size (elmo-msgdb-overview-entity-get-size
- (elmo-msgdb-message-entity
- msgdb number)))
- (date (elmo-msgdb-overview-entity-get-date
- (elmo-msgdb-message-entity
- msgdb number)))
- (to (elmo-msgdb-overview-entity-get-to
- (elmo-msgdb-message-entity
- msgdb number)))
- (cc (elmo-msgdb-overview-entity-get-cc
- (elmo-msgdb-message-entity
- msgdb number)))))
+ (elmo-msgdb-message-entity-number
+ msgdb (elmo-msgdb-message-entity msgdb message-id)))
(defun elmo-msgdb-sort-by-date (msgdb)
(elmo-msgdb-sort-entities
(condition-case nil
(string<
(timezone-make-date-sortable
- (elmo-msgdb-overview-entity-get-date x))
+ (elmo-msgdb-message-entity-field msgdb x 'date))
(timezone-make-date-sortable
- (elmo-msgdb-overview-entity-get-date y)))
+ (elmo-msgdb-message-entity-field msgdb y 'date)))
(error)))))
+
+(defsubst elmo-msgdb-get-parent-entity (entity msgdb)
+ (setq entity (elmo-msgdb-message-entity-field msgdb entity 'references))
+ ;; entity is parent-id.
+ (and entity (elmo-msgdb-message-entity msgdb entity)))
+
;;;
(defsubst elmo-msgdb-append-element (list element)
(if list
(setq entity (elmo-msgdb-message-entity msgdb number))
(elmo-flag-table-set
flag-table
- (elmo-msgdb-overview-entity-get-id entity)
+ (elmo-msgdb-message-entity-field msgdb entity 'message-id)
(elmo-msgdb-flags msgdb number)))
flag-table))
(substring string (match-end 0))
string))
-(defsubst elmo-msgdb-get-last-message-id (string)
- (if string
- (save-match-data
- (let (beg)
- (elmo-set-work-buf
- (insert string)
- (goto-char (point-max))
- (when (search-backward "<" nil t)
- (setq beg (point))
- (if (search-forward ">" nil t)
- (elmo-replace-in-string
- (buffer-substring beg (point)) "\n[ \t]*" ""))))))))
-
-(defun elmo-msgdb-number-load (dir)
- (elmo-object-load
- (expand-file-name elmo-msgdb-number-filename dir)))
-
-(defun elmo-msgdb-overview-load (dir)
- (elmo-object-load
- (expand-file-name elmo-msgdb-overview-filename dir)))
-
-(defun elmo-msgdb-mark-load (dir)
- (elmo-object-load
- (expand-file-name elmo-msgdb-mark-filename dir)))
-
(defsubst elmo-msgdb-seen-load (dir)
(elmo-object-load (expand-file-name
elmo-msgdb-seen-filename
dir)))
-(defun elmo-msgdb-number-save (dir obj)
- (elmo-object-save
- (expand-file-name elmo-msgdb-number-filename dir)
- obj))
-
-(defun elmo-msgdb-mark-save (dir obj)
- (elmo-object-save
- (expand-file-name elmo-msgdb-mark-filename dir)
- obj))
-
(defsubst elmo-msgdb-out-of-date-messages (msgdb)
(dolist (number (elmo-msgdb-list-flagged msgdb 'new))
(elmo-msgdb-unset-flag msgdb number 'new)))
-(defsubst elmo-msgdb-overview-save (dir overview)
- (elmo-object-save
- (expand-file-name elmo-msgdb-overview-filename dir)
- overview))
-
(defun elmo-msgdb-match-condition (msgdb condition number numbers)
"Check whether the condition of the message is satisfied or not.
MSGDB is the msgdb to search from.
Return CONDITION itself if no entity exists in msgdb."
(let ((entity (elmo-msgdb-message-entity msgdb number)))
(if entity
- (elmo-msgdb-match-condition-internal condition
+ (elmo-msgdb-match-condition-internal msgdb
+ condition
entity
(elmo-msgdb-flags msgdb number)
numbers)
condition)))
-;; entity -> parent-entity
-(defsubst elmo-msgdb-overview-get-parent-entity (entity database)
- (setq entity (elmo-msgdb-overview-entity-get-references entity))
- ;; entity is parent-id.
- (and entity (assoc entity database)))
-
-(defsubst elmo-msgdb-get-parent-entity (entity msgdb)
- (setq entity (elmo-msgdb-overview-entity-get-references entity))
- ;; entity is parent-id.
- (and entity (elmo-msgdb-message-entity msgdb entity)))
-
;;
;; deleted message handling
;;
(nth 1 (eword-extract-address-components
(or (elmo-field-body "from") "nobody"))) ">"))))
-(defsubst elmo-msgdb-create-overview-from-buffer (number &optional size time)
- "Create overview entity from current buffer.
-Header region is supposed to be narrowed."
- (save-excursion
- (let ((extras elmo-msgdb-extra-fields)
- (default-mime-charset default-mime-charset)
- message-id references from subject to cc date
- extra field-body charset)
- (elmo-set-buffer-multibyte default-enable-multibyte-characters)
- (setq message-id (elmo-msgdb-get-message-id-from-buffer))
- (and (setq charset (cdr (assoc "charset" (mime-read-Content-Type))))
- (setq charset (intern-soft charset))
- (setq default-mime-charset charset))
- (setq references
- (or (elmo-msgdb-get-last-message-id
- (elmo-field-body "in-reply-to"))
- (elmo-msgdb-get-last-message-id
- (elmo-field-body "references"))))
- (setq from (elmo-replace-in-string
- (elmo-mime-string (or (elmo-field-body "from")
- elmo-no-from))
- "\t" " ")
- subject (elmo-replace-in-string
- (elmo-mime-string (or (elmo-field-body "subject")
- elmo-no-subject))
- "\t" " "))
- (setq date (or (elmo-field-body "date") time))
- (setq to (mapconcat 'identity (elmo-multiple-field-body "to") ","))
- (setq cc (mapconcat 'identity (elmo-multiple-field-body "cc") ","))
- (or size
- (if (setq size (elmo-field-body "content-length"))
- (setq size (string-to-int size))
- (setq size 0)));; No mean...
- (while extras
- (if (setq field-body (elmo-field-body (car extras)))
- (setq extra (cons (cons (downcase (car extras))
- field-body) extra)))
- (setq extras (cdr extras)))
- (cons message-id (vector number references
- from subject date to cc
- size extra))
- )))
-
-(defsubst elmo-msgdb-insert-file-header (file)
- "Insert the header of the article."
- (let ((beg 0)
- insert-file-contents-pre-hook ; To avoid autoconv-xmas...
- insert-file-contents-post-hook
- format-alist)
- (when (file-exists-p file)
- ;; Read until header separator is found.
- (while (and (eq elmo-msgdb-file-header-chop-length
- (nth 1
- (insert-file-contents-as-binary
- file nil beg
- (incf beg elmo-msgdb-file-header-chop-length))))
- (prog1 (not (search-forward "\n\n" nil t))
- (goto-char (point-max))))))))
-
-(defsubst elmo-msgdb-create-overview-entity-from-file (number file)
- (let (insert-file-contents-pre-hook ; To avoid autoconv-xmas...
- insert-file-contents-post-hook header-end
- (attrib (file-attributes file))
- ret-val size mtime)
- (with-temp-buffer
- (if (not (file-exists-p file))
- ()
- (setq size (nth 7 attrib))
- (setq mtime (timezone-make-date-arpa-standard
- (current-time-string (nth 5 attrib)) (current-time-zone)))
- ;; insert header from file.
- (catch 'done
- (condition-case nil
- (elmo-msgdb-insert-file-header file)
- (error (throw 'done nil)))
- (goto-char (point-min))
- (setq header-end
- (if (re-search-forward "\\(^--.*$\\)\\|\\(\n\n\\)" nil t)
- (point)
- (point-max)))
- (narrow-to-region (point-min) header-end)
- (elmo-msgdb-create-overview-from-buffer number size mtime))))))
-
(defsubst elmo-folder-get-info (folder &optional hashtb)
(elmo-get-hash-val folder
(or hashtb elmo-folder-info-hashtb)))
(elmo-folder-name-internal folder))
(expand-file-name "nmz" elmo-msgdb-directory)))
-(defun elmo-nmz-msgdb-create-entity (folder number)
+(defun elmo-nmz-msgdb-create-entity (msgdb folder number)
"Create msgdb entity for the message in the FOLDER with NUMBER."
(let ((location (expand-file-name (elmo-map-message-location folder number)))
entity uid)
- (setq entity (elmo-msgdb-create-overview-entity-from-file number location))
- (unless (or (> (length (elmo-msgdb-overview-entity-get-to entity)) 0)
- (> (length (elmo-msgdb-overview-entity-get-cc entity)) 0)
- (not (string= (elmo-msgdb-overview-entity-get-subject entity)
+ (setq entity (elmo-msgdb-create-message-entity-from-file
+ msgdb number location))
+ (unless (or (> (length (elmo-message-entity-field entity 'to)) 0)
+ (> (length (elmo-message-entity-field entity 'cc)) 0)
+ (not (string= (elmo-message-entity-field entity 'subject)
elmo-no-subject)))
- (elmo-msgdb-overview-entity-set-subject entity location)
+ (elmo-message-entity-set-field entity 'subject location)
(setq uid (nth 2 (file-attributes location)))
- (elmo-msgdb-overview-entity-set-from entity
- (concat
- (user-full-name uid)
- " <"(user-login-name uid) "@"
- (system-name) ">")))
+ (elmo-message-entity-set-field entity 'from
+ (concat
+ (user-full-name uid)
+ " <"(user-login-name uid) "@"
+ (system-name) ">")))
entity))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-nmz-folder)
(while numlist
(setq entity
(elmo-nmz-msgdb-create-entity
- folder (car numlist)))
+ new-msgdb folder (car numlist)))
(when entity
(elmo-msgdb-append-entity new-msgdb entity '(new)))
(when (> num elmo-display-progress-threshold)
(setq extra (cons (cons ext field) extra))))
(setq extras (cdr extras)))
(setq entity (elmo-msgdb-make-message-entity
+ new-msgdb
:message-id (aref ov-entity 4)
:number num
:references (elmo-msgdb-get-last-message-id
(save-restriction
(narrow-to-region beg (point))
(setq entity
- (elmo-msgdb-create-overview-from-buffer num))
+ (elmo-msgdb-create-message-entity-from-buffer
+ new-msgdb num))
(when entity
(setq message-id
(elmo-message-entity-field entity 'message-id))
msgdb
(lambda (ent1 ent2 loc-alist)
(< (elmo-pop3-uidl-to-number
- (cdr (assq (elmo-msgdb-overview-entity-get-number ent1)
+ (cdr (assq (elmo-message-entity-number ent1)
loc-alist)))
(elmo-pop3-uidl-to-number
- (cdr (assq (elmo-msgdb-overview-entity-get-number ent2)
+ (cdr (assq (elmo-message-entity-number ent2)
loc-alist)))))
location-alist))
msgdb))
(save-restriction
(narrow-to-region beg (point))
(setq entity
- (elmo-msgdb-create-overview-from-buffer
- (car numlist)))
+ (elmo-msgdb-create-message-entity-from-buffer
+ new-msgdb (car numlist)))
(setq numlist (cdr numlist))
(when entity
(with-current-buffer (process-buffer process)
- (elmo-msgdb-overview-entity-set-size
+ (elmo-message-entity-set-field
entity
+ 'size
(string-to-number
(elmo-pop3-number-to-size
- (elmo-msgdb-overview-entity-get-number entity))))
+ (elmo-message-entity-number entity))))
(if (setq number
(car
(rassoc
(elmo-pop3-number-to-uidl
- (elmo-msgdb-overview-entity-get-number entity))
+ (elmo-message-entity-number entity))
loc-alist)))
- (elmo-msgdb-overview-entity-set-number entity number)))
+ (elmo-message-entity-set-number entity number)))
(setq message-id (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table message-id))
(elmo-global-flags-set flags folder number message-id)
(message "Creating msgdb...")
(while numbers
(setq entity
- (elmo-msgdb-create-overview-entity-from-file
- (car numbers) (elmo-message-file-name folder (car numbers))))
+ (elmo-msgdb-create-message-entity-from-filea
+ new-msgdb (car numbers)
+ (elmo-message-file-name folder (car numbers))))
(if (null entity)
(elmo-folder-set-killed-list-internal
folder
(nconc
(elmo-folder-killed-list-internal folder)
(list (car numbers))))
- (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+ (setq message-id (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table message-id))
(elmo-global-flags-set flags folder (car numbers) message-id)
(elmo-msgdb-append-entity new-msgdb entity flags))
(when overviews
(setq hash (elmo-make-hash (length overviews)))
(dolist (entity overviews)
- (elmo-set-hash-val (elmo-msgdb-overview-entity-get-id entity)
+ (elmo-set-hash-val (elmo-message-entity-field entity 'message-id)
entity hash)
- (when (setq id (elmo-msgdb-overview-entity-get-extra-field
- entity "x-original-id"))
+ (when (setq id (elmo-message-entity-field entity 'x-original-id))
(elmo-set-hash-val id entity hash)))
(elmo-shimbun-folder-set-entity-hash-internal folder hash)))))
(elmo-shimbun-folder-set-header-hash-internal
folder
(setq hash (elmo-make-hash))))
- (elmo-set-hash-val (elmo-msgdb-overview-entity-get-id entity)
+ (elmo-set-hash-val (elmo-message-entity-field entity
+ 'message-id)
header
hash)
header)))))
(defun elmo-shimbun-entity-to-header (entity)
(let (message-id shimbun-id)
- (if (setq message-id (elmo-msgdb-overview-entity-get-extra-field
- entity "x-original-id"))
- (setq shimbun-id (elmo-msgdb-overview-entity-get-id entity))
- (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+ (if (setq message-id (elmo-message-entity-field
+ entity 'x-original-id))
+ (setq shimbun-id (elmo-message-entity-field entity 'message-id))
+ (setq message-id (elmo-message-entity-field entity 'message-id)
shimbun-id nil))
(elmo-set-work-buf
(set-buffer-multibyte t)
(shimbun-make-header
- (elmo-msgdb-overview-entity-get-number entity)
+ (elmo-message-entity-number entity)
(shimbun-mime-encode-string
- (decode-mime-charset-string
- (elmo-msgdb-overview-entity-get-subject-no-decode entity)
- elmo-mime-charset))
+ (elmo-message-entity-field entity 'subject 'decode))
(shimbun-mime-encode-string
- (decode-mime-charset-string
- (elmo-msgdb-overview-entity-get-from-no-decode entity)
- elmo-mime-charset))
- (elmo-msgdb-overview-entity-get-date entity)
+ (elmo-message-entity-field entity 'from 'decode))
+ (elmo-message-entity-field entity 'date)
message-id
- (elmo-msgdb-overview-entity-get-references entity)
+ (elmo-message-entity-field entity 'references)
0
0
- (elmo-msgdb-overview-entity-get-extra-field entity "xref")
+ (elmo-message-entity-field entity 'xref)
(and shimbun-id
(list (cons "x-shimbun-id" shimbun-id)))))))
(shimbun-header-insert
(elmo-shimbun-folder-shimbun-internal folder)
header)
- (setq ov (elmo-msgdb-create-overview-from-buffer number))
- (elmo-msgdb-overview-entity-set-extra
+ (setq ov (elmo-msgdb-create-message-entity-from-buffer
+ (elmo-folder-msgdb-internal folder) number))
+ (elmo-message-entity-set-field
ov
- (nconc
- (elmo-msgdb-overview-entity-get-extra ov)
- (list (cons "xref" (shimbun-header-xref header)))))))))
+ 'xref (shimbun-header-xref header)))
+ ov)))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder)
numlist flag-table)
(elmo-shimbun-msgdb-create-entity
folder (car numlist)))
(when entity
- (setq msgid (elmo-msgdb-overview-entity-get-id entity)
+ (setq msgid (elmo-message-entity-field entity 'message-id)
flags (elmo-flag-table-get flag-table msgid))
(elmo-global-flags-set flags folder (car numlist) msgid)
(elmo-msgdb-append-entity new-msgdb entity flags))
(message-id (shimbun-header-id header))
references)
(unless (string= shimbun-id message-id)
- (elmo-msgdb-overview-entity-set-extra-field
- entity "x-original-id" message-id)
+ (elmo-message-entity-set-field
+ entity 'x-original-id message-id)
(elmo-shimbun-header-set-extra-field
header "x-shimbun-id" shimbun-id)
(elmo-set-hash-val message-id
(elmo-set-hash-val shimbun-id
entity
(elmo-shimbun-folder-entity-hash folder)))
- (elmo-msgdb-overview-entity-set-from
+ (elmo-message-entity-set-field
entity
+ 'from
(elmo-mime-string (shimbun-header-from header)))
- (elmo-msgdb-overview-entity-set-subject
+ (elmo-message-entity-set-field
entity
+ 'subject
(elmo-mime-string (shimbun-header-subject header)))
- (elmo-msgdb-overview-entity-set-date
- entity (shimbun-header-date header))
+ (elmo-message-entity-set-field
+ entity
+ 'date
+ (shimbun-header-date header))
(when (setq references
(or (elmo-msgdb-get-last-message-id
(elmo-field-body "in-reply-to"))
(elmo-msgdb-get-last-message-id
(elmo-field-body "references"))))
- (elmo-msgdb-overview-entity-set-references
+ (elmo-message-entity-set-field
entity
- (or (elmo-msgdb-overview-entity-get-id
- (elmo-get-hash-val
- references
- (elmo-shimbun-folder-entity-hash folder)))
+ 'references
+ (or (elmo-message-entity-field entity 'message-id)
+ (elmo-get-hash-val
+ references
+ (elmo-shimbun-folder-entity-hash folder))
references)))))
(luna-define-method elmo-map-message-fetch ((folder elmo-shimbun-folder)
(delq nil
(mapcar
(lambda (ov)
- (when (and (elmo-msgdb-overview-entity-get-extra-field
- ov "xref")
+ (when (and (elmo-message-entity-field ov 'xref)
(if expire-days
(< (elmo-shimbun-lapse-seconds
(elmo-shimbun-parse-time-string
- (elmo-msgdb-overview-entity-get-date ov)))
+ (elmo-message-entity-field ov 'date)))
(* expire-days 86400 ; seconds per day
))
t))
- (elmo-msgdb-overview-entity-get-id ov)))
+ (elmo-message-entity-field ov 'message-id)))
(elmo-folder-list-message-entities folder)))
(mapcar
(lambda (header)
(elmo-resque-obsolete-variable (cdr pair)
(car pair))))
+(defsubst elmo-msgdb-get-last-message-id (string)
+ (if string
+ (save-match-data
+ (let (beg)
+ (elmo-set-work-buf
+ (insert string)
+ (goto-char (point-max))
+ (when (search-backward "<" nil t)
+ (setq beg (point))
+ (if (search-forward ">" nil t)
+ (elmo-replace-in-string
+ (buffer-substring beg (point)) "\n[ \t]*" ""))))))))
+
+(defun elmo-msgdb-get-message-id-from-buffer ()
+ (let ((msgid (elmo-field-body "message-id")))
+ (if msgid
+ (if (string-match "<\\(.+\\)>$" msgid)
+ msgid
+ (concat "<" msgid ">")) ; Invaild message-id.
+ ;; no message-id, so put dummy msgid.
+ (concat "<" (timezone-make-date-sortable
+ (elmo-field-body "date"))
+ (nth 1 (eword-extract-address-components
+ (or (elmo-field-body "from") "nobody"))) ">"))))
+
;;; Queue.
(defvar elmo-dop-queue-filename "queue"
"*Disconnected operation queue is saved in this file.")
(luna-define-method elmo-find-fetch-strategy
((folder elmo-folder) entity &optional ignore-cache)
(let (cache-file size message-id number)
- (setq size (elmo-msgdb-overview-entity-get-size entity))
- (setq message-id (elmo-msgdb-overview-entity-get-id entity))
- (setq number (elmo-msgdb-overview-entity-get-number entity))
+ (setq size (elmo-message-entity-field entity 'size))
+ (setq message-id (elmo-message-entity-field entity 'message-id))
+ (setq number (elmo-message-entity-number entity))
(setq cache-file (elmo-file-cache-get message-id))
(setq ignore-cache (or ignore-cache
(null (elmo-message-use-cache-p folder number))))
(elmo-msgdb-unset-flag (elmo-folder-msgdb folder) number 'cached)))
(defun elmo-message-copy-entity (entity)
- ;;
- (elmo-msgdb-copy-overview-entity entity))
-
-(defun elmo-message-entity-set-number (entity number)
- (elmo-msgdb-overview-entity-set-number entity number))
+ (elmo-msgdb-copy-message-entity (elmo-message-entity-db entity)
+ entity))
(luna-define-generic elmo-message-entity (folder key)
"Return the message-entity structure which matches to the KEY.
,@form))
(defmacro elmo-message-entity-number (entity)
- `(elmo-msgdb-overview-entity-get-number ,entity))
+ `(elmo-msgdb-message-entity-number (elmo-message-entity-db ,entity)
+ ,entity))
+
+(defmacro elmo-message-entity-set-number (entity number)
+ `(elmo-msgdb-message-entity-set-number (elmo-message-entity-db ,entity)
+ ,entity
+ ,number))
(defun elmo-message-entity-field (entity field &optional decode)
"Get message entity field value.
ENTITY is the message entity structure obtained by `elmo-message-entity'.
FIELD is the symbol of the field name.
if optional DECODE is non-nil, returned value is decoded."
- (elmo-msgdb-message-entity-field entity field decode))
+ (elmo-msgdb-message-entity-field
+ (elmo-message-entity-db entity)
+ entity field decode))
(defun elmo-message-entity-set-field (entity field value)
"Set message entity field value.
ENTITY is the message entity structure.
FIELD is the symbol of the field name.
VALUE is the field value (raw)."
- (elmo-msgdb-message-entity-set-field entity field value))
+ (elmo-msgdb-message-entity-set-field
+ (elmo-message-entity-db entity)
+ entity field value))
(luna-define-generic elmo-folder-count-flags (folder)
"Count flagged message number in the msgdb of the FOLDER.
(luna-define-method elmo-message-field ((folder elmo-folder) number field)
(when (zerop (elmo-folder-length folder))
(error "Cannot treat this folder correctly."))
- (elmo-msgdb-get-field (elmo-folder-msgdb folder) number field))
+ (elmo-msgdb-message-entity-field (elmo-folder-msgdb folder)
+ (elmo-message-entity folder number)
+ field))
(luna-define-method elmo-message-use-cache-p ((folder elmo-folder) number)
nil) ; default is not use cache.
(require 'elmo-util)
(require 'modb)
-(require 'modb-entity)
;;; legacy implement
;;
(defsubst elmo-msgdb-set-path (msgdb path)
(modb-generic-set-location-internal msgdb path))
+;;;
+;; Internal use only (obsolete interface)
+;;
+;;
+;; mime decode cache
+;;
+(defvar elmo-msgdb-decoded-cache-hashtb nil)
+(make-variable-buffer-local 'elmo-msgdb-decoded-cache-hashtb)
+
+(defsubst elmo-msgdb-get-decoded-cache (string)
+ (if elmo-use-decoded-cache
+ (let ((hashtb (or elmo-msgdb-decoded-cache-hashtb
+ (setq elmo-msgdb-decoded-cache-hashtb
+ (elmo-make-hash 2048))))
+ decoded)
+ (or (elmo-get-hash-val string hashtb)
+ (progn
+ (elmo-set-hash-val
+ string
+ (setq decoded
+ (decode-mime-charset-string string elmo-mime-charset))
+ hashtb)
+ decoded)))
+ (decode-mime-charset-string string elmo-mime-charset)))
+
+(defsubst elmo-msgdb-overview-entity-get-id (entity)
+ (and entity (car entity)))
+
+(defsubst elmo-msgdb-overview-entity-get-number (entity)
+ (and entity (aref (cdr entity) 0)))
+
+(defsubst elmo-msgdb-overview-entity-set-number (entity number)
+ (and entity (aset (cdr entity) 0 number))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-references (entity)
+ (and entity (aref (cdr entity) 1)))
+
+(defsubst elmo-msgdb-overview-entity-set-references (entity references)
+ (and entity (aset (cdr entity) 1 references))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-from-no-decode (entity)
+ (and entity (aref (cdr entity) 2)))
+
+(defsubst elmo-msgdb-overview-entity-get-from (entity)
+ (and entity
+ (aref (cdr entity) 2)
+ (elmo-msgdb-get-decoded-cache (aref (cdr entity) 2))))
+
+(defsubst elmo-msgdb-overview-entity-set-from (entity from)
+ (and entity (aset (cdr entity) 2 from))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-subject (entity)
+ (and entity
+ (aref (cdr entity) 3)
+ (elmo-msgdb-get-decoded-cache (aref (cdr entity) 3))))
+
+(defsubst elmo-msgdb-overview-entity-get-subject-no-decode (entity)
+ (and entity (aref (cdr entity) 3)))
+
+(defsubst elmo-msgdb-overview-entity-set-subject (entity subject)
+ (and entity (aset (cdr entity) 3 subject))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-date (entity)
+ (and entity (aref (cdr entity) 4)))
+
+(defsubst elmo-msgdb-overview-entity-set-date (entity date)
+ (and entity (aset (cdr entity) 4 date))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-to (entity)
+ (and entity (aref (cdr entity) 5)))
+
+(defsubst elmo-msgdb-overview-entity-get-cc (entity)
+ (and entity (aref (cdr entity) 6)))
+
+(defsubst elmo-msgdb-overview-entity-get-size (entity)
+ (and entity (aref (cdr entity) 7)))
+
+(defsubst elmo-msgdb-overview-entity-set-size (entity size)
+ (and entity (aset (cdr entity) 7 size))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-extra (entity)
+ (and entity (aref (cdr entity) 8)))
+
+(defsubst elmo-msgdb-overview-entity-set-extra (entity extra)
+ (and entity (aset (cdr entity) 8 extra))
+ entity)
+
+(defsubst elmo-msgdb-overview-entity-get-extra-field (entity field-name)
+ (let ((field-name (downcase field-name))
+ (extra (and entity (aref (cdr entity) 8))))
+ (and extra
+ (cdr (assoc field-name extra)))))
+
+(defsubst elmo-msgdb-overview-entity-set-extra-field (entity field-name value)
+ (let ((field-name (downcase field-name))
+ (extras (and entity (aref (cdr entity) 8)))
+ extra)
+ (if (setq extra (assoc field-name extras))
+ (setcdr extra value)
+ (elmo-msgdb-overview-entity-set-extra
+ entity
+ (cons (cons field-name value) extras)))))
+
+;;; load & save
+(defun elmo-msgdb-number-load (dir)
+ (elmo-object-load
+ (expand-file-name elmo-msgdb-number-filename dir)))
+
+(defun elmo-msgdb-overview-load (dir)
+ (elmo-object-load
+ (expand-file-name elmo-msgdb-overview-filename dir)))
+
+(defun elmo-msgdb-mark-load (dir)
+ (elmo-object-load
+ (expand-file-name elmo-msgdb-mark-filename dir)))
+
+(defun elmo-msgdb-number-save (dir obj)
+ (elmo-object-save
+ (expand-file-name elmo-msgdb-number-filename dir)
+ obj))
+
+(defun elmo-msgdb-mark-save (dir obj)
+ (elmo-object-save
+ (expand-file-name elmo-msgdb-mark-filename dir)
+ obj))
+
+(defsubst elmo-msgdb-overview-save (dir overview)
+ (elmo-object-save
+ (expand-file-name elmo-msgdb-overview-filename dir)
+ overview))
+
+;;;
+
+
(defvar modb-legacy-unread-marks-internal nil)
(defsubst modb-legacy-unread-marks ()
"Return an unread mark list"
msgdb))
(luna-define-method elmo-msgdb-message-entity ((msgdb modb-legacy) key)
- (elmo-get-hash-val
+ (elmo-get-hash-val
(cond ((stringp key) key)
((numberp key) (format "#%d" key)))
(elmo-msgdb-get-entity-hashtb msgdb)))
+;;; Message entity handling.
+(defsubst modb-legacy-make-message-entity (args)
+ "Make an message entity."
+ (cons (plist-get args :message-id)
+ (vector (plist-get args :number)
+ (plist-get args :references)
+ (plist-get args :from)
+ (plist-get args :subject)
+ (plist-get args :date)
+ (plist-get args :to)
+ (plist-get args :cc)
+ (plist-get args :size)
+ (plist-get args :extra))))
+
+(luna-define-method elmo-msgdb-make-message-entity ((msgdb modb-legacy)
+ args)
+ (modb-legacy-make-message-entity args))
+
+(defsubst elmo-msgdb-insert-file-header (file)
+ "Insert the header of the article."
+ (let ((beg 0)
+ insert-file-contents-pre-hook ; To avoid autoconv-xmas...
+ insert-file-contents-post-hook
+ format-alist)
+ (when (file-exists-p file)
+ ;; Read until header separator is found.
+ (while (and (eq elmo-msgdb-file-header-chop-length
+ (nth 1
+ (insert-file-contents-as-binary
+ file nil beg
+ (incf beg elmo-msgdb-file-header-chop-length))))
+ (prog1 (not (search-forward "\n\n" nil t))
+ (goto-char (point-max))))))))
+
+(luna-define-method elmo-msgdb-create-message-entity-from-file
+ ((msgdb modb-legacy) number file)
+ (let (insert-file-contents-pre-hook ; To avoid autoconv-xmas...
+ insert-file-contents-post-hook header-end
+ (attrib (file-attributes file))
+ ret-val size mtime)
+ (with-temp-buffer
+ (if (not (file-exists-p file))
+ ()
+ (setq size (nth 7 attrib))
+ (setq mtime (timezone-make-date-arpa-standard
+ (current-time-string (nth 5 attrib)) (current-time-zone)))
+ ;; insert header from file.
+ (catch 'done
+ (condition-case nil
+ (elmo-msgdb-insert-file-header file)
+ (error (throw 'done nil)))
+ (goto-char (point-min))
+ (setq header-end
+ (if (re-search-forward "\\(^--.*$\\)\\|\\(\n\n\\)" nil t)
+ (point)
+ (point-max)))
+ (narrow-to-region (point-min) header-end)
+ (elmo-msgdb-create-message-entity-from-buffer
+ msgdb number :size size :date mtime))))))
+
+(luna-define-method elmo-msgdb-create-message-entity-from-buffer
+ ((msgdb modb-legacy) number args)
+ (let ((extras elmo-msgdb-extra-fields)
+ (default-mime-charset default-mime-charset)
+ entity message-id references from subject to cc date
+ extra field-body charset size)
+ (save-excursion
+ (setq entity (modb-legacy-make-message-entity args))
+ (elmo-set-buffer-multibyte default-enable-multibyte-characters)
+ (setq message-id (elmo-msgdb-get-message-id-from-buffer))
+ (and (setq charset (cdr (assoc "charset" (mime-read-Content-Type))))
+ (setq charset (intern-soft charset))
+ (setq default-mime-charset charset))
+ (setq references
+ (or (elmo-msgdb-get-last-message-id
+ (elmo-field-body "in-reply-to"))
+ (elmo-msgdb-get-last-message-id
+ (elmo-field-body "references")))
+ from (elmo-replace-in-string
+ (elmo-mime-string (or (elmo-field-body "from")
+ elmo-no-from))
+ "\t" " ")
+ subject (elmo-replace-in-string
+ (elmo-mime-string (or (elmo-field-body "subject")
+ elmo-no-subject))
+ "\t" " ")
+ date (elmo-field-body "date")
+ to (mapconcat 'identity (elmo-multiple-field-body "to") ",")
+ cc (mapconcat 'identity (elmo-multiple-field-body "cc") ","))
+ (unless (elmo-msgdb-message-entity-field msgdb entity 'size)
+ (if (setq size (elmo-field-body "content-length"))
+ (setq size (string-to-int size))
+ (setq size 0)))
+ (while extras
+ (if (setq field-body (elmo-field-body (car extras)))
+ (setq extra (cons (cons (downcase (car extras))
+ field-body) extra)))
+ (setq extras (cdr extras)))
+ (dolist (field '(message-id number references from subject date to cc
+ size extra))
+ (when (symbol-value field)
+ (elmo-msgdb-message-entity-set-field
+ msgdb entity field (symbol-value field))))
+ entity)))
+
+;;; Message entity interface
+;;
+(luna-define-method elmo-msgdb-message-entity-number ((msgdb modb-legacy)
+ entity)
+ (and entity (aref (cdr entity) 0)))
+
+(luna-define-method elmo-msgdb-message-entity-set-number ((msgdb modb-legacy)
+ entity
+ number)
+ (and entity (aset (cdr entity) 0 number))
+ entity)
+
+(luna-define-method elmo-msgdb-message-entity-field ((msgdb modb-legacy)
+ entity field
+ &optional decode)
+ (and entity
+ (let ((field-value
+ (case field
+ (to (aref (cdr entity) 5))
+ (cc (aref (cdr entity) 6))
+ (date (aref (cdr entity) 4))
+ (subject (aref (cdr entity) 3))
+ (from (aref (cdr entity) 2))
+ (message-id (car entity))
+ (references (aref (cdr entity) 1))
+ (size (aref (cdr entity) 7))
+ (t (cdr (assoc (symbol-name field) (aref (cdr entity) 8)))))))
+ (if (and decode (memq field '(from subject)))
+ (elmo-msgdb-get-decoded-cache field-value)
+ field-value))))
+
+(luna-define-method elmo-msgdb-message-entity-set-field ((msgdb modb-legacy)
+ entity field value)
+ (and entity
+ (case field
+ (number (aset (cdr entity) 0 value))
+ (to (aset (cdr entity) 5 value))
+ (cc (aset (cdr entity) 6 value))
+ (date (aset (cdr entity) 4 value))
+ (subject (aset (cdr entity) 3 value))
+ (from (aset (cdr entity) 2 value))
+ (message-id (setcar entity value))
+ (references (aset (cdr entity) 1 value))
+ (size (aset (cdr entity) 7 value))
+ (t
+ (let ((extras (and entity (aref (cdr entity) 8)))
+ extra)
+ (if (setq extra (assoc field extras))
+ (setcdr extra value)
+ (aset (cdr entity) 8 (cons (cons (symbol-name field)
+ value) extras))))))))
+
+(luna-define-method elmo-msgdb-copy-message-entity ((msgdb modb-legacy)
+ entity)
+ (cons (car entity)
+ (copy-sequence (cdr entity))))
+
+(luna-define-method elmo-msgdb-match-condition-internal ((msgdb modb-legacy)
+ condition
+ entity flags numbers)
+ (cond
+ ((vectorp condition)
+ (elmo-msgdb-match-condition-primitive condition entity flags numbers))
+ ((eq (car condition) 'and)
+ (let ((lhs (elmo-msgdb-match-condition-internal msgdb
+ (nth 1 condition)
+ entity flags numbers)))
+ (cond
+ ((elmo-filter-condition-p lhs)
+ (let ((rhs (elmo-msgdb-match-condition-internal
+ msgdb (nth 2 condition) entity flags numbers)))
+ (cond ((elmo-filter-condition-p rhs)
+ (list 'and lhs rhs))
+ (rhs
+ lhs))))
+ (lhs
+ (elmo-msgdb-match-condition-internal msgdb (nth 2 condition)
+ entity flags numbers)))))
+ ((eq (car condition) 'or)
+ (let ((lhs (elmo-msgdb-match-condition-internal msgdb (nth 1 condition)
+ entity flags numbers)))
+ (cond
+ ((elmo-filter-condition-p lhs)
+ (let ((rhs (elmo-msgdb-match-condition-internal msgdb
+ (nth 2 condition)
+ entity flags numbers)))
+ (cond ((elmo-filter-condition-p rhs)
+ (list 'or lhs rhs))
+ (rhs
+ t)
+ (t
+ lhs))))
+ (lhs
+ t)
+ (t
+ (elmo-msgdb-match-condition-internal msgdb
+ (nth 2 condition)
+ entity flags numbers)))))))
+
+;;
+(defun elmo-msgdb-match-condition-primitive (condition entity flags numbers)
+ (catch 'unresolved
+ (let ((key (elmo-filter-key condition))
+ (case-fold-search t)
+ result)
+ (cond
+ ((string= key "last")
+ (setq result (<= (length (memq
+ (elmo-msgdb-overview-entity-get-number
+ entity)
+ numbers))
+ (string-to-int (elmo-filter-value condition)))))
+ ((string= key "first")
+ (setq result (< (-
+ (length numbers)
+ (length (memq
+ (elmo-msgdb-overview-entity-get-number
+ entity)
+ numbers)))
+ (string-to-int (elmo-filter-value condition)))))
+ ((string= key "flag")
+ (setq result
+ (cond
+ ((string= (elmo-filter-value condition) "any")
+ (or (memq 'important flags)
+ (memq 'answered flags)
+ (memq 'unread flags)))
+ ((string= (elmo-filter-value condition) "digest")
+ (or (memq 'important flags)
+ (memq 'unread flags)))
+ ((string= (elmo-filter-value condition) "unread")
+ (memq 'unread flags))
+ ((string= (elmo-filter-value condition) "important")
+ (memq 'important flags))
+ ((string= (elmo-filter-value condition) "answered")
+ (memq 'answered flags)))))
+ ((string= key "from")
+ (setq result (string-match
+ (elmo-filter-value condition)
+ (elmo-msgdb-overview-entity-get-from entity))))
+ ((string= key "subject")
+ (setq result (string-match
+ (elmo-filter-value condition)
+ (elmo-msgdb-overview-entity-get-subject entity))))
+ ((string= key "to")
+ (setq result (string-match
+ (elmo-filter-value condition)
+ (elmo-msgdb-overview-entity-get-to entity))))
+ ((string= key "cc")
+ (setq result (string-match
+ (elmo-filter-value condition)
+ (elmo-msgdb-overview-entity-get-cc entity))))
+ ((or (string= key "since")
+ (string= key "before"))
+ (let ((field-date (elmo-date-make-sortable-string
+ (timezone-fix-time
+ (elmo-msgdb-overview-entity-get-date entity)
+ (current-time-zone) nil)))
+ (specified-date
+ (elmo-date-make-sortable-string
+ (elmo-date-get-datevec
+ (elmo-filter-value condition)))))
+ (setq result (if (string= key "since")
+ (or (string= specified-date field-date)
+ (string< specified-date field-date))
+ (string< field-date specified-date)))))
+ ((member key elmo-msgdb-extra-fields)
+ (let ((extval (elmo-msgdb-overview-entity-get-extra-field entity key)))
+ (when (stringp extval)
+ (setq result (string-match
+ (elmo-filter-value condition)
+ extval)))))
+ (t
+ (throw 'unresolved condition)))
+ (if (eq (elmo-filter-type condition) 'unmatch)
+ (not result)
+ result))))
+
(require 'product)
(product-provide (provide 'modb-legacy) (require 'elmo-version))
(require 'elmo-util)
(require 'modb)
-(require 'modb-entity)
+;; Currently, entity structure is same as legacy.
+(require 'modb-legacy)
(defcustom modb-standard-divide-number 500
(modb-standard-entity-map-internal msgdb)))
ret)))
+;;; Message entity handling.
+(defsubst modb-standard-make-message-entity (args)
+ "Make an message entity."
+ (cons (plist-get args :message-id)
+ (vector (plist-get args :number)
+ (plist-get args :references)
+ (plist-get args :from)
+ (plist-get args :subject)
+ (plist-get args :date)
+ (plist-get args :to)
+ (plist-get args :cc)
+ (plist-get args :size)
+ (plist-get args :extra))))
+
+(luna-define-method elmo-msgdb-make-message-entity ((msgdb modb-standard)
+ args)
+ (modb-standard-make-message-entity args))
+
+(luna-define-method elmo-msgdb-create-message-entity-from-file
+ ((msgdb modb-standard) number file)
+ (let (insert-file-contents-pre-hook ; To avoid autoconv-xmas...
+ insert-file-contents-post-hook header-end
+ (attrib (file-attributes file))
+ ret-val size mtime)
+ (with-temp-buffer
+ (if (not (file-exists-p file))
+ ()
+ (setq size (nth 7 attrib))
+ (setq mtime (timezone-make-date-arpa-standard
+ (current-time-string (nth 5 attrib)) (current-time-zone)))
+ ;; insert header from file.
+ (catch 'done
+ (condition-case nil
+ (elmo-msgdb-insert-file-header file)
+ (error (throw 'done nil)))
+ (goto-char (point-min))
+ (setq header-end
+ (if (re-search-forward "\\(^--.*$\\)\\|\\(\n\n\\)" nil t)
+ (point)
+ (point-max)))
+ (narrow-to-region (point-min) header-end)
+ (elmo-msgdb-create-message-entity-from-buffer
+ msgdb number :size size :date mtime))))))
+
+(luna-define-method elmo-msgdb-create-message-entity-from-buffer
+ ((msgdb modb-standard) number args)
+ (let ((extras elmo-msgdb-extra-fields)
+ (default-mime-charset default-mime-charset)
+ entity message-id references from subject to cc date
+ extra field-body charset size)
+ (save-excursion
+ (setq entity (modb-standard-make-message-entity args))
+ (elmo-set-buffer-multibyte default-enable-multibyte-characters)
+ (setq message-id (elmo-msgdb-get-message-id-from-buffer))
+ (and (setq charset (cdr (assoc "charset" (mime-read-Content-Type))))
+ (setq charset (intern-soft charset))
+ (setq default-mime-charset charset))
+ (setq references
+ (or (elmo-msgdb-get-last-message-id
+ (elmo-field-body "in-reply-to"))
+ (elmo-msgdb-get-last-message-id
+ (elmo-field-body "references")))
+ from (elmo-replace-in-string
+ (elmo-mime-string (or (elmo-field-body "from")
+ elmo-no-from))
+ "\t" " ")
+ subject (elmo-replace-in-string
+ (elmo-mime-string (or (elmo-field-body "subject")
+ elmo-no-subject))
+ "\t" " ")
+ date (elmo-field-body "date")
+ to (mapconcat 'identity (elmo-multiple-field-body "to") ",")
+ cc (mapconcat 'identity (elmo-multiple-field-body "cc") ","))
+ (unless (elmo-msgdb-message-entity-field msgdb entity 'size)
+ (if (setq size (elmo-field-body "content-length"))
+ (setq size (string-to-int size))
+ (setq size 0)))
+ (while extras
+ (if (setq field-body (elmo-field-body (car extras)))
+ (setq extra (cons (cons (downcase (car extras))
+ field-body) extra)))
+ (setq extras (cdr extras)))
+ (dolist (field '(number message-id references from subject date to cc
+ size extra))
+ (when (symbol-value field)
+ (elmo-msgdb-message-entity-set-field
+ msgdb entity field (symbol-value field))))
+ entity)))
+
+;;; Message entity interface
+;;
+(luna-define-method elmo-msgdb-message-entity-field ((msgdb modb-standard)
+ entity field
+ &optional decode)
+ (and entity
+ (let ((field-value
+ (case field
+ (to (aref (cdr entity) 5))
+ (cc (aref (cdr entity) 6))
+ (date (aref (cdr entity) 4))
+ (subject (aref (cdr entity) 3))
+ (from (aref (cdr entity) 2))
+ (message-id (car entity))
+ (references (aref (cdr entity) 1))
+ (size (aref (cdr entity) 7))
+ (t (cdr (assoc (symbol-name field) (aref (cdr entity) 8)))))))
+ (if (and decode (memq field '(from subject)))
+ (elmo-msgdb-get-decoded-cache field-value)
+ field-value))))
+
+(luna-define-method elmo-msgdb-message-entity-set-field ((msgdb modb-standard)
+ entity field value)
+ (and entity
+ (case field
+ (number (aset (cdr entity) 0 value))
+ (to (aset (cdr entity) 5 value))
+ (cc (aset (cdr entity) 6 value))
+ (date (aset (cdr entity) 4 value))
+ (subject (aset (cdr entity) 3 value))
+ (from (aset (cdr entity) 2 value))
+ (message-id (setcar entity value))
+ (references (aset (cdr entity) 1 value))
+ (size (aset (cdr entity) 7 value))
+ (t
+ (let ((extras (and entity (aref (cdr entity) 8)))
+ extra)
+ (if (setq extra (assoc field extras))
+ (setcdr extra value)
+ (aset (cdr entity) 8 (cons (cons (symbol-name field)
+ value) extras))))))))
+
+(luna-define-method elmo-msgdb-copy-message-entity ((msgdb modb-standard)
+ entity)
+ (cons (car entity)
+ (copy-sequence (cdr entity))))
+
+(luna-define-method elmo-msgdb-match-condition-internal ((msgdb modb-standard)
+ condition
+ entity flags numbers)
+ (cond
+ ((vectorp condition)
+ (elmo-msgdb-match-condition-primitive condition entity flags numbers))
+ ((eq (car condition) 'and)
+ (let ((lhs (elmo-msgdb-match-condition-internal msgdb
+ (nth 1 condition)
+ entity flags numbers)))
+ (cond
+ ((elmo-filter-condition-p lhs)
+ (let ((rhs (elmo-msgdb-match-condition-internal
+ msgdb (nth 2 condition) entity flags numbers)))
+ (cond ((elmo-filter-condition-p rhs)
+ (list 'and lhs rhs))
+ (rhs
+ lhs))))
+ (lhs
+ (elmo-msgdb-match-condition-internal msgdb (nth 2 condition)
+ entity flags numbers)))))
+ ((eq (car condition) 'or)
+ (let ((lhs (elmo-msgdb-match-condition-internal msgdb (nth 1 condition)
+ entity flags numbers)))
+ (cond
+ ((elmo-filter-condition-p lhs)
+ (let ((rhs (elmo-msgdb-match-condition-internal msgdb
+ (nth 2 condition)
+ entity flags numbers)))
+ (cond ((elmo-filter-condition-p rhs)
+ (list 'or lhs rhs))
+ (rhs
+ t)
+ (t
+ lhs))))
+ (lhs
+ t)
+ (t
+ (elmo-msgdb-match-condition-internal msgdb
+ (nth 2 condition)
+ entity flags numbers)))))))
(require 'product)
(product-provide (provide 'modb-standard) (require 'elmo-version))
(luna-define-generic elmo-msgdb-delete-messages (msgdb numbers)
"Delete messages which are contained NUMBERS from MSGDB.")
-(luna-define-generic elmo-msgdb-sort-entities (msgdb predicate &optional app-data)
+(luna-define-generic elmo-msgdb-sort-entities (msgdb predicate
+ &optional app-data)
"Sort entities of MSGDB, comparing with PREDICATE.
PREDICATE is called with two entities and APP-DATA.
Should return non-nil if the first entity is \"less\" than the second.")
A number is for message number in the MSGDB.
A string is for message-id of the message.")
+;; Message entity handling.
+(defvar modb-cache-internal nil)
+(defun elmo-message-entity-db (entity)
+ "Get modb instance which corresponds to the ENTITY."
+ (if (or (null (car entity))
+ (stringp (car entity)))
+ ;; Transitional implementation for modb-legacy.
+ (or modb-cache-internal
+ (progn
+ (require 'modb-legacy)
+ (setq modb-cache-internal (luna-make-entity 'modb-legacy))))
+ ;; XXX Next generation entity structure...not decided yet.
+ (car entity)))
+
+(luna-define-generic elmo-msgdb-make-message-entity (msgdb
+ &rest args)
+ "Make a message entity for MSGDB.")
+
+(luna-define-generic elmo-msgdb-message-entity-number (msgdb entity)
+ "Number of the ENTITY.")
+
+(luna-define-generic elmo-msgdb-message-entity-set-number (msgdb entity number)
+ "Set number of the ENTITY.")
+
+(luna-define-generic elmo-msgdb-message-entity-field (msgdb
+ entity field
+ &optional decode)
+ "Retrieve field value of the message entity.
+MSGDB is the msgdb structure.
+ENTITY is the message entity structure.
+FIELD is a symbol of the field.
+If optional DECODE is no-nil, the field value is decoded.")
+
+(luna-define-generic elmo-msgdb-message-entity-set-field (msgdb
+ entity field value)
+ "Set the field value of the message entity.
+MSGDB is the msgdb structure.
+ENTITY is the message entity structure.
+FIELD is a symbol of the field.
+VALUE is the field value to set.")
+
+(luna-define-generic elmo-msgdb-copy-message-entity (msgdb entity)
+ "Copy message entity.
+MSGDB is the msgdb structure.
+ENTITY is the message entity structure.")
+
+(luna-define-generic elmo-msgdb-create-message-entity-from-file (msgdb number
+ file)
+ "Create message entity from file.
+MSGDB is the msgdb structure.
+NUMBER is the number of the newly created message entity.
+FILE is the message file.")
+
+(luna-define-generic elmo-msgdb-create-message-entity-from-buffer (msgdb
+ number
+ &rest args)
+ "Create message entity from current buffer.
+NUMBER is the number of the newly created message entity.
+Rest of the ARGS is a plist of message entity field for initial value.
+Header region is supposed to be narrowed.")
+
+;; Transitional interface.
+(luna-define-generic elmo-msgdb-match-condition-internal (msgdb
+ condition
+ entity
+ flags
+ numbers)
+ "Return non-nil when the entity matches the condition.")
+
;;; generic implement
;;
(luna-define-method elmo-msgdb-load ((msgdb modb-generic))
2003-09-21 Yuuichi Teranishi <teranisi@gohome.org>
+ * wl-summary.el (wl-summary-detect-mark-position): Follow the API
+ change in elmo-msgdb-make-message-entity.
+ (wl-summary-buffer-set-folder): Don't call
+ wl-summary-detect-mark-position here.
+ (wl-summary-rescan): Call elmo-message-entity-number.
+ (wl-summary-sync-update): Ditto.
+ (wl-summary-goto-folder-subr): Call wl-summary-detect-mark-position.
+
+ * wl-score.el (wl-score-header-index): Redefine 2th element.
+ (wl-score-overview-entity-get-extra): Abolish.
+ (wl-score-ov-entity-get): Rewrite.
+ (wl-score-string-index<, wl-score-string-func<): Abolish.
+ (wl-score-string<): New function.
+ (wl-score-string-sort): Use it.
+
+ * wl-refile.el (wl-refile-guess-by-history): Use
+ elmo-message-entity-field.
+ (wl-refile-guess-by-from): Ditto.
+ (wl-refile-guess-by-msgid): Ditto.
+
* Version number is increased to 2.11.16.
2003-09-21 Yoichi NAKAYAMA <yoichi@geiin.org>
(downcase (wl-address-header-extract-address entity))))
(wl-parse-addresses
(concat
- (elmo-msgdb-overview-entity-get-to entity) ","
- (elmo-msgdb-overview-entity-get-cc entity)))))
+ (elmo-message-entity-field entity 'to) ","
+ (elmo-message-entity-field entity 'cc)))))
ret-val)
(setq tocc-list (elmo-list-delete
(or wl-user-mail-address-list
(defun wl-refile-guess-by-from (entity)
(let ((from
(downcase (wl-address-header-extract-address
- (elmo-msgdb-overview-entity-get-from entity)))))
+ (elmo-message-entity-field entity 'from)))))
;; search from alist
(or (cdr (assoc from wl-refile-alist))
(format "%s/%s" wl-refile-default-from-folder
(wl-refile-get-account-part-from-address from)))))
(defun wl-refile-guess-by-msgid (entity)
- (cdr (assoc (elmo-msgdb-overview-entity-get-references entity)
+ (cdr (assoc (elmo-message-entity-field entity 'references)
wl-refile-msgid-alist)))
(defun wl-refile-guess-by-subject (entity)
(defconst wl-score-header-index
;; Name to function alist.
- '(("number" wl-score-integer elmo-msgdb-overview-entity-get-number) ;;0
- ("subject" wl-score-string 3 charset)
- ("from" wl-score-string 2 charset)
- ("date" wl-score-date elmo-msgdb-overview-entity-get-date) ;;4
- ("message-id" wl-score-string elmo-msgdb-overview-entity-get-id)
- ("references" wl-score-string 1)
- ("to" wl-score-string 5)
- ("cc" wl-score-string 6)
- ("chars" wl-score-integer elmo-msgdb-overview-entity-get-size) ;;7
- ("lines" wl-score-integer wl-score-overview-entity-get-lines)
- ("xref" wl-score-string wl-score-overview-entity-get-xref)
- ("extra" wl-score-extra wl-score-overview-entity-get-extra mime)
- ("followup" wl-score-followup 2 charset)
- ("thread" wl-score-thread 1)))
+ '(("number" wl-score-integer number)
+ ("subject" wl-score-string subject charset)
+ ("from" wl-score-string from charset)
+ ("date" wl-score-date date)
+ ("message-id" wl-score-string message-id)
+ ("references" wl-score-string references)
+ ("to" wl-score-string to)
+ ("cc" wl-score-string cc)
+ ("chars" wl-score-integer size)
+ ("lines" wl-score-integer lines)
+ ("xref" wl-score-string xref)
+ ("extra" wl-score-extra extra mime)
+ ("followup" wl-score-followup from charset)
+ ("thread" wl-score-thread references)))
(defvar wl-score-auto-make-followup-entry nil)
(defvar wl-score-debug nil)
(or (elmo-message-entity-field entity 'xref)
""))
-(defun wl-score-overview-entity-get-extra (entity header &optional decode)
- (let ((extra (elmo-msgdb-overview-entity-get-extra-field entity header)))
- (if (and extra decode)
- (eword-decode-string
- (decode-mime-charset-string extra elmo-mime-charset))
- (or extra ""))))
-
(defun wl-string> (s1 s2)
(not (or (string< s1 s2)
(string= s1 s2))))
-(defmacro wl-score-ov-entity-get-by-index (entity index)
- (` (aref (cdr (, entity)) (, index))))
-
(defsubst wl-score-ov-entity-get (entity index &optional extra decode)
- (let ((str (cond ((integerp index)
- (wl-score-ov-entity-get-by-index entity index))
- (extra
- (funcall index entity extra decode))
- (t
- (funcall index entity)))))
- (if (and decode (not extra))
- (decode-mime-charset-string str elmo-mime-charset)
- str)))
-
-(defun wl-score-string-index< (a1 a2)
- (string-lessp (wl-score-ov-entity-get-by-index (car a1) wl-score-index)
- (wl-score-ov-entity-get-by-index (car a2) wl-score-index)))
-
-(defun wl-score-string-func< (a1 a2)
- (string-lessp (funcall wl-score-index (car a1))
- (funcall wl-score-index (car a2))))
+ (elmo-message-entity-field entity index decode))
+
+(defun wl-score-string< (a1 a2)
+ (string-lessp (wl-score-ov-entity-get (car a1) wl-score-index)
+ (wl-score-ov-entity-get (car a2) wl-score-index)))
(defun wl-score-string-sort (messages index)
- (let ((func (cond ((integerp index)
- 'wl-score-string-index<)
- (t
- 'wl-score-string-func<))))
- (sort messages func)))
+ (sort messages 'wl-score-string<))
(defsubst wl-score-get (symbol &optional alist)
"Get SYMBOL's definition in ALIST."
(dummy-temp (char-to-string 200))
(wl-summary-new-mark (char-to-string 201)) ; bind only for the check.
(wl-summary-flag-priority-list '(new)) ; ditto.
+ (msgdb (elmo-folder-msgdb-internal wl-summary-buffer-elmo-folder))
wl-summary-highlight
temp persistent)
(with-temp-buffer
(insert
(wl-summary-create-line
(elmo-msgdb-make-message-entity
+ msgdb
:number 10000
:from "foo"
:subject "bar"
wl-summary-buffer-mode-line-formatter
wl-summary-mode-line-format
wl-summary-mode-line-format-spec-alist)
- (wl-summary-detect-mark-position)
(setq wl-summary-buffer-persistent
(wl-folder-persistent-p (elmo-folder-name-internal folder)))
(elmo-folder-set-persistent-internal folder wl-summary-buffer-persistent)
(while wl-summary-delayed-update
(message "Parent (%d) of message %d is no entity"
(caar wl-summary-delayed-update)
- (elmo-msgdb-overview-entity-get-number
+ (elmo-message-entity-number
(cdar wl-summary-delayed-update)))
(wl-summary-insert-message
(cdar wl-summary-delayed-update)
(if elmo-use-database
(elmo-database-msgid-put
(car entity) (elmo-folder-name-internal folder)
- (elmo-msgdb-overview-entity-get-number entity)))
+ (elmo-message-entity-number entity)))
(when (> num elmo-display-progress-threshold)
(setq i (+ i 1))
(if (or (zerop (% i 5)) (= i num))
(while wl-summary-delayed-update
(message "Parent (%d) of message %d is no entity"
(caar wl-summary-delayed-update)
- (elmo-msgdb-overview-entity-get-number
+ (elmo-message-entity-number
(cdar wl-summary-delayed-update)))
(when (setq update-thread
(wl-summary-insert-message
(elmo-folder-name-internal folder))
wl-summary-default-view)))
(wl-thread-resume-entity folder)
- (wl-summary-open-folder folder))
+ (wl-summary-open-folder folder)
+ (wl-summary-detect-mark-position))
(setq wl-summary-buffer-view
(wl-summary-load-file-object
(expand-file-name wl-summary-view-file
(elmo-folder-msgdb-path folder))))
(wl-summary-open-folder folder)
+ (wl-summary-detect-mark-position)
(wl-summary-rescan))
(wl-summary-count-unread)
(wl-summary-update-modeline)))
;; don't update buffer
update-msgs)))) ; return value
-(defun wl-thread-insert-message (overview-entity
+(defun wl-thread-insert-message (message-entity
msg parent-msg &optional update linked)
"Insert MSG to the entity.
When optional argument UPDATE is non-nil,
;; visible.
(progn
(wl-summary-update-thread
- overview-entity
+ message-entity
child-entity
(elmo-message-entity wl-summary-buffer-elmo-folder
parent-msg))