+(defsubst elmo-msgdb-mark-to-flags (mark)
+ (append
+ (and (string= mark elmo-msgdb-new-mark)
+ '(new))
+ (and (string= mark elmo-msgdb-important-mark)
+ '(important))
+ (and (member mark (elmo-msgdb-unread-marks))
+ '(unread))
+ (and (member mark (elmo-msgdb-answered-marks))
+ '(answered))
+ (and (not (member mark (elmo-msgdb-uncached-marks)))
+ '(cached))))
+
+(defsubst elmo-msgdb-flags-to-mark (flags cached use-cache)
+ (cond ((memq 'new flags)
+ elmo-msgdb-new-mark)
+ ((memq 'important flags)
+ elmo-msgdb-important-mark)
+ ((memq 'answered flags)
+ (if cached
+ elmo-msgdb-answered-cached-mark
+ elmo-msgdb-answered-uncached-mark))
+ ((memq 'unread flags)
+ (if cached
+ elmo-msgdb-unread-cached-mark
+ elmo-msgdb-unread-uncached-mark))
+ (t
+ (if (or cached (not use-cache))
+ nil
+ elmo-msgdb-read-uncached-mark))))
+