(** Demo of message flags and mailbox attributes functionality *) open Jmap_mail.Types (** Demonstrate flag color functionality *) let demo_flag_colors () = Printf.printf "Flag Color Demo:\n"; Printf.printf "================\n"; (* Show all flag colors and their bit patterns *) let colors = [Red; Orange; Yellow; Green; Blue; Purple; Gray] in List.iter (fun color -> let (bit0, bit1, bit2) = bits_of_flag_color color in Printf.printf "Color: %-7s Bits: %d%d%d\n" (match color with | Red -> "Red" | Orange -> "Orange" | Yellow -> "Yellow" | Green -> "Green" | Blue -> "Blue" | Purple -> "Purple" | Gray -> "Gray") (if bit0 then 1 else 0) (if bit1 then 1 else 0) (if bit2 then 1 else 0) ) colors; Printf.printf "\n" (** Demonstrate message keyword functionality *) let demo_message_keywords () = Printf.printf "Message Keywords Demo:\n"; Printf.printf "=====================\n"; (* Show all standard message keywords and their string representations *) let keywords = [ Notify; Muted; Followed; Memo; HasMemo; HasAttachment; HasNoAttachment; AutoSent; Unsubscribed; CanUnsubscribe; Imported; IsTrusted; MaskedEmail; New; MailFlagBit0; MailFlagBit1; MailFlagBit2 ] in List.iter (fun kw -> Printf.printf "%-15s -> %s\n" (match kw with | Notify -> "Notify" | Muted -> "Muted" | Followed -> "Followed" | Memo -> "Memo" | HasMemo -> "HasMemo" | HasAttachment -> "HasAttachment" | HasNoAttachment -> "HasNoAttachment" | AutoSent -> "AutoSent" | Unsubscribed -> "Unsubscribed" | CanUnsubscribe -> "CanUnsubscribe" | Imported -> "Imported" | IsTrusted -> "IsTrusted" | MaskedEmail -> "MaskedEmail" | New -> "New" | MailFlagBit0 -> "MailFlagBit0" | MailFlagBit1 -> "MailFlagBit1" | MailFlagBit2 -> "MailFlagBit2" | OtherKeyword s -> "Other: " ^ s) (string_of_message_keyword kw) ) keywords; Printf.printf "\n" (** Demonstrate mailbox attribute functionality *) let demo_mailbox_attributes () = Printf.printf "Mailbox Attributes Demo:\n"; Printf.printf "=======================\n"; (* Show all standard mailbox attributes and their string representations *) let attributes = [Snoozed; Scheduled; Memos] in List.iter (fun attr -> Printf.printf "%-10s -> %s\n" (match attr with | Snoozed -> "Snoozed" | Scheduled -> "Scheduled" | Memos -> "Memos" | OtherAttribute s -> "Other: " ^ s) (string_of_mailbox_attribute attr) ) attributes; Printf.printf "\n" (** Demonstrate formatting functionality *) let demo_formatting () = Printf.printf "Keyword Formatting Demo:\n"; Printf.printf "======================\n"; (* Create a sample email with various keywords *) let sample_keywords = [ (Flagged, true); (* Standard flag *) (Custom "$MailFlagBit0", true); (* Flag color bit *) (Custom "$MailFlagBit2", true); (* Flag color bit *) (Custom "$notify", true); (* Message keyword *) (Custom "$followed", true); (* Message keyword *) (Custom "$hasattachment", true); (* Message keyword *) (Seen, false); (* Inactive keyword *) (Custom "$random", true); (* Unknown keyword *) ] in (* Test formatted output *) let formatted = format_email_keywords sample_keywords in Printf.printf "Formatted keywords: %s\n\n" formatted (** Main entry point *) let () = demo_flag_colors (); demo_message_keywords (); demo_mailbox_attributes (); demo_formatting ()