prose-im / prose-app-web

Prose Web application. XMPP client for team messaging.
https://prose.org/downloads
Mozilla Public License 2.0
19 stars 2 forks source link

Provide stream features from strophe.js #57

Closed nesium closed 4 months ago

nesium commented 4 months ago

This is required to determine server capabilities.

core-lib API is TDB in https://github.com/prose-im/prose-core-client/issues/23

Refs:

valeriansaliou commented 4 months ago

So, I've just checked and I'm already passing the <stream:features /> stanza to the core's eventHandler.handleStanza() where eventHandler is a ProseConnectionEventHandler instance.

The stanza looks as such, and contains the capabilities hash, as well as stream-level server features:

<stream:features xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">
  <c hash="sha-1" node="http://prosody.im" ver="SLdyYk4wQZVH/ipEJlOyN2Kyhdk=" xmlns="http://jabber.org/protocol/caps"/>
  <csi xmlns="urn:xmpp:csi:0"/>
  <ver xmlns="urn:xmpp:features:rosterver"/>
  <sm xmlns="urn:xmpp:sm:2">
    <optional/>
  </sm>
  <sm xmlns="urn:xmpp:sm:3">
    <optional/>
  </sm>
  <sub xmlns="urn:xmpp:features:pre-approval"/>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <required/>
  </bind>
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session">
    <optional/>
  </session>
  <limits xmlns="urn:xmpp:stream-limits:0">
    <max-bytes>262144</max-bytes>
  </limits>
</stream:features>

You should therefore be good to go to implement server features detection with the current Web application.

nesium commented 4 months ago

Oh, thank you! I didn't notice. It's somewhat more difficult in xmpp-rs so I thought it would be the same with strophe.js as well. I'll take care of passing that to the core myself and will close this in favor of the mentioned prose-im/prose-core-client#23