+;;; if this extends to more than 'flags, it should be improved to be more generic.
+(defun gnus-registry-fetch-extra-flags (id)
+ "Get the flags of a message, based on the message ID.
+Returns a list of symbol flags or nil."
+ (car-safe (cdr (gnus-registry-fetch-extra id 'flags))))
+
+(defun gnus-registry-has-extra-flag (id flag)
+ "Checks if a message has `flag', based on the message ID."
+ (memq flag (gnus-registry-fetch-extra-flags id)))
+
+(defun gnus-registry-store-extra-flags (id &rest flag-list)
+ "Set the flags of a message, based on the message ID.
+The `flag-list' can be nil, in which case no flags are left."
+ (gnus-registry-store-extra-entry id 'flags (list flag-list)))
+
+(defun gnus-registry-delete-extra-flags (id &rest flag-delete-list)
+ "Delete the message flags in `flag-delete-list', based on the message ID."
+ (let ((flags (gnus-registry-fetch-extra-flags id)))
+ (when flags
+ (dolist (flag flag-delete-list)
+ (setq flags (delq flag flags))))
+ (gnus-registry-store-extra-flags id (car flags))))
+
+(defun gnus-registry-delete-all-extra-flags (id)
+ "Delete all the flags for a message ID."
+ (gnus-registry-store-extra-flags id nil))
+