aboutsummaryrefslogtreecommitdiffstats
path: root/spec/scansion/blocking.scs
blob: 809bbcb514275d3431ee9ab6164500c39b6187f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# 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}">
	  <x xmlns="vcard-temp:x:update"/>
	</presence>

Juliet connects

Juliet sends:
	<presence/>

Juliet receives:
	<presence from="${Juliet's full JID}">
	  <x xmlns="vcard-temp:x:update"/>
	</presence>

# 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"/>
	  <x xmlns="vcard-temp:x:update"/>
	</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"/>
	  <x xmlns="vcard-temp:x:update"/>
	</presence>

Romeo receives:
	<presence from="${Juliet's full JID}" to="${Romeo's JID}">
	  <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
	  <x xmlns="vcard-temp:x:update"/>
	</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"/>
	  <x xmlns="vcard-temp:x:update"/>
	</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 disconnects

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

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

Romeo disconnects

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