2024-01-25 23:38:38 +00:00
|
|
|
open Types
|
|
|
|
|
2024-01-11 00:11:50 +00:00
|
|
|
(*
|
|
|
|
User Modes:
|
|
|
|
+i Invisible User Mode
|
|
|
|
+o Oper User Mode
|
|
|
|
+w WALLOPS User Mode
|
|
|
|
|
|
|
|
Channel Modes:
|
|
|
|
Type A:
|
|
|
|
+b Ban Channel Mode
|
|
|
|
|
|
|
|
Type B:
|
|
|
|
+k Key Channel Mode
|
|
|
|
+o Operator Channel Membership Prefix (@)
|
|
|
|
+v Voice Channel Membership Prefix (+)
|
|
|
|
|
|
|
|
Type C:
|
|
|
|
+l Client Limit Channel Mode
|
|
|
|
|
|
|
|
Type D:
|
|
|
|
+i Invite-Only Channel Mode
|
|
|
|
+m Moderated Channel Mode
|
2024-01-18 16:57:27 +00:00
|
|
|
+n No External Messages Mode
|
2024-01-11 00:11:50 +00:00
|
|
|
+s Secret Channel Mode
|
|
|
|
+t Protected Topic Channel Mode
|
|
|
|
*)
|
|
|
|
|
|
|
|
type user = [`i | `o | `w]
|
|
|
|
type chan_a = [`b]
|
|
|
|
type chan_b = [`k | `o | `v]
|
|
|
|
type chan_c = [`l]
|
|
|
|
type chan_d = [`i | `m | `s | `t | `n]
|
|
|
|
type chan = [chan_a | chan_b | chan_c | chan_d]
|
|
|
|
type t = [user | chan]
|
|
|
|
|
|
|
|
val pp : Format.formatter -> [< t] -> unit
|
|
|
|
val to_char : [< t] -> char
|
|
|
|
val of_char_user : char -> [> user]
|
|
|
|
val of_char_chan : char -> [> chan]
|
2024-01-14 16:30:26 +00:00
|
|
|
|
|
|
|
module Set : sig
|
|
|
|
type t
|
|
|
|
type elt = [user | chan_d]
|
|
|
|
|
|
|
|
val empty : t
|
|
|
|
val singleton : [< elt] -> t
|
2024-02-02 16:36:19 +00:00
|
|
|
val of_list : [< elt] list -> t
|
2024-01-14 16:30:26 +00:00
|
|
|
val mem : [< elt] -> t -> bool
|
|
|
|
val add : [< elt] -> t -> t
|
|
|
|
val remove : [< elt] -> t -> t
|
|
|
|
val union : t -> t -> t
|
|
|
|
val inter : t -> t -> t
|
|
|
|
val diff : t -> t -> t
|
|
|
|
val equal : t -> t -> bool
|
|
|
|
|
|
|
|
val pp : Format.formatter -> t -> unit
|
|
|
|
val to_string : t -> string
|
2024-01-18 17:29:36 +00:00
|
|
|
|
|
|
|
type change = {
|
|
|
|
add : t;
|
|
|
|
rem : t;
|
|
|
|
}
|
|
|
|
|
|
|
|
val pp_change : Format.formatter -> change -> unit
|
|
|
|
|
2024-01-18 18:27:51 +00:00
|
|
|
val no_change : change
|
2024-01-18 17:29:36 +00:00
|
|
|
val normalize : t -> change -> t * change
|
2024-01-14 16:30:26 +00:00
|
|
|
end
|
2024-01-14 17:03:55 +00:00
|
|
|
|
|
|
|
module Parse : sig
|
2024-01-30 23:21:02 +00:00
|
|
|
exception Unknown_mode of char
|
|
|
|
exception Missing_args
|
2024-01-14 17:03:55 +00:00
|
|
|
|
2024-01-18 18:27:51 +00:00
|
|
|
type user_modes = Set.change
|
2024-01-14 17:03:55 +00:00
|
|
|
|
2024-01-22 17:37:20 +00:00
|
|
|
type 'a set_or_unset = [
|
|
|
|
| `set of 'a
|
|
|
|
| `unset
|
|
|
|
]
|
2024-01-18 18:28:23 +00:00
|
|
|
|
2024-01-25 23:38:38 +00:00
|
|
|
type add_or_rem = [
|
|
|
|
| `add
|
|
|
|
| `rem
|
|
|
|
]
|
|
|
|
|
|
|
|
type priv = [`o | `v]
|
|
|
|
|
2024-01-18 18:28:23 +00:00
|
|
|
type chan_modes = {
|
|
|
|
chan_modes : Set.change;
|
2024-01-22 17:37:20 +00:00
|
|
|
chan_key : string set_or_unset option;
|
|
|
|
chan_limit : int set_or_unset option;
|
2024-01-25 23:38:38 +00:00
|
|
|
chan_privs : (add_or_rem * priv * name) list;
|
2024-01-18 18:28:23 +00:00
|
|
|
}
|
|
|
|
|
2024-01-18 18:27:51 +00:00
|
|
|
val user_modes : string -> user_modes
|
2024-01-18 18:28:23 +00:00
|
|
|
val chan_modes : string -> string list -> chan_modes
|
2024-01-14 17:03:55 +00:00
|
|
|
end
|