From fcd21d19f0748bcc7a0e691df1df25c9b0ecd610 Mon Sep 17 00:00:00 2001 From: Clombrong Date: Sun, 29 Jun 2025 20:03:27 +0200 Subject: style(stream): rename negotiate_feature to negotiate --- lib/stream.ml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/stream.ml') diff --git a/lib/stream.ml b/lib/stream.ml index cc5ad92..cdd0999 100644 --- a/lib/stream.ml +++ b/lib/stream.ml @@ -56,14 +56,13 @@ let start (domain : string) (portal : Portal.t) : features Lwt.t = let* _id = Portal.header domain portal in Wire.get portal.stream >|= parse_features -let negotiate_feature (mandatory : bool) (feat : feature) (portal : Portal.t) - ({starttls; sasl; _} : config) : unit Lwt.t = +let negotiate mandatory feature portal {starttls; sasl; _} : unit Lwt.t = (* authenticate using SASL with the XMPP server. *) let authenticate mechanisms = let open Sasl in + let open Portal in let allow_auth () = - Portal._encrypted portal._socket || - Option.is_some (Sys.getenv_opt "FLESH_ALLOW_STRIPTLS") + _encrypted portal._socket || Option.is_some (Sys.getenv_opt "FLESH_ALLOW_STRIPTLS") and parse_auth_error = function | NotAuthorized, Some (_, text) -> "Not authorized: " ^ text | MalformedRequest, Some (_, text) -> "Malformed request: " ^ text @@ -75,7 +74,7 @@ let negotiate_feature (mandatory : bool) (feat : feature) (portal : Portal.t) | Error err -> Lwt.fail_with (parse_auth_error err) | Ok _ -> print_endline "Success!"; Lwt.return_unit else Lwt.fail InsufficientEncryption - in match feat with + in match feature with | STARTTLS -> if mandatory || starttls.prefer_starttls then Starttls.upgrade portal else Lwt.return_unit -- cgit v1.2.3