(elmo-message-field): Define.
[elisp/wanderlust.git] / elmo / modb.el
index 4011c41..aa42d4c 100644 (file)
@@ -67,6 +67,9 @@ Return a list of messages which have duplicated message-id.")
 (luna-define-generic elmo-msgdb-length (msgdb)
   "Return number of messages in the MSGDB")
 
+(luna-define-generic elmo-msgdb-flag-available-p (msgdb flag)
+  "Return non-nil when FLAG is available.")
+
 (luna-define-generic elmo-msgdb-flags (msgdb number)
   "Return a list of flag which corresponds to the message with NUMBER.")
 
@@ -75,22 +78,33 @@ Return a list of messages which have duplicated message-id.")
 MSGDB is the ELMO msgdb.
 NUMBER is a message number to set flag.
 FLAG is a symbol which is one of the following:
-`new'       ... Message which is new.
-`read'      ... Message which is already read.
-`important' ... Message which is important.
-`answered'  ... Message which is answered.
-`cached'    ... Message which is cached.")
+  `new'       ... Message which is new.
+  `unread'    ... Message which is not read.
+  `important' ... Message which is important.
+  `answered'  ... Message which is answered.
+  `cached'    ... Message which is cached.
+'sugar' flag:
+  `read'      ... Message which is already read.
+  `uncached'  ... Message which is not cached.")
 
 (luna-define-generic elmo-msgdb-unset-flag (msgdb number flag)
   "Unset message flag.
 MSGDB is the ELMO msgdb.
 NUMBER is a message number to set flag.
 FLAG is a symbol which is one of the following:
-`new'       ... Message which is new.
-`read'      ... Message which is already read.
-`important' ... Message which is important.
-`answered'  ... Message which is answered.
-`cached'    ... Message which is cached.")
+  `new'       ... Message which is new.
+  `unread'    ... Message which is not read.
+  `important' ... Message which is important.
+  `answered'  ... Message which is answered.
+  `cached'    ... Message which is cached.
+'sugar' flag:
+  `read'      ... Message which is already read.
+  `uncached'  ... Message which is not cached.
+  `all'       ... Remove all flags.")
+
+(luna-define-generic elmo-msgdb-flag-count (msgdb)
+  "Return a list of cons cell as (flag . count).
+The count is number of message which is set flag in the MSGDB.")
 
 (luna-define-generic elmo-msgdb-list-messages (msgdb)
   "Return a list of message numbers in the MSGDB.")
@@ -121,7 +135,8 @@ Return CONDITION itself if no entity exists in msgdb.")
 Return non-nil if message-id of entity is duplicated.")
 
 (luna-define-generic elmo-msgdb-delete-messages (msgdb numbers)
-  "Delete messages which are contained NUMBERS from MSGDB.")
+  "Delete messages which are contained NUMBERS from MSGDB.
+Return non-nil if messages is deleted successfully.")
 
 (luna-define-generic elmo-msgdb-sort-entities (msgdb predicate
                                                     &optional app-data)
@@ -129,12 +144,30 @@ Return non-nil if message-id of entity is duplicated.")
 PREDICATE is called with two entities and APP-DATA.
 Should return non-nil if the first entity is \"less\" than the second.")
 
+(luna-define-generic elmo-msgdb-message-number (msgdb message-id)
+  "Get message number from MSGDB which corresponds to MESSAGE-ID.")
+
+(luna-define-method elmo-msgdb-message-number ((msgdb modb-generic)
+                                              message-id)
+  (elmo-message-entity-number
+   (elmo-msgdb-message-entity msgdb message-id)))
+
 (luna-define-generic elmo-msgdb-message-entity (msgdb key)
   "Return the message-entity structure which matches to the KEY.
 KEY is a number or a string.
 A number is for message number in the MSGDB.
 A string is for message-id of the message.")
 
+(luna-define-generic elmo-msgdb-message-field (msgdb number field)
+  "Get message field value in the MSGDB.
+NUMBER is a number of the message.
+FIELD is a symbol of the field.")
+
+(luna-define-method elmo-msgdb-message-field ((msgdb modb-generic)
+                                             number field)
+  (elmo-message-entity-field (elmo-msgdb-message-entity msgdb number)
+                            field))
+
 (luna-define-generic elmo-msgdb-message-entity-handler (msgdb)
   "Get modb entity handler instance which corresponds to the MSGDB.")