spec/scansion/blocking.scs
author Matthew Wild <mwild1@gmail.com>
Mon, 20 Feb 2023 18:10:15 +0000
branch0.12
changeset 12898 0598d822614f
parent 10816 3bd846c76701
permissions -rw-r--r--
mod_websocket: Fire pre-session-close event (fixes #1800) This event was added in a7c183bb4e64 and is required to make mod_smacks know that a session was intentionally closed and shouldn't be hibernated (see fcea4d9e7502). Because this was missing from mod_websocket's session.close(), mod_smacks would always attempt to hibernate websocket sessions even if they closed cleanly. That mod_websocket has its own copy of session.close() is something to fix another day (probably not in the stable branch). So for now this commit makes the minimal change to get things working again. Thanks to Damian and the Jitsi team for reporting.

# XEP-0191: Blocking Command

[Client] Romeo
	jid: blocker@localhost
	password: password

[Client] Juliet
	jid: blockee@localhost
	password: password

-----

# The parties connect
Romeo connects

Romeo sends:
	<presence/>

Romeo receives:
	<presence from="${Romeo's full JID}"/>

Juliet connects

Juliet sends:
	<presence/>

Juliet receives:
	<presence from="${Juliet's full JID}"/>

# They add each other
Romeo sends:
	<presence type="subscribe" to="${Juliet's JID}"/>

Romeo receives:
	<presence from="${Juliet's JID}" to="${Romeo's JID}" type="unavailable"/>

Juliet receives:
	<presence type="subscribe" to="${Juliet's JID}" from="${Romeo's JID}"/>

Juliet sends:
	<presence type="subscribed" to="${Romeo's JID}"/>

Romeo receives:
	<presence from="${Juliet's full JID}" to="${Romeo's JID}">
	  <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
	</presence>

Juliet sends:
	<presence type="subscribe" to="${Romeo's JID}"/>

Juliet receives:
	<presence from="${Romeo's JID}" to="${Juliet's JID}" type="unavailable"/>

Romeo receives:
	<presence type="subscribe" to="${Romeo's JID}" from="${Juliet's JID}"/>

Romeo sends:
	<presence type="subscribed" to="${Juliet's JID}"/>

Juliet receives:
	<presence from="${Romeo's full JID}" to="${Juliet's JID}">
	  <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
	</presence>

Romeo receives:
	<presence from="${Juliet's full JID}" to="${Romeo's JID}">
	  <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
	</presence>

# They can now talk
Juliet sends:
	<message type="chat" to="${Romeo's JID}">
	  <body>ohai</body>
	</message>

Romeo receives:
	<message type="chat" to="${Romeo's JID}" from="${Juliet's full JID}">
	  <body>ohai</body>
	</message>

# And now to the blockining

Romeo sends:
	<iq type="set" id="lx2">
	  <block xmlns="urn:xmpp:blocking">
	    <item jid="${Juliet's JID}"/>
	  </block>
	</iq>

Romeo receives:
	<iq type="result" id="lx2"/>

Juliet receives:
	<presence type="unavailable" to="${Juliet's JID}" from="${Romeo's full JID}"/>

# Can"t talk anymore
Romeo sends:
	<message type="chat" to="${Juliet's JID}">
	  <body>hello?</body>
	</message>

Romeo receives:
	<message type="error" from="${Juliet's JID}">
	  <error type="cancel">
	    <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
	    <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">You have blocked this JID</text>
	    <blocked xmlns="urn:xmpp:blocking:errors"/>
	  </error>
	</message>

Juliet sends:
	<message type="chat" to="${Romeo's JID}"/>

Juliet receives:
	<message type="error" from="${Romeo's JID}">
	  <error type="cancel">
	    <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
	  </error>
	</message>

Romeo sends:
	<iq type="set" id="lx3">
	  <unblock xmlns="urn:xmpp:blocking">
	    <item jid="${Juliet's JID}"/>
	  </unblock>
	</iq>

Juliet receives:
	<presence to="${Juliet's JID}" from="${Romeo's full JID}">
	  <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
	</presence>

Romeo receives:
	<iq type="result" id="lx3"/>

# Can talk again
Romeo sends:
	<message type="chat" to="${Juliet's JID}">
	  <body>hello!</body>
	</message>

Juliet receives:
	<message type="chat" to="${Juliet's JID}" from="${Romeo's full JID}">
	  <body>hello!</body>
	</message>

# Bye
Juliet sends:
	<presence type="unavailable"/>

Juliet disconnects

Romeo receives:
	<presence from="${Juliet's full JID}" to="${Romeo's JID}" type="unavailable"/>

Romeo sends:
	<presence type="unavailable"/>

Romeo disconnects