summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sasl.ml4
-rw-r--r--lib/stream.ml18
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/sasl.ml b/lib/sasl.ml
index ff6436a..2241a91 100644
--- a/lib/sasl.ml
+++ b/lib/sasl.ml
@@ -63,9 +63,9 @@ let authenticate (portal : Portal.t) ({jid; password; preferred_mechanisms} : au
| [localpart; _domain] -> localpart
| _ -> failwith "Invalid JID"
in
- let* {sasl_mechanisms; _} = Xml.get (fst portal) >|= Stream.parse_features
+ let* {mechanisms; _} = Xml.get (fst portal) >|= Stream.parse_features
in let preferred, not_preferred =
- List.partition (fun f -> List.exists ((=) f) preferred_mechanisms) sasl_mechanisms
+ List.partition (fun f -> List.exists ((=) f) preferred_mechanisms) mechanisms
in
(* Function that takes a [sasl_auth] and returns whether this attempt should be
retried, or is definitive (e.g, success or bad credentials). *)
diff --git a/lib/stream.ml b/lib/stream.ml
index 83587cd..607319d 100644
--- a/lib/stream.ml
+++ b/lib/stream.ml
@@ -8,15 +8,15 @@ let parse_auth_mechanism = function
| "PLAIN" -> PLAIN
| other -> Unknown other
-type stream_features = {
- sasl_mechanisms : auth_mechanism list;
+type features = {
+ mechanisms : auth_mechanism list;
starttls : [`Required | `Optional | `None];
- unknown_features : Xml.element list;
+ unknown : Xml.element list;
}
-(** [parse_features el] is a [stream_features] record with all the features of the
+(** [parse_features el] is a [features] record with all the features of the
[<stream:features>] stanza contained in [el]. *)
-let parse_features (el : Xml.element) : stream_features =
+let parse_features (el : Xml.element) : features =
let open Xml in
let open Either in
let parse_mechanism_stanza = function
@@ -24,7 +24,7 @@ let parse_features (el : Xml.element) : stream_features =
Some (parse_auth_mechanism mechanism)
| _ -> None
in
- let parse_feature (acc : stream_features) (feature : Xml.element) : stream_features =
+ let parse_feature (acc : features) (feature : Xml.element) : features =
let parse_mechanisms ch =
List.filter_map parse_mechanism_stanza ch
and parse_starttls = function
@@ -32,10 +32,10 @@ let parse_features (el : Xml.element) : stream_features =
| [] -> `Optional
| _ -> raise (InvalidStanza (element_to_string el))
in match feature.local_name with
- | "mechanisms" -> {acc with sasl_mechanisms=parse_mechanisms feature.children}
+ | "mechanisms" -> {acc with mechanisms=parse_mechanisms feature.children}
| "starttls" -> {acc with starttls=parse_starttls feature.children}
- | _ -> {acc with unknown_features = feature :: acc.unknown_features}
+ | _ -> {acc with unknown = feature :: acc.unknown}
in List.fold_left
parse_feature
- {sasl_mechanisms=[]; starttls=`None; unknown_features=[]}
+ {mechanisms=[]; starttls=`None; unknown=[]}
(List.filter_map find_left el.children)