Skip to content

Commit

Permalink
Be compatible with OCaml 4.14
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosaure committed Oct 11, 2024
1 parent 8c6c739 commit dc0e060
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/ptt_aggregate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ let to_recipients ~info recipients =
let by_domains, by_ipaddrs = aggregate_by_domains ~info recipients in
let by_domains = List.map (fun (domain, locals) ->
let domain = `Domain domain in
Ptt_sendmail.{ domain; locals }) (By_domain.to_list by_domains) in
Ptt_sendmail.{ domain; locals }) (By_domain.bindings by_domains) in
let by_ipaddrs = List.map (fun (ipaddr, locals) ->
let domain = `Ipaddr ipaddr in
let locals = (locals :> [ `Some of Emile.local list | `Postmaster | `All]) in
Ptt_sendmail.{ domain; locals }) (By_ipaddr.to_list by_ipaddrs) in
Ptt_sendmail.{ domain; locals }) (By_ipaddr.bindings by_ipaddrs) in
List.rev_append by_domains by_ipaddrs
4 changes: 2 additions & 2 deletions lib/ptt_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let recipients_are_reachable ~info dns resolver recipients =
| Ok domain_name -> Set.add domain_name acc
| Error _ -> raise (Invalid_recipients value))
Set.empty recipients
|> Set.to_list in
|> Set.elements in
let ( let* ) = Lwt.bind in
let mail_exchange_are_reachable { Dns.Mx.mail_exchange; _ } =
let* result = resolver.gethostbyname dns mail_exchange in
Expand All @@ -64,7 +64,7 @@ let recipients_are_reachable ~info dns resolver recipients =
let* result = resolver.getmxbyname dns domain in
match result with
| Ok mxs ->
let lst = Dns.Rr_map.Mx_set.to_list mxs in
let lst = Dns.Rr_map.Mx_set.elements mxs in
let lst = List.sort Dns.Mx.compare lst in
Lwt_list.exists_p mail_exchange_are_reachable lst
| Error _ -> Lwt.return false in
Expand Down
2 changes: 1 addition & 1 deletion lib/ptt_map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ let expand ~info t recipients =
| None -> []
else [ recipient ]) recipients
|> List.concat
|> Set.of_list |> Set.to_list
|> Set.of_list |> Set.elements
6 changes: 3 additions & 3 deletions lib/ptt_sendmail.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ module Make
| Error (`Msg msg) ->
warn_about_an_unreachable_mail_exchange ~domain ~mail_exchange msg;
Lwt.return acc end in
resolve (Dns.Rr_map.Mx_set.to_list mxs) >|= Mxs.vs >|= Result.ok
resolve (Dns.Rr_map.Mx_set.elements mxs) >|= Mxs.vs >|= Result.ok
| Error _ as err -> Lwt.return err end >>= function
| Error _ -> no_mail_exchange_service elt
| Ok mxs ->
if Mxs.is_empty mxs
then no_mail_exchange_service elt
else
let mxs = Mxs.to_list mxs in
let mxs = Mxs.bindings mxs in
let rec go = function
| [] ->
(* NOTE(dinosaure): we verified that [mxs] contains at least one
Expand Down Expand Up @@ -207,7 +207,7 @@ module Make
| None -> Lwt.return_unit

let v
: type a. resolver:_ -> ?pool:pool -> info:Ptt_common.info -> Tls.Config.client -> _
: resolver:_ -> ?pool:pool -> info:Ptt_common.info -> Tls.Config.client -> _
= fun ~resolver ?pool ~info tls ->
let stream, push = Lwt_stream.create () in
{ stream; push; info; resolver; tls; pool }, push
Expand Down
2 changes: 1 addition & 1 deletion ptt-bin.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ homepage: "https://github.com/mirage/ptt"
doc: "https://mirage.github.io/ptt/"
bug-reports: "https://github.com/mirage/ptt/issues"
depends: [
"ocaml" {>= "4.07.0"}
"ocaml" {>= "4.14.0"}
"dune"
"ptt" {= version}
"bos"
Expand Down
2 changes: 1 addition & 1 deletion ptt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ homepage: "https://github.com/mirage/ptt"
doc: "https://mirage.github.io/ptt/"
bug-reports: "https://github.com/mirage/ptt/issues"
depends: [
"ocaml" {>= "4.07.0"}
"ocaml" {>= "4.14.0"}
"dune"
"mrmime"
"digestif"
Expand Down

0 comments on commit dc0e060

Please sign in to comment.