Comparison

spec/scansion/muc_presence_probe.scs @ 11245:43b43e7156b8

MUC: Add support for presence probes (fixes #1535) The following patch allows Prosody to respond to `probe` presences and send out the probed occupant's current presence. This is based on line 17.3 in XEP-0045: A MUC service MAY handle presence probes sent to the room JID <room@service> or an occupant JID <room@service/nick> (e.g, these might be sent by an occupant's home server to determine if the room is still online or to synchronize presence information if the user or the user's server has gone offline temporarily or has started sharing presence again, as for instance when Stanza Interception and Filtering Technology (XEP-0273) is used).
author JC Brand <jc@opkode.com>
date Sun, 19 Apr 2020 21:49:45 +0200
child 11246:ab189e707705
comparison
equal deleted inserted replaced
11244:8a1f88241cb1 11245:43b43e7156b8
1 # #1535 Let MUCs respond to presence probes
2
3 [Client] Romeo
4 jid: user@localhost
5 password: password
6
7 [Client] Juliet
8 jid: user2@localhost
9 password: password
10
11 [Client] Mercutio
12 jid: user3@localhost
13 password: password
14
15 -----
16
17 Romeo connects
18
19 Romeo sends:
20 <presence to="room@conference.localhost/Romeo">
21 <x xmlns="http://jabber.org/protocol/muc"/>
22 </presence>
23
24 Romeo receives:
25 <presence from='room@conference.localhost/Romeo'>
26 <x xmlns='http://jabber.org/protocol/muc#user'>
27 <status code='201'/>
28 <item jid="${Romeo's full JID}" affiliation='owner' role='moderator'/>
29 <status code='110'/>
30 </x>
31 </presence>
32
33 Romeo receives:
34 <message type='groupchat' from='room@conference.localhost'><subject/></message>
35
36 # Disable presences for non-mods
37 Romeo sends:
38 <iq id='config1' to='room@conference.localhost' type='set'>
39 <query xmlns='http://jabber.org/protocol/muc#owner'>
40 <x xmlns='jabber:x:data' type='submit'>
41 <field var='FORM_TYPE'>
42 <value>http://jabber.org/protocol/muc#roomconfig</value>
43 </field>
44 <field var='muc#roomconfig_presencebroadcast'>
45 <value>moderator</value>
46 </field>
47 </x>
48 </query>
49 </iq>
50
51 Romeo receives:
52 <iq id="config1" from="room@conference.localhost" type="result">
53 </iq>
54
55 # Juliet connects, and joins the room
56 Juliet connects
57
58 Juliet sends:
59 <presence to="room@conference.localhost/Juliet">
60 <x xmlns="http://jabber.org/protocol/muc"/>
61 </presence>
62
63 Juliet receives:
64 <presence from="room@conference.localhost/Romeo" />
65
66 Juliet receives:
67 <presence from="room@conference.localhost/Juliet" />
68
69 # Romeo probes Juliet
70
71 Romeo sends:
72 <presence to="room@conference.localhost/Juliet" type="probe">
73 <x xmlns="http://jabber.org/protocol/muc"/>
74 </presence>
75
76 Romeo receives:
77 <presence from='room@conference.localhost/Juliet'>
78 <x xmlns='http://jabber.org/protocol/muc#user'>
79 <item jid="${Juliet's full JID}" affiliation='none' role='participant'/>
80 </x>
81 </presence>
82
83 # Romeo makes Mercutio a member and registers his nickname
84
85 Romeo sends:
86 <iq id='member1' to='room@conference.localhost' type='set'>
87 <query xmlns='http://jabber.org/protocol/muc#admin'>
88 <item affiliation='member' jid="${Mercutio's JID}" nick="Mercutio"/>
89 </query>
90 </iq>
91
92 Romeo receives:
93 <message from='room@conference.localhost'>
94 <x xmlns='http://jabber.org/protocol/muc#user'>
95 <item jid="${Mercutio's JID}" affiliation='member' />
96 </x>
97 </message>
98
99 Romeo receives:
100 <iq from='room@conference.localhost' id='member1' type='result'/>
101
102
103 # Romeo probes Mercutio, even though he's unavailable
104
105 Romeo sends:
106 <presence to="room@conference.localhost/Mercutio" type="probe">
107 <x xmlns="http://jabber.org/protocol/muc"/>
108 </presence>
109
110 Romeo receives:
111 <presence from='room@conference.localhost/Mercutio' type="unavailable">
112 <x xmlns='http://jabber.org/protocol/muc#user'>
113 <item nick="Mercutio" affiliation='member' role='none' jid="${Mercutio's JID}" />
114 </x>
115 </presence>