Freyskeyd / xmpp-rs

18 stars 4 forks source link

Improve `StaticSessionState` #28

Open Freyskeyd opened 3 years ago

Freyskeyd commented 3 years ago

SessionState is an Enum which represent the internal state of a session (both unauthenticated and authenticated). This state wasn't completely useful because of the lack of informations like the JID etc.

A Session hold its state but when receiving packet it must produce a Static snapshot of its state to share it alongside the packet. The StaticSessionState will be use to provide informations about the sender to the packet consumer. It must provide a way to:

As a Session when receiving a StaticSessionState it must choose wether or not it needs to update its internal state.

i.e.: When the binding packet is received, the session hold a jid which is a BareJid. The session manager will authorize (or not) the session to proceed. In case of a success we want the internal state of the Session to be a FullJid with the negotiated resource.