IMAP in OCaml
0
fork

Configure Feed

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

at main 91 lines 3.3 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved. 3 SPDX-License-Identifier: ISC 4 ---------------------------------------------------------------------------*) 5 6(** Response Codes 7 8 IMAP response codes as specified in RFC 9051 Section 7.1. *) 9 10type t = 11 | Alert 12 | Alreadyexists 13 | Appenduid of int64 * int64 (** uidvalidity, uid *) 14 | Authenticationfailed 15 | Authorizationfailed 16 | Badcharset of string list 17 | Cannot 18 | Capability of string list 19 | Clientbug 20 | Closed 21 | Contactadmin 22 | Copyuid of int64 * Seq.t * Seq.t (** uidvalidity, source, dest *) 23 | Corruption 24 | Expired 25 | Expungeissued 26 | Haschildren 27 | Highestmodseq of int64 (** Highest MODSEQ in mailbox - RFC 7162 CONDSTORE *) 28 | Inuse 29 | Limit 30 | Modified of Seq.t (** Messages modified since UNCHANGEDSINCE - RFC 7162 CONDSTORE *) 31 | Nomodseq (** Mailbox doesn't support MODSEQ - RFC 7162 CONDSTORE *) 32 | Nonexistent 33 | Noperm 34 | Overquota 35 | Parse 36 | Permanentflags of Flag.t list 37 | Privacyrequired 38 | Readonly 39 | Readwrite 40 | Serverbug 41 | Trycreate 42 | Uidnotsticky 43 | Uidvalidity of int64 44 | Uidnext of int64 45 | Unavailable 46 | Unknown_cte 47 | Other of string * string option 48 49let pp ppf = function 50 | Alert -> Fmt.string ppf "ALERT" 51 | Alreadyexists -> Fmt.string ppf "ALREADYEXISTS" 52 | Appenduid (v, u) -> Fmt.pf ppf "APPENDUID %Ld %Ld" v u 53 | Authenticationfailed -> Fmt.string ppf "AUTHENTICATIONFAILED" 54 | Authorizationfailed -> Fmt.string ppf "AUTHORIZATIONFAILED" 55 | Badcharset cs -> Fmt.pf ppf "BADCHARSET (%a)" Fmt.(list ~sep:sp string) cs 56 | Cannot -> Fmt.string ppf "CANNOT" 57 | Capability caps -> Fmt.pf ppf "CAPABILITY %a" Fmt.(list ~sep:sp string) caps 58 | Clientbug -> Fmt.string ppf "CLIENTBUG" 59 | Closed -> Fmt.string ppf "CLOSED" 60 | Contactadmin -> Fmt.string ppf "CONTACTADMIN" 61 | Copyuid (v, s, d) -> 62 Fmt.pf ppf "COPYUID %Ld %a %a" v Seq.pp s Seq.pp d 63 | Corruption -> Fmt.string ppf "CORRUPTION" 64 | Expired -> Fmt.string ppf "EXPIRED" 65 | Expungeissued -> Fmt.string ppf "EXPUNGEISSUED" 66 | Haschildren -> Fmt.string ppf "HASCHILDREN" 67 | Highestmodseq m -> Fmt.pf ppf "HIGHESTMODSEQ %Ld" m 68 | Inuse -> Fmt.string ppf "INUSE" 69 | Limit -> Fmt.string ppf "LIMIT" 70 | Modified s -> Fmt.pf ppf "MODIFIED %a" Seq.pp s 71 | Nomodseq -> Fmt.string ppf "NOMODSEQ" 72 | Nonexistent -> Fmt.string ppf "NONEXISTENT" 73 | Noperm -> Fmt.string ppf "NOPERM" 74 | Overquota -> Fmt.string ppf "OVERQUOTA" 75 | Parse -> Fmt.string ppf "PARSE" 76 | Permanentflags fs -> Fmt.pf ppf "PERMANENTFLAGS (%a)" Fmt.(list ~sep:sp Flag.pp) fs 77 | Privacyrequired -> Fmt.string ppf "PRIVACYREQUIRED" 78 | Readonly -> Fmt.string ppf "READ-ONLY" 79 | Readwrite -> Fmt.string ppf "READ-WRITE" 80 | Serverbug -> Fmt.string ppf "SERVERBUG" 81 | Trycreate -> Fmt.string ppf "TRYCREATE" 82 | Uidnotsticky -> Fmt.string ppf "UIDNOTSTICKY" 83 | Uidvalidity v -> Fmt.pf ppf "UIDVALIDITY %Ld" v 84 | Uidnext u -> Fmt.pf ppf "UIDNEXT %Ld" u 85 | Unavailable -> Fmt.string ppf "UNAVAILABLE" 86 | Unknown_cte -> Fmt.string ppf "UNKNOWN-CTE" 87 | Other (name, arg) -> 88 Fmt.string ppf name; 89 Option.iter (Fmt.pf ppf " %s") arg 90 91let to_string c = Fmt.str "%a" pp c