+2003-09-25 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * elmo-dop.el (elmo-dop-msgdb): Rewrite.
+
+ * modb-legacy.el (elmo-msgdb-overview-entity-get-id-internal): New
+ inline function.
+ (elmo-msgdb-overview-entity-get-number-internal): Ditto.
+ (elmo-msgdb-overview-entity-set-number,
+ elmo-msgdb-overview-entity-get-references,
+ elmo-msgdb-overview-entity-set-references,
+ elmo-msgdb-overview-entity-get-from-no-decode,
+ elmo-msgdb-overview-entity-get-from,
+ elmo-msgdb-overview-entity-set-from,
+ elmo-msgdb-overview-entity-get-subject,
+ elmo-msgdb-overview-entity-get-subject-no-decode,
+ elmo-msgdb-overview-entity-set-subject,
+ elmo-msgdb-overview-entity-get-date,
+ elmo-msgdb-overview-entity-set-date,
+ elmo-msgdb-overview-entity-get-to,
+ elmo-msgdb-overview-entity-get-cc,
+ elmo-msgdb-overview-entity-get-size,
+ elmo-msgdb-overview-entity-set-size,
+ elmo-msgdb-overview-entity-get-extra,
+ elmo-msgdb-overview-entity-set-extra,
+ elmo-msgdb-overview-entity-get-extra-field,
+ elmo-msgdb-overview-entity-set-extra-field): Moved to elmo-msgdb.el.
+ (elmo-msgdb-make-index): Use
+ `elmo-msgdb-overview-entity-get-number-internal'.
+ (elmo-msgdb-clear-index): Ditto.
+ (elmo-msgdb-append-entity): Ditto;
+ Use `elmo-msgdb-overview-entity-get-id-internal'.
+
+ * elmo-msgdb.el (elmo-msgdb-overview-entity-get-number,
+ elmo-msgdb-overview-entity-set-number,
+ elmo-msgdb-overview-entity-get-references,
+ elmo-msgdb-overview-entity-set-references,
+ elmo-msgdb-overview-entity-get-from-no-decode,
+ elmo-msgdb-overview-entity-get-from,
+ elmo-msgdb-overview-entity-set-from,
+ elmo-msgdb-overview-entity-get-subject,
+ elmo-msgdb-overview-entity-get-subject-no-decode,
+ elmo-msgdb-overview-entity-set-subject,
+ elmo-msgdb-overview-entity-get-date,
+ elmo-msgdb-overview-entity-set-date,
+ elmo-msgdb-overview-entity-get-to,
+ elmo-msgdb-overview-entity-get-cc,
+ elmo-msgdb-overview-entity-get-size,
+ elmo-msgdb-overview-entity-set-size,
+ elmo-msgdb-overview-entity-get-extra,
+ elmo-msgdb-overview-entity-set-extra,
+ elmo-msgdb-overview-entity-get-extra-field,
+ elmo-msgdb-overview-entity-set-extra-field): Moved from modb-legacy.el
+ and rewrote for backward compatibility.
+
2003-09-24 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo.el (elmo-message-entity-number,
(unless (elmo-folder-exists-p folder)
(elmo-folder-create folder)))
-;;; Util XXX Oh my god...
+;;; Util
(defun elmo-dop-msgdb (msgdb)
- (list (mapcar (function
- (lambda (x)
- (elmo-message-entity-set-number
- x
- (* -1
- (elmo-message-entity-number x)))))
- (nth 0 msgdb))
- (mapcar (function
- (lambda (x) (cons
- (* -1 (car x))
- (cdr x))))
- (nth 1 msgdb))
- (mapcar (function
- (lambda (x) (cons
- (* -1 (car x))
- (cdr x)))) (nth 2 msgdb))))
+ (let ((new-db (elmo-make-msgdb))
+ entity)
+ (dolist (dop-entity (mapcar
+ (lambda (number)
+ (setq entity (elmo-msgdb-message-entity
+ msgdb number))
+ (elmo-message-entity-set-number
+ entity
+ (* -1 (elmo-message-entity-number entity)))
+ entity)
+ (elmo-msgdb-list-messages msgdb)))
+ (elmo-msgdb-append-entity new-db
+ dop-entity
+ (elmo-msgdb-flags
+ msgdb
+ (abs (elmo-message-entity-number
+ dop-entity)))))
+ new-db))
(require 'product)
(product-provide (provide 'elmo-dop) (require 'elmo-version))
elmo-msgdb-location-filename
dir) alist))
+;;; For backward compatibility.
+(defsubst elmo-msgdb-overview-entity-get-number (entity)
+ (elmo-message-entity-number entity))
+
+(defsubst elmo-msgdb-overview-entity-set-number (entity number)
+ (elmo-message-entity-set-number entity number))
+
+(defsubst elmo-msgdb-overview-entity-get-references (entity)
+ (elmo-message-entity-field entity 'references))
+
+(defsubst elmo-msgdb-overview-entity-set-references (entity references)
+ (elmo-message-entity-set-field entity 'references references))
+
+(defsubst elmo-msgdb-overview-entity-get-from-no-decode (entity)
+ (elmo-message-entity-field entity 'from))
+
+(defsubst elmo-msgdb-overview-entity-get-from (entity)
+ (elmo-message-entity-field entity 'from t))
+
+(defsubst elmo-msgdb-overview-entity-set-from (entity from)
+ (elmo-message-entity-set-field entity 'from from))
+
+(defsubst elmo-msgdb-overview-entity-get-subject (entity)
+ (elmo-message-entity-field entity 'subject t))
+
+(defsubst elmo-msgdb-overview-entity-get-subject-no-decode (entity)
+ (elmo-message-entity-field entity 'subject))
+
+(defsubst elmo-msgdb-overview-entity-set-subject (entity subject)
+ (elmo-message-entity-set-field entity 'subject subject))
+
+(defsubst elmo-msgdb-overview-entity-get-date (entity)
+ (elmo-message-entity-field entity 'date))
+
+(defsubst elmo-msgdb-overview-entity-set-date (entity date)
+ (elmo-message-entity-set-field entity 'date date))
+
+(defsubst elmo-msgdb-overview-entity-get-to (entity)
+ (elmo-message-entity-field entity 'to))
+
+(defsubst elmo-msgdb-overview-entity-get-cc (entity)
+ (elmo-message-entity-field entity 'cc))
+
+(defsubst elmo-msgdb-overview-entity-get-size (entity)
+ (elmo-message-entity-field entity 'size))
+
+(defsubst elmo-msgdb-overview-entity-set-size (entity size)
+ (elmo-message-entity-set-field entity 'size size))
+
+(defsubst elmo-msgdb-overview-entity-get-extra (entity)
+ ;; Truely obsolete.
+ )
+
+(defsubst elmo-msgdb-overview-entity-set-extra (entity extra)
+ ;; Truely obsolete.
+ )
+
+(defsubst elmo-msgdb-overview-entity-get-extra-field (entity
+ field-name)
+ (elmo-message-entity-field entity (intern field-name)))
+
+(defsubst elmo-msgdb-overview-entity-set-extra-field (entity
+ field-name
+ value)
+ (elmo-message-entity-set-field entity (intern field-name) value))
+
(require 'product)
(product-provide (provide 'elmo-msgdb) (require 'elmo-version))
;;;
;; Internal use only (obsolete interface)
;;
-(defsubst elmo-msgdb-overview-entity-get-id (entity)
+(defsubst elmo-msgdb-overview-entity-get-id-internal (entity)
(and entity (car entity)))
-(defsubst elmo-msgdb-overview-entity-get-number (entity)
+(defsubst elmo-msgdb-overview-entity-get-number-internal (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
;; key is message-id
(if (elmo-get-hash-val (caar overview) ehash) ; duplicated.
(setq duplicates (cons
- (elmo-msgdb-overview-entity-get-number
+ (elmo-msgdb-overview-entity-get-number-internal
(car overview))
duplicates)))
(if (caar overview)
;; key is number
(elmo-set-hash-val
(format "#%d"
- (elmo-msgdb-overview-entity-get-number (car overview)))
+ (elmo-msgdb-overview-entity-get-number-internal
+ (car overview)))
(car overview) ehash)
(setq overview (cdr overview)))
(while mark-alist
(mhash (elmo-msgdb-get-mark-hashtb msgdb))
number)
(when (and entity ehash)
- (and (setq number (elmo-msgdb-overview-entity-get-number entity))
+ (and (setq number (elmo-msgdb-overview-entity-get-number-internal
+ entity))
(elmo-clear-hash-val (format "#%d" number) ehash))
(and (car entity) ;; message-id
(elmo-clear-hash-val (car entity) ehash)))
(when (and entity mhash)
- (and (setq number (elmo-msgdb-overview-entity-get-number entity))
+ (and (setq number (elmo-msgdb-overview-entity-get-number-internal
+ entity))
(elmo-clear-hash-val (format "#%d" number) mhash)))))
;;; Implement
(elmo-msgdb-set-mark msgdb number new-mark))))))
(luna-define-method elmo-msgdb-list-messages ((msgdb modb-legacy))
- (mapcar 'elmo-msgdb-overview-entity-get-number
+ (mapcar 'elmo-msgdb-overview-entity-get-number-internal
(elmo-msgdb-get-overview msgdb)))
(luna-define-method elmo-msgdb-list-flagged ((msgdb modb-legacy) flag)
(luna-define-method elmo-msgdb-append-entity ((msgdb modb-legacy)
entity &optional flags)
(when entity
- (let ((number (elmo-msgdb-overview-entity-get-number entity))
- (message-id (elmo-msgdb-overview-entity-get-id entity))
+ (let ((number (elmo-msgdb-overview-entity-get-number-internal entity))
+ (message-id (elmo-msgdb-overview-entity-get-id-internal entity))
mark)
(elmo-msgdb-set-overview
msgdb