+2005-03-05 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * modb.el (elmo-msgdb-update-entity): New API and define generic
+ implement.
+
+ * modb-standard.el (elmo-msgdb-update-entity): Define.
+
+ * modb-entity.el (elmo-msgdb-message-entity-update-fields): New
+ API and define generic implement.
+
+ * elmo.el (update-overview): New singnal.
+
+ * elmo-shimbun.el (elmo-shimbun-update-overview): Rewrite use
+ `elmo-msgdb-update-entity' and emit signal `update-overview'.
+ (elmo-message-entity-parent): Define.
+
+ * elmo-pipe.el (elmo-pipe-connect-signals): Connect to signal
+ `update-overview'.
+
+ * elmo-multi.el (elmo-multi-connect-signals): Ditto.
+
+ * elmo-filter.el (elmo-filter-connect-signals): Ditto.
+
2005-02-27 Yuuichi Teranishi <teranisi@gohome.org>
* elmo.el (elmo-folder-synchronize): Sort the return value of
* elmo-util.el (elmo-list-diff): Don't care the order of the returned
list.
-
2005-02-27 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
(elmo-define-signal-handler (folder target number)
(elmo-emit-signal 'cache-changed folder number))
(elmo-define-signal-filter (folder target number)
+ (memq number (elmo-folder-list-messages folder nil t))))
+ (elmo-connect-signal
+ target 'update-overview folder
+ (elmo-define-signal-handler (folder target number)
+ (elmo-emit-signal 'update-overview folder number))
+ (elmo-define-signal-filter (folder target number)
(memq number (elmo-folder-list-messages folder nil t)))))
(defun elmo-filter-number-list-load (dir)
'flag-changed folder
(car (elmo-multi-map-numbers folder child (list number)))))
(elmo-define-signal-filter (folder sender)
+ (memq sender (elmo-multi-folder-children-internal folder))))
+ (elmo-connect-signal
+ nil 'update-overview folder
+ (elmo-define-signal-handler (folder child number)
+ (elmo-emit-signal
+ 'update-overview folder
+ (car (elmo-multi-map-numbers folder child (list number)))))
+ (elmo-define-signal-filter (folder sender)
(memq sender (elmo-multi-folder-children-internal folder)))))
(defun elmo-multi-map-numbers (folder child numbers)
(elmo-connect-signal
destination 'cache-changed folder
(elmo-define-signal-handler (folder dst number)
- (elmo-emit-signal 'cache-changed folder number))))
+ (elmo-emit-signal 'cache-changed folder number)))
+ (elmo-connect-signal
+ destination 'update-overview folder
+ (elmo-define-signal-handler (folder dst number)
+ (elmo-emit-signal 'update-overview folder number))))
(luna-define-method elmo-folder-get-primitive-list ((folder elmo-pipe-folder))
(nconc
(let ((entity (elmo-message-entity folder shimbun-id))
(message-id (shimbun-header-id header))
references)
- (unless (string= shimbun-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
- entity
- (elmo-shimbun-folder-entity-hash folder))
- (elmo-set-hash-val shimbun-id
- entity
- (elmo-shimbun-folder-entity-hash folder)))
- (elmo-message-entity-set-field
- entity
- 'from
- (elmo-mime-string (shimbun-header-from header)))
- (elmo-message-entity-set-field
- entity
- 'subject
- (elmo-mime-string (shimbun-header-subject 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-message-entity-set-field
- entity
- 'references
- (or (elmo-message-entity-field
- (elmo-get-hash-val
- references
- (elmo-shimbun-folder-entity-hash folder))
- 'message-id)
- references)))))
+ (when (elmo-msgdb-update-entity
+ (elmo-folder-msgdb folder)
+ entity
+ (nconc
+ (unless (string= shimbun-id message-id)
+ (elmo-shimbun-header-set-extra-field
+ header "x-shimbun-id" shimbun-id)
+ (elmo-set-hash-val message-id
+ entity
+ (elmo-shimbun-folder-entity-hash folder))
+ (elmo-set-hash-val shimbun-id
+ entity
+ (elmo-shimbun-folder-entity-hash folder))
+ (list (cons 'x-original-id message-id)))
+ (list
+ (cons 'from
+ (elmo-mime-string (shimbun-header-from header)))
+ (cons 'subject
+ (elmo-mime-string (shimbun-header-subject header)))
+ (cons 'date
+ (shimbun-header-date header))
+ (cons '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-emit-signal 'update-overview folder
+ (elmo-message-entity-number entity)))))
(luna-define-method elmo-map-message-fetch ((folder elmo-shimbun-folder)
location strategy
(elmo-folder-kill-messages folder numbers)
t)
+(luna-define-method elmo-message-entity-parent ((folder elmo-shimbun-folder)
+ entity)
+ (let ((references (elmo-message-entity-field entity 'references)))
+ (and references
+ (elmo-get-hash-val references
+ (elmo-shimbun-folder-entity-hash folder)))))
+
(require 'product)
(product-provide (provide 'elmo-shimbun) (require 'elmo-version))
(elmo-define-signal cache-changed (number)
"Notify the change cache status of the message with NUMBER.")
+(elmo-define-signal update-overview (number)
+ "Notify update overview of the message with NUMBER.")
+
;; autoloads
(eval-and-compile
(autoload 'md5 "md5")
FIELD is a symbol of the field.
VALUE is the field value to set.")
+(luna-define-generic elmo-msgdb-message-entity-update-fields (handler
+ entity values)
+ "Update message entity by VALUES.
+HANDLER is the message entity handler.
+ENTITY is the message entity structure.
+VALUES is an alist of field-name and field-value.")
+
(luna-define-generic elmo-msgdb-copy-message-entity (handler entity)
"Copy message entity.
HANDLER is the message entity handler.
entity)
(plist-get (cdr entity) :number))
+(luna-define-method elmo-msgdb-message-entity-update-fields
+ ((handler modb-entity-handler) entity values)
+ (let (updated)
+ (dolist (pair values)
+ (unless (equal
+ (cdr pair)
+ (elmo-msgdb-message-entity-field handler entity (car pair)))
+ (elmo-msgdb-message-entity-set-field handler entity
+ (car pair) (cdr pair))
+ (setq updated t)))
+ updated))
+
;; Legacy implementation.
(eval-and-compile (luna-define-class modb-legacy-entity-handler
(modb-entity-handler)))
(modb-standard-set-flag-modified msgdb number))
duplicate))))
+(luna-define-method elmo-msgdb-update-entity ((msgdb modb-standard)
+ entity values)
+ (let ((handler (elmo-message-entity-handler entity)))
+ (when (elmo-msgdb-message-entity-update-fields handler entity values)
+ (modb-standard-set-message-modified
+ msgdb
+ (elmo-msgdb-message-entity-number handler entity))
+ t)))
+
(luna-define-method elmo-msgdb-delete-messages ((msgdb modb-standard)
numbers)
(let ((number-list (modb-standard-number-list-internal msgdb))
"Append a ENTITY with FLAGS into the MSGDB.
Return non-nil if message-id of entity is duplicated.")
+(luna-define-generic elmo-msgdb-update-entity (msgdb entity values)
+ "Update a ENTITY with VALUES into the MSGDB.
+VALUES is an alist of field-name and field-value.")
+
(luna-define-generic elmo-msgdb-delete-messages (msgdb numbers)
"Delete messages which are contained NUMBERS from MSGDB.
Return non-nil if messages is deleted successfully.")
(or numbers (elmo-msgdb-list-messages msgdb)))
condition)))
+(luna-define-method elmo-msgdb-update-entity ((msgdb modb-generic)
+ entity values)
+ (when (elmo-msgdb-message-entity-update-fields
+ (elmo-message-entity-handler entity)
+ entity values)
+ (modb-generic-set-message-modified-internal msgdb t)
+ t))
+
(luna-define-method elmo-msgdb-message-entity-handler ((msgdb modb-generic))
(or modb-entity-default-cache-internal
(setq modb-entity-default-cache-internal
+2005-03-05 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * wl-summary.el (wl-summary-buffer-attach): Connect to signal
+ `update-overview'
+ (wl-summary-buffer-detach): Disconnect from it.
+ (wl-summary-rescan-message): Use command.
+
+ * wl-message.el (wl-message-buffer-display): Use
+ `with-current-buffer' instead of `save-excursion'.
+
2005-03-04 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* wl-mime.el (wl-draft-preview-attributes-list): Protect
(setq redisplay t))
(when (or force-reload redisplay)
(condition-case err
- (save-excursion
- (set-buffer hit)
+ (with-current-buffer hit
(when (or force-reload
(null entity)
(not (elmo-mime-entity-display-p
'cache-changed
(current-buffer)
(elmo-define-signal-handler (buffer folder number)
- (wl-summary-update-persistent-mark-on-event buffer (list number))))))
+ (wl-summary-update-persistent-mark-on-event buffer (list number))))
+ (elmo-connect-signal
+ wl-summary-buffer-elmo-folder
+ 'update-overview
+ (current-buffer)
+ (elmo-define-signal-handler (buffer folder number)
+ (with-current-buffer buffer
+ (wl-summary-rescan-message number))))))
(defun wl-summary-buffer-detach ()
(when (and (eq major-mode 'wl-summary-mode)
wl-summary-buffer-elmo-folder)
(elmo-disconnect-signal 'flag-changed (current-buffer))
- (elmo-disconnect-signal 'cache-changed (current-buffer))))
+ (elmo-disconnect-signal 'cache-changed (current-buffer))
+ (elmo-disconnect-signal 'update-overview (current-buffer))))
(defun wl-status-update ()
(interactive)
(forward-line -1)
(set-buffer-modified-p nil)))
+(defun wl-summary-rescan-message (number &optional reparent)
+ "Rescan current message without updating."
+ (interactive (list (wl-summary-message-number)))
+ (let ((start-number (wl-summary-message-number))
+ (start-column (current-column)))
+ (when (wl-summary-jump-to-msg number)
+ (let* ((folder wl-summary-buffer-elmo-folder)
+ (entity (elmo-message-entity folder number))
+ (inhibit-read-only t))
+ (if (eq wl-summary-buffer-view 'thread)
+ (let* ((thread-entity (wl-thread-get-entity number))
+ (descendant (wl-thread-entity-get-descendant thread-entity))
+ (thread-parent (wl-thread-entity-get-parent thread-entity))
+ (entity-parent (elmo-message-entity-number
+ (elmo-message-entity-parent folder entity)))
+ update-top-list)
+ (if (and (not reparent)
+ (eq thread-parent entity-parent))
+ (progn
+ (wl-thread-entity-set-linked thread-entity nil)
+ (wl-thread-update-line-on-buffer-sub nil number))
+ (wl-thread-delete-message number 'deep 'update)
+ (dolist (number (cons number descendant))
+ (setq update-top-list
+ (nconc
+ update-top-list
+ (wl-summary-insert-thread
+ (elmo-message-entity folder number)
+ folder
+ 'update))))
+ (when update-top-list
+ (wl-thread-update-indent-string-thread
+ (elmo-uniq-list update-top-list)))))
+ (delete-region (point-at-bol) (1+ (point-at-eol)))
+ (wl-summary-insert-line
+ (wl-summary-create-line entity nil
+ (wl-summary-temp-mark number)
+ (elmo-message-flags folder number)
+ (elmo-message-cached-p folder number)))))
+ (wl-summary-set-message-modified)
+ (wl-summary-jump-to-msg start-number)
+ (move-to-column start-column))))
+
(defun wl-summary-next-folder-or-exit (&optional next-entity upward)
(if (and next-entity
wl-auto-select-next)