diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/hello.ml | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/hello.ml b/test/hello.ml index 5bc38ad..392c3a1 100644 --- a/test/hello.ml +++ b/test/hello.ml @@ -2,8 +2,8 @@ open! Lwt.Syntax open! Lwt.Infix open! Flesh -let program (stream, push) config = - let+ _auth = Sasl.authenticate (stream, push) config +let program (stream, push) config (features : Stream.features) = + let+ _auth = Sasl.authenticate (stream, push) config features.mechanisms in begin match _auth with | Error (NotAuthorized, Some (_, text)) -> print_endline ("Not authorized: " ^ text) | Error (MalformedRequest, Some (_, text)) -> print_endline ("Malformed request: " ^ text) @@ -21,8 +21,9 @@ let main = in let domain = (List.nth (String.split_on_char '@' config.jid) 1) in let* stream, push = Portal.connect domain in let* _id = Portal.header domain (stream, push) in + let* features = Xml.get stream >|= Stream.parse_features in Lwt.catch - (fun () -> program (stream, push) config >|= (fun () -> push None)) + (fun () -> program (stream, push) config features >|= (fun () -> push None)) (fun exn -> push None; (* I suspect JavaScript's [wrap_callback] swallows the Exceptions thrown by |