diff options
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 = |