IMAP in OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 80 lines 3.0 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved. 3 SPDX-License-Identifier: ISC 4 ---------------------------------------------------------------------------*) 5 6(** IMAP Commands 7 8 Client-to-server commands as specified in RFC 9051. *) 9 10(** ESEARCH return options (RFC 4731) *) 11type search_return_opt = 12 | Return_min (** Return minimum matching sequence number/UID *) 13 | Return_max (** Return maximum matching sequence number/UID *) 14 | Return_all (** Return all matching sequence numbers/UIDs as a sequence set *) 15 | Return_count (** Return count of matching messages *) 16 17type t = 18 | Capability 19 | Noop 20 | Logout 21 | Starttls 22 | Login of { username : string; password : string } 23 | Authenticate of { mechanism : string; initial_response : string option } 24 | Enable of string list 25 | Select of Mailbox.t 26 | Examine of Mailbox.t 27 | Create of Mailbox.t 28 | Delete of Mailbox.t 29 | Rename of { old_name : Mailbox.t; new_name : Mailbox.t } 30 | Subscribe of Mailbox.t 31 | Unsubscribe of Mailbox.t 32 | List of { reference : string; pattern : string } 33 | Namespace 34 | Status of { mailbox : Mailbox.t; items : Status.item list } 35 | Append of { 36 mailbox : Mailbox.t; 37 flags : Flag.t list; 38 date : string option; 39 message : string; 40 } 41 | Idle 42 | Close 43 | Unselect 44 | Expunge 45 | Search of { charset : string option; criteria : Search.t; return_opts : search_return_opt list option } 46 | Sort of { charset : string; criteria : Sort.t; search : Search.t } 47 | Thread of { algorithm : Thread.algorithm; charset : string; search : Search.t } 48 | Fetch of { sequence : Seq.t; items : Fetch.request list; changedsince : int64 option } 49 | Store of { 50 sequence : Seq.t; 51 silent : bool; 52 action : Store.t; 53 flags : Flag.t list; 54 unchangedsince : int64 option; 55 } 56 | Copy of { sequence : Seq.t; mailbox : Mailbox.t } 57 | Move of { sequence : Seq.t; mailbox : Mailbox.t } 58 | Uid of uid_command 59 | Id of (string * string) list option 60 61and uid_command = 62 | Uid_fetch of { sequence : Seq.t; items : Fetch.request list; changedsince : int64 option } 63 | Uid_store of { 64 sequence : Seq.t; 65 silent : bool; 66 action : Store.t; 67 flags : Flag.t list; 68 unchangedsince : int64 option; 69 } 70 | Uid_copy of { sequence : Seq.t; mailbox : Mailbox.t } 71 | Uid_move of { sequence : Seq.t; mailbox : Mailbox.t } 72 | Uid_search of { charset : string option; criteria : Search.t; return_opts : search_return_opt list option } 73 | Uid_sort of { charset : string; criteria : Sort.t; search : Search.t } 74 | Uid_thread of { algorithm : Thread.algorithm; charset : string; search : Search.t } 75 | Uid_expunge of Seq.t 76 77type tagged = { tag : string; command : t } 78 79val pp : Format.formatter -> t -> unit 80(** Pretty-printer for commands. Passwords are redacted for security. *)