Hi Singpolyma,
Yeah, I imagine the <message> based solution similar to that too.
I'm curious of the use case of polls in 1:1 chat, do you one?
Le lundi 1 décembre 2025, 15:49:22 heure normale d’Europe centrale Stephen Paul Weber a
écrit :
I have also been thinking about implementing polls for
some time. For polls
in the context of a chat (1:1 or MUC) this is my proposal:
XEP-0004 says the following:
The <x/> element qualified by the
'jabber:x:data' namespace SHOULD be
included either directly as a first-level child of a <message/> stanza or
...
The full context for the data is provided by
three things ... the place of
the form within ... structured conversation (e.g., a message <thread/>)
For <message/> stanzas, the <thread/>
SHOULD be copied in the reply if
provided. The <x/> element qualified by the 'jabber:x:data' namespace MUST
be a child of the <message/> stanza.
This gives us a very natural poll transport mechanism, as follows:
<message id="poll1" type="groupchat" from="romeo">
<x xmlns="jabber:x:data" type="form">
<field var="FORM_TYPE"
type="hidden"><value>urn:...polls</value></field>
<field var="q" label="A or B?"
type="list-single">
<option><value>A</value></option>
<option><value>B</value></option>
</field>
</x>
<thread>poll-uuid</thread>
</message>
<message id="pollresponse1" type="groupchat"
from="juliet">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE"
type="hidden"><value>urn:...polls</value></field>
<field var="q" label="A or B?"
type="list-single">
<value>A</value>
</field>
</x>
<thread>poll-uuid</thread>
</message>