spec/scansion/mam_extended.scs
author Kim Alvefur <zash@zash.se>
Sat, 23 Mar 2024 20:48:19 +0100
changeset 13465 c673ff1075bd
parent 13409 c8f3cfe59e90
permissions -rw-r--r--
mod_posix: Move everything to util.startup This allows greater control over the order of events. Notably, the internal ordering between daemonization, initialization of libunbound and setup of signal handling is sensitive. libunbound starts a separate thread for processing DNS requests. If this thread is started before signal handling has been set up, it will not inherit the signal handlers and instead behave as it would have before signal handlers were set up, i.e. cause the whole process to immediately exit. libunbound is usually initialized on the first DNS request, usually triggered by an outgoing s2s connection attempt. If daemonization happens before signals have been set up, signals may not be processed at all.

# MAM 0.7.x Extended features

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

---------

Romeo connects

# Enable MAM so we can save some messages
Romeo sends:
	<iq type="set" id="enablemam">
		<prefs xmlns="urn:xmpp:mam:2" default="always">
			<always/>
			<never/>
		</prefs>
	</iq>

Romeo receives:
	<iq type="result" id="enablemam">
		<prefs xmlns="urn:xmpp:mam:2" default="always">
			<always/>
			<never/>
		</prefs>
	</iq>

# Some messages to look for later
Romeo sends:
	<message to="someone@localhost" type="chat" id="chat01">
		<body>Hello</body>
	</message>

Romeo sends:
	<message to="someone@localhost" type="chat" id="chat02">
		<body>U there?</body>
	</message>

# Metadata
Romeo sends:
	<iq type="get" id="mamextmeta">
		<metadata xmlns="urn:xmpp:mam:2"/>
	</iq>

Romeo receives:
	<iq type="result" id="mamextmeta">
		<metadata xmlns="urn:xmpp:mam:2">
			<start timestamp="{scansion:capture:start}" xmlns="urn:xmpp:mam:2" id="{scansion:capture:first}"/>
			<end timestamp="{scansion:capture:end}" xmlns="urn:xmpp:mam:2" id="{scansion:capture:last}"/>
		</metadata>
	</iq>

Romeo sends:
	<iq type="set" id="mamquery1">
		<query xmlns="urn:xmpp:mam:2" queryid="q1"/>
	</iq>

Romeo receives:
	<message to="${Romeo's full JID}">
		<result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:capture:first}">
			<forwarded xmlns="urn:xmpp:forward:0">
				<delay stamp="{scansion:capture:start}" xmlns="urn:xmpp:delay"/>
				<message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat01" from="${Romeo's full JID}">
					<body>Hello</body>
				</message>
			</forwarded>
		</result>
	</message>

Romeo receives:
	<message to="${Romeo's full JID}">
		<result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:capture:last}">
			<forwarded xmlns="urn:xmpp:forward:0">
				<delay stamp="{scansion:capture:end}" xmlns="urn:xmpp:delay"/>
				<message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat02" from="${Romeo's full JID}">
					<body>U there?</body>
				</message>
			</forwarded>
		</result>
	</message>

# FIXME unstable tag order from util.rsm
Romeo receives:
	<iq type="result" id="mamquery1" to="${Romeo's full JID}">
		<fin xmlns="urn:xmpp:mam:2" complete="true" scansion:strict="false">
		</fin>
	</iq>

# Get results in reverse order
Romeo sends:
	<iq type="set" id="mamquery2">
		<query xmlns="urn:xmpp:mam:2" queryid="q1">
			<flip-page/>
		</query>
	</iq>

Romeo receives:
	<message to="${Romeo's full JID}">
		<result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:any}">
			<forwarded xmlns="urn:xmpp:forward:0">
				<delay stamp="{scansion:capture:start}" xmlns="urn:xmpp:delay"/>
				<message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat02" from="${Romeo's full JID}">
					<body>U there?</body>
				</message>
			</forwarded>
		</result>
	</message>

Romeo receives:
	<message to="${Romeo's full JID}">
		<result xmlns="urn:xmpp:mam:2" queryid="q1" id="{scansion:any}">
			<forwarded xmlns="urn:xmpp:forward:0">
				<delay stamp="{scansion:capture:end}" xmlns="urn:xmpp:delay"/>
				<message to="someone@localhost" xmlns="jabber:client" type="chat" xml:lang="en" id="chat01" from="${Romeo's full JID}">
					<body>Hello</body>
				</message>
			</forwarded>
		</result>
	</message>

# FIXME unstable tag order from util.rsm
Romeo receives:
	<iq type="result" id="mamquery2" to="${Romeo's full JID}">
		<fin xmlns="urn:xmpp:mam:2" complete="true" scansion:strict="false">
		</fin>
	</iq>