aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sasl.ml13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sasl.ml b/lib/sasl.ml
index 0dc58c2..1fcd661 100644
--- a/lib/sasl.ml
+++ b/lib/sasl.ml
@@ -1,3 +1,4 @@
+open Lwt.Syntax
open Lwt.Infix
open Stream
@@ -52,10 +53,12 @@ let send_auth_stanza (stream, push) localpart pass mechanism =
with exn -> Lwt.fail exn
let authenticate (portal : Portal.t) (config : auth_config) =
- let {jid; password; _} = config
+ let {jid; password; _} = config in
(* Probably not exactly compliant with https://xmpp.org/extensions/xep-0029.html,
but it's just for simplicity's sake in alpha. *)
- in let localpart = match String.split_on_char '@' jid with
- | [localpart; _domain] -> localpart
- | _ -> failwith "Invalid JID"
- in send_auth_stanza portal localpart password PLAIN
+ let localpart = match String.split_on_char '@' jid with
+ | [localpart; _domain] -> localpart
+ | _ -> failwith "Invalid JID"
+ in
+ let* _features = Stream.get (fst portal) >|= Stream.parse_features
+ in send_auth_stanza portal localpart password PLAIN