diff options
author | Clombrong <cromblong@egregore.fun> | 2025-08-15 00:17:29 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-08-15 00:17:29 +0200 |
commit | 383928958376423d8588888386b52e4a8b30d8da (patch) | |
tree | 5edd1dcb637e1de8b3c2276978db9134d57ea36f | |
parent | e9c9de288d9934a252dcef58b935ce6e145a65cd (diff) |
feat!(portal): remove domain field from Portal.header (useless now)
-rw-r--r-- | lib/session.ml | 4 | ||||
-rw-r--r-- | lib/stream.ml | 4 | ||||
-rw-r--r-- | portal/portal.mli | 2 | ||||
-rw-r--r-- | portal/tcp/portal.ml | 4 | ||||
-rw-r--r-- | portal/ws/portal.ml | 2 | ||||
-rw-r--r-- | test/hello.ml | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/lib/session.ml b/lib/session.ml index 421c01e..b1eb2c3 100644 --- a/lib/session.ml +++ b/lib/session.ml @@ -27,7 +27,7 @@ type t = { Basically, it conforms to {{: https://datatracker.ietf.org/doc/html/rfc6120#section-4.3 }}, and gets the Portal in a "ready" state. *) -let create (domain : Portal.domain) (config : config) : t Lwt.t = +let create (config : config) : t Lwt.t = let needs_restart = function | Feature.Mechanisms _ | STARTTLS -> true | _ -> false @@ -47,7 +47,7 @@ let create (domain : Portal.domain) (config : config) : t Lwt.t = let+ portal = Portal.connect domain in update (Connected (portal, Starting_stream)) | Connected (portal, Starting_stream) -> - let+ features = Stream.start domain portal + let+ features = Stream.start portal in let next_state = features_next_state features in update (Connected (portal, next_state)) | Connected (portal, Negotiating_feature (feature, features)) -> diff --git a/lib/stream.ml b/lib/stream.ml index 23aac34..1b6489f 100644 --- a/lib/stream.ml +++ b/lib/stream.ml @@ -65,8 +65,8 @@ let parse_features (stanza : Xml.element) : features = (** [start domain portal] is a promise to features that starts a stream negotiation with the XMPP server [portal]. *) -let start (domain : Portal.domain) (portal : Portal.t) : features Lwt.t = - let* _id = Portal.header domain portal +let start (portal : Portal.t) : features Lwt.t = + let* _id = Portal.header portal in Wire.get portal.stream >|= parse_features (** [negotiate mandatory feature portal] negotiates the feature [feature] with the XMPP diff --git a/portal/portal.mli b/portal/portal.mli index 52a96ce..b8657ee 100644 --- a/portal/portal.mli +++ b/portal/portal.mli @@ -44,7 +44,7 @@ val starttls : t -> unit Lwt.t the response stream header. When [from] is specified, a from attribute is included. *) -val header : ?from:string -> domain -> t -> string Lwt.t +val header : ?from:string -> t -> string Lwt.t (** [_encrypted socket] returns whether [socket] is encrypted, using TLS or otherwise. *) val _encrypted : socket -> bool diff --git a/portal/tcp/portal.ml b/portal/tcp/portal.ml index b776efc..33e4971 100644 --- a/portal/tcp/portal.ml +++ b/portal/tcp/portal.ml @@ -199,10 +199,10 @@ let _encrypted = function | Plain _ -> false | Tls _ -> true -let header ?from domain (portal : t) = +let header ?from (portal : t) = let stanza = let attributes = - [(("", "to"), domain); (("", "version"), "1.0"); + [(("", "to"), portal.domain); (("", "version"), "1.0"); (("http://www.w3.org/XML/1998/namespace", "lang"), "en"); (("http://www.w3.org/2000/xmlns/", "xmlns"), "jabber:client"); (("http://www.w3.org/2000/xmlns/", "stream"), xmlns)] diff --git a/portal/ws/portal.ml b/portal/ws/portal.ml index 636cb89..8d490cc 100644 --- a/portal/ws/portal.ml +++ b/portal/ws/portal.ml @@ -31,7 +31,7 @@ let well_known_of (domain : string) = "https://" ^ domain ^ "/.well-known/host-m (** [open_stanza domain] is an <open /> stanza for [domain]. If [from] is specified, the <open /> stanza has the from parameter. *) -let header ?from domain {stream; push; _} = +let header ?from {domain; stream; push; _} = let stanza = let attributes = let open Option in diff --git a/test/hello.ml b/test/hello.ml index 005db94..cd4f5bb 100644 --- a/test/hello.ml +++ b/test/hello.ml @@ -16,7 +16,7 @@ let main = } in let waiter, wakener = Lwt.wait () in - try%lwt let* { state; update } = create config.sasl.jid.domainpart config in + try%lwt let* { state; update } = create config in S.map (function | Connected (portal, Logged_in _) -> portal.push None; Lwt.wakeup wakener () |