diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-26 16:59:26 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-26 21:40:53 +0200 |
commit | 3362a074c7dddf439ff878cf94d9169ab208eb10 (patch) | |
tree | c4b12cbc05b66e7ca2ccb57fcbafe06f3da82a19 /lib/stream.ml | |
parent | bd254f33b81287f2c282b7ec5becd4f7c838549f (diff) |
refactor(xml): move get and next functions to Xml
Diffstat (limited to 'lib/stream.ml')
-rw-r--r-- | lib/stream.ml | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/stream.ml b/lib/stream.ml index cc15c4b..83587cd 100644 --- a/lib/stream.ml +++ b/lib/stream.ml @@ -1,6 +1,3 @@ -open Lwt.Syntax -open Markup - exception ClosedStream type auth_mechanism = @@ -17,24 +14,6 @@ type stream_features = { unknown_features : Xml.element list; } -(** [next stream] is a promise containing a full stanza of the fragments of - [stream]. *) -let next (stream : (signal, async) stream) : (signal, sync) stream Lwt.t = - let traverse_stanza depth fragment = - let depth = match fragment with - | `Start_element _ -> depth + 1 - | `End_element -> depth - 1 - | _ -> depth - in ([fragment], if depth = 0 then None else Some depth) - in transform traverse_stanza 0 stream |> Markup_lwt.load - -(** [get stream] is a promise containing a single Xml element of [stream]. *) -let get (stream : (signal, async) stream) : Xml.element Lwt.t = - let* signal = next stream - in match Xml.tree signal with - | Some xml -> Lwt.return xml - | None -> Lwt.fail (Xml.InvalidStanza (signal |> write_xml |> to_string)) - (** [parse_features el] is a [stream_features] record with all the features of the [<stream:features>] stanza contained in [el]. *) let parse_features (el : Xml.element) : stream_features = |