Disambiguating XEP-0428 Fallbacks for Multiple Elements in a Single Namepsace
Hello, some stanzas I receive contain multiple fallback elements for the same namespace. For example, a client sends multiple files in one message, attaching an OOB and/or SFS element for each file, and then a fallback element for each OOB/SFS element contained in the body. This tells the recipient _where_ a fallback is, as well as _which namespace_ it applies to, but not _which element_ of the namespace that the fallback corresponds to. Is there an established rule for disambiguating which fallback applies to which of the multiple elements it could apply to? My intuition is that fallbacks are put in the same order as the elements they correspond to, so the first OOB fallback attaches to the first OOB element, the second fallback to the second OOB element, and so on. Whatever the answer (if any), it would be nice to note this in XEP-0428 to ensure a recipient can unambiguously determine how to handle such stanzas. I don't like the idea that clients are already sending stanzas like these, but with no (explicitly) agreed-upon way to interpret and disambiguate them.
Hi, According to the wording of XEP-0428, the `for` attribute "indicates the specification that the fallback is meant to replace". And further, "This is typically the primary namespace of the respective specification, but may be specified otherwise." While it has indeed not been made very explicit, from this follows: - Every valid value of `for` is specified as such somewhere. Putting a namespace in the `for` attribute without a specification describing what that namespace means in the `for` attribute is therefore unspecified behavior. - The fallback is for clients not supporting a specification or not supporting the specification for that message as a whole, not for clients not supporting, not displaying or otherwise not treating a part of the message. - XEP-0428 does not specify what is to be done with the fallback in case the specification is not supported. That is intentionally left open so that `for` attribute value specifications can make sufficient rules here. For example, a rule might be that the fallback is only removed when it matches a specific text pattern. So to be more specific to your question and example: A message can't have a fallback element with `for="jabber:x:oob"`, because neither XEP-0066 nor any other document specify this or tell what this would mean. Given that the existence of the oob tag on a message has also no specified meaning other than "communicate a URI", I also wouldn't know what a reasonable rule for this could look like. Further, XEP-0066 also does not specify how or if multiple URIs can be communicated in a single message (it does however specify an optional description for the resource identified by the URI). If a message has two SFS in them and a body with two links to the files, the fallback element could be used (because XEP-0447 describes this). In that case it doesn't matter if you put a single fallback element with the whole body, a fallback element with two body start-to- end elements or two fallback elements each with a body start-to-end: In all cases you are indicating to recipient clients that the body is only for those that don't support SFS. There is no concept in XEP-0447 of a client that supports SFS partially and e.g. only the first file of a message or only those with disposition inline. I don't know what clients do send in the wild right now, so this is speaking from a specification point of view. Marvin PS: XEP-0447 has an explicit example on how to send multi-file messages in backwards compatible way by using more than one message. On Sun, 2026-11-29 at 18:30 +0000, snit--- via Standards wrote:
Hello,
some stanzas I receive contain multiple fallback elements for the same namespace. For example, a client sends multiple files in one message, attaching an OOB and/or SFS element for each file, and then a fallback element for each OOB/SFS element contained in the body.
This tells the recipient _where_ a fallback is, as well as _which namespace_ it applies to, but not _which element_ of the namespace that the fallback corresponds to. Is there an established rule for disambiguating which fallback applies to which of the multiple elements it could apply to?
My intuition is that fallbacks are put in the same order as the elements they correspond to, so the first OOB fallback attaches to the first OOB element, the second fallback to the second OOB element, and so on.
Whatever the answer (if any), it would be nice to note this in XEP- 0428 to ensure a recipient can unambiguously determine how to handle such stanzas. I don't like the idea that clients are already sending stanzas like these, but with no (explicitly) agreed-upon way to interpret and disambiguate them. _______________________________________________ Standards mailing list -- standards@xmpp.org To unsubscribe send an email to standards-leave@xmpp.org
Hello, On Nov 29, 2026, 21:10:21, "Marvin W. via Standards" <standards@xmpp.org> wrote:
A message can't have a fallback element with `for="jabber:x:oob"`, because neither XEP-0066 nor any other document specify this or tell what this would mean. Given that the existence of the oob tag on a message has also no specified meaning other than "communicate a URI", I also wouldn't know what a reasonable rule for this could look like. Further, XEP-0066 also does not specify how or if multiple URIs can be communicated in a single message (it does however specify an optional description for the resource identified by the URI).
I've already seen this in the wild, i.e. in Monocles. I hadn't thought there'd even be much to specify. Why would the protocol tell me what I need to be doing with a fallback range? OOB tells me that a URI was conveyed, and the fallback range tells me what the compatibility fallback was, but is it not my job to figure out how to show these aspects to the user? If there really does need to be explicit specification for every single specification that wishes to use a fallback, then this should _really_ be specified in 0428. Though, either way, I already opened a PR earlier to document fallbacks with OOB, because it surprised me it wasn't already documented. I just copied the wording of replies, which also doesn't actually mandate anything beyond "use the namespace", exactly as I'd expect.
If a message has two SFS in them and a body with two links to the files, the fallback element could be used (because XEP-0447 describes this). In that case it doesn't matter if you put a single fallback element with the whole body, a fallback element with two body start-to- end elements or two fallback elements each with a body start-to-end: In all cases you are indicating to recipient clients that the body is only for those that don't support SFS. There is no concept in XEP-0447 of a client that supports SFS partially and e.g. only the first file of a message or only those with disposition inline.
Right, I'm not talking about clients that don't support SFS, or some really broken client that somehow only "partially" supports it. If I send two SFS elements and two fallback elements, one for each SFS element, a recipient which _does_ support SFS properly currently has no way of telling which fallback applies to which SFS element. The recipient only knows that there's two fallbacks, and that both apply to some arbitrary SFS element, but not which fallback corresponds to which SFS element. For example, if a client intersperses the media fallbacks within normal body text (i.e. "before: $photo1; after: $photo2"), there's nothing I can do to actually tell the user that $photo1 is the "before" picture, and $photo2 is the "after" picture, just that there ARE pictures in those locations. Another example: if a client allows multi-reply messages (I couldn't find anything against this use-case), then it can't use fallback ranges to determine where in the message to place each reply. As far as I can tell, the only solution to this at the moment is to pray and hope the sender formed their plaintext body in an exact known format I can parse for, and then ignore the fallback ranges entirely so I can just figure it out myself... which obviously breaks if those prayers aren't answered. So it seems my options are: * implement a very fragile parser running on hopes and dreams * use the fallback element, knowing that it only gives half the information needed to be useful here * do both and get the worst of both worlds, resulting in a horrible user experience that seems to degrade entirely at random This feels unacceptable to me. What's the point of the XEP if it doesn't actually tell me the information I need for it to be useful? Especially when the fix here is as simple as adding a sentence about how the order of the fallback elements must match the order of the elements they correspond to... or, I don't know, adding an index attribute or something. I guess, worst case scenario, I assume the current Monocles behavior of sending elements in order was intentional and do the same myself.
Hi, The XEP-0428 annotation only tells you that a specific part of the message was added so that clients that don't understand a specification still can show a message that is close to the original message meaning (even if not the same). What clients do with it, especially how, if or when that fallback part is displayed, is not specified. This is because the content of the fallback might still be usable even if the specification is supported. XEP-0428 fallback annotation is not meant to say "if you know specification X, replace this part with what it provides". There is no direct relation between the fallback element and any other extension element in the stanza, neither by order nor in a different way. If a specification, like a file sharing specification, wanted to specify that it's meant to be injected in a specific point of the body, they would need to do so independent of the fallback element, e.g. though something like <file-sharing insert-at="22" />. XEP-0477 and XEP-0066 both don't provide means to do that. For XEP-0066 that makes sense because it does not make any statements about what to do with the URI and so, if it was to say "insert in the body at position X" or "replace the URI at position X length Y", that would be equivalent of just putting the URI in the body at that position. For SFS, that was a deliberate decision to not require clients to display mixed content, which is often non-trivial and comes with all sorts of downsides and unflexibilities when it comes to user interface design. When a picture is injected into the body, there would also suddenly be dozens of questions on the how that should look like (Look at the options HTML or a word processor give you for this). Your example: "before: $photo1; after: $photo2" I hope that "$photo1" is not verbatim, but rather a URI. Otherwise the fallback would be entirely useless to clients that render it. Just wanted to clarify that, because I believe you misunderstood fallback as a "replace here", in which case a placeholder like "$photo1" would potentially make sense. One way to do this with SFS would be: <message> <body>before: https://...; after: https://...</body> <fallback for='urn:xmpp:sfs:0'><body/></fallback> <file-sharing id="1"> <file> <desc>before</desc> <!-- ... --> </file> <sources><!-- ... --></sources> </file-sharing> <file-sharing id="2"> <file> <desc>after</desc> <!-- ... --> </file> <sources><!-- ... --></sources> </file-sharing> </message> The description of a shared file goes into the <file-sharing> and the whole body becomes a fallback. It is then up to the receiving client if they display the "before" and "after" before the picture, below it, as a title or in a different way, but the meaning is what gets across. Regarding your multiple reply example: Nowhere in XEP-0461 does it suggest you could use it to reply to multiple messages. The wording is always very singular. Further, it also doesn't make huge assumptions in how a reply is rendered. I believe many clients will put the information that a message is a reply above the message content, but nothing would prevent a client from displaying it below, side-by-side, or in a different way I haven't considered yet. The intended way to reply to two different messages with XEP-0461 is to send two messages. If XEP-0428, XEP-0066 or any other specification is unsuitable for what you want to do with it, that doesn't automatically mean it's useless. You do seem to have very specific goals in mind and it might well be that our current specification suite is not good for that. Marvin On Sun, 2026-11-29 at 22:50 +0000, snit--- via Standards wrote:
Hello,
On Nov 29, 2026, 21:10:21, "Marvin W. via Standards" <standards@xmpp.org> wrote:
A message can't have a fallback element with `for="jabber:x:oob"`, because neither XEP-0066 nor any other document specify this or tell what this would mean. Given that the existence of the oob tag on a message has also no specified meaning other than "communicate a URI", I also wouldn't know what a reasonable rule for this could look like. Further, XEP-0066 also does not specify how or if multiple URIs can be communicated in a single message (it does however specify an optional description for the resource identified by the URI).
I've already seen this in the wild, i.e. in Monocles. I hadn't thought there'd even be much to specify. Why would the protocol tell me what I need to be doing with a fallback range? OOB tells me that a URI was conveyed, and the fallback range tells me what the compatibility fallback was, but is it not my job to figure out how to show these aspects to the user?
If there really does need to be explicit specification for every single specification that wishes to use a fallback, then this should _really_ be specified in 0428. Though, either way, I already opened a PR earlier to document fallbacks with OOB, because it surprised me it wasn't already documented. I just copied the wording of replies, which also doesn't actually mandate anything beyond "use the namespace", exactly as I'd expect.
If a message has two SFS in them and a body with two links to the files, the fallback element could be used (because XEP-0447 describes this). In that case it doesn't matter if you put a single fallback element with the whole body, a fallback element with two body start-to- end elements or two fallback elements each with a body start-to- end: In all cases you are indicating to recipient clients that the body is only for those that don't support SFS. There is no concept in XEP-0447 of a client that supports SFS partially and e.g. only the first file of a message or only those with disposition inline.
Right, I'm not talking about clients that don't support SFS, or some really broken client that somehow only "partially" supports it. If I send two SFS elements and two fallback elements, one for each SFS element, a recipient which _does_ support SFS properly currently has no way of telling which fallback applies to which SFS element. The recipient only knows that there's two fallbacks, and that both apply to some arbitrary SFS element, but not which fallback corresponds to which SFS element.
For example, if a client intersperses the media fallbacks within normal body text (i.e. "before: $photo1; after: $photo2"), there's nothing I can do to actually tell the user that $photo1 is the "before" picture, and $photo2 is the "after" picture, just that there ARE pictures in those locations. Another example: if a client allows multi-reply messages (I couldn't find anything against this use- case), then it can't use fallback ranges to determine where in the message to place each reply.
As far as I can tell, the only solution to this at the moment is to pray and hope the sender formed their plaintext body in an exact known format I can parse for, and then ignore the fallback ranges entirely so I can just figure it out myself... which obviously breaks if those prayers aren't answered. So it seems my options are: * implement a very fragile parser running on hopes and dreams * use the fallback element, knowing that it only gives half the information needed to be useful here * do both and get the worst of both worlds, resulting in a horrible user experience that seems to degrade entirely at random
This feels unacceptable to me. What's the point of the XEP if it doesn't actually tell me the information I need for it to be useful? Especially when the fix here is as simple as adding a sentence about how the order of the fallback elements must match the order of the elements they correspond to... or, I don't know, adding an index attribute or something. I guess, worst case scenario, I assume the current Monocles behavior of sending elements in order was intentional and do the same myself. _______________________________________________ Standards mailing list -- standards@xmpp.org To unsubscribe send an email to standards-leave@xmpp.org
On Sun, 29 Nov 2026 at 21:19, Marvin W. via Standards <standards@xmpp.org> wrote:
- Every valid value of `for` is specified as such somewhere. Putting a namespace in the `for` attribute without a specification describing what that namespace means in the `for` attribute is therefore unspecified behavior.
I don't think it does follow at all. I think it's sensible for specifications to suggest fallback namespaces; I don't think it's essential for them to do so. Moreover, I think the "unknown for value" is very well specified, and indeed entirely the point of the specification!
- The fallback is for clients not supporting a specification or not supporting the specification for that message as a whole, not for clients not supporting, not displaying or otherwise not treating a part of the message.
Agreed.
- XEP-0428 does not specify what is to be done with the fallback in case the specification is not supported. That is intentionally left open so that `for` attribute value specifications can make sufficient rules here. For example, a rule might be that the fallback is only removed when it matches a specific text pattern.
I think it does - if someone sends a fallback for value that is (for some reason) not understood by the receiving client, then the fallback "edit" isn't applied. Fun example: Sending a JMI message to Conversations with a fallback for JMI causes Conversations to disregard the JMI element entirely, and only display the fallback text. I can follow it might choose to display the fallback body - I think that's poor behaviour but not illegal - but I think not handling the JMI is wrong.
So to be more specific to your question and example:
A message can't have a fallback element with `for="jabber:x:oob"`, because neither XEP-0066 nor any other document specify this or tell what this would mean. Given that the existence of the oob tag on a message has also no specified meaning other than "communicate a URI", I also wouldn't know what a reasonable rule for this could look like. Further, XEP-0066 also does not specify how or if multiple URIs can be communicated in a single message (it does however specify an optional description for the resource identified by the URI).
I don't follow this logic. A receiving client should just display the body unadjusted by the fallback, or, if it decides it understands "jabber:x:oob", it applies the fallback.
If a message has two SFS in them and a body with two links to the files, the fallback element could be used (because XEP-0447 describes this). In that case it doesn't matter if you put a single fallback element with the whole body, a fallback element with two body start-to- end elements or two fallback elements each with a body start-to-end: In all cases you are indicating to recipient clients that the body is only for those that don't support SFS. There is no concept in XEP-0447 of a client that supports SFS partially and e.g. only the first file of a message or only those with disposition inline.
Agreed. Dave.
Hi Dave, Maybe I need to explain a little bit more on that. Of course you may put *any* value into the for attribute, and for the purposes of XEP-0428, that carries the exact same meaning: The part of the message body or all of it is a fallback for something. Now the interesting question is what to do with that information. Even a client that has no idea what the for attribute value is referring to might decide to put special formatting to the fallback part or otherwise indicate to its user that this is not the sender intended content and only exists so that their client can still display something useful. However, I do not believe that we should assume receiving clients to do anything in particular with a marked fallback when we don't also have a specification saying so based on the value of the for attribute. So your example with fallback for JMI is that the body is indeed a fallback, but the receiving client doesn't have any rules for what to do with that for attribute value and thus would treat it the same as any other unknown for attribute value. XEP-0428 says that the for attribute value is "typically the primary namespace of the respective specification". That is intentionally very vague, for once because we don't actually define "primary namespace of a specification" (although I agree we all probably have a good understanding of what is meant with that phrase) and also it says "typically" making it clear that it doesn't need to be and diversion is entirely allowed and possible. The intention of the wording was to give guidance to XEP authors that want to define behavior for a `for` attribute value, not to say that once you put a namespace there, every client knowing that namespace must hide the fallback. If we were to still make use of the registrar, we should probably introduce a registry of `for` attribute values. XEP-0428 also says "supporting clients can hide or dim those parts when displaying them to the user or otherwise treat those parts special as intended or encouraged by other specifications". That again supports my point of not expecting any particular behavior without explicit specification wording. Regarding your JMI with fallback body Conversations behavior, I do agree that nothing suggests that a message that has both a body and JMI should not cause JMI behavior. That is, however, independent of adding a fallback element to it. Marvin On Mon, 2026-11-30 at 09:22 +0000, Dave Cridland wrote:
On Sun, 29 Nov 2026 at 21:19, Marvin W. via Standards <standards@xmpp.org> wrote:
- Every valid value of `for` is specified as such somewhere. Putting a namespace in the `for` attribute without a specification describing what that namespace means in the `for` attribute is therefore unspecified behavior.
I don't think it does follow at all.
I think it's sensible for specifications to suggest fallback namespaces; I don't think it's essential for them to do so.
Moreover, I think the "unknown for value" is very well specified, and indeed entirely the point of the specification!
- The fallback is for clients not supporting a specification or not supporting the specification for that message as a whole, not for clients not supporting, not displaying or otherwise not treating a part of the message.
Agreed.
- XEP-0428 does not specify what is to be done with the fallback in case the specification is not supported. That is intentionally left open so that `for` attribute value specifications can make sufficient rules here. For example, a rule might be that the fallback is only removed when it matches a specific text pattern.
I think it does - if someone sends a fallback for value that is (for some reason) not understood by the receiving client, then the fallback "edit" isn't applied.
Fun example:
Sending a JMI message to Conversations with a fallback for JMI causes Conversations to disregard the JMI element entirely, and only display the fallback text.
I can follow it might choose to display the fallback body - I think that's poor behaviour but not illegal - but I think not handling the JMI is wrong.
So to be more specific to your question and example:
A message can't have a fallback element with `for="jabber:x:oob"`, because neither XEP-0066 nor any other document specify this or tell what this would mean. Given that the existence of the oob tag on a message has also no specified meaning other than "communicate a URI", I also wouldn't know what a reasonable rule for this could look like. Further, XEP-0066 also does not specify how or if multiple URIs can be communicated in a single message (it does however specify an optional description for the resource identified by the URI).
I don't follow this logic.
A receiving client should just display the body unadjusted by the fallback, or, if it decides it understands "jabber:x:oob", it applies the fallback.
If a message has two SFS in them and a body with two links to the files, the fallback element could be used (because XEP-0447 describes this). In that case it doesn't matter if you put a single fallback element with the whole body, a fallback element with two body start-to- end elements or two fallback elements each with a body start-to- end: In all cases you are indicating to recipient clients that the body is only for those that don't support SFS. There is no concept in XEP-0447 of a client that supports SFS partially and e.g. only the first file of a message or only those with disposition inline.
Agreed.
Dave. _______________________________________________ Standards mailing list -- standards@xmpp.org To unsubscribe send an email to standards-leave@xmpp.org
On Sun, 29 Nov 2026 at 18:50, snit--- via Standards <standards@xmpp.org> wrote:
Hello,
some stanzas I receive contain multiple fallback elements for the same namespace. For example, a client sends multiple files in one message, attaching an OOB and/or SFS element for each file, and then a fallback element for each OOB/SFS element contained in the body.
That seems wrong. Fallback was originally intended to be a note that the body was purely for fallback purposes - that is, that clients needn't display it if they understood the feature it referred to. Then it got adjusted to indicate that part of the body was for fallback purposes. If clients don't understand the feature, just display the whole body. If they do, then edit the message.
This tells the recipient _where_ a fallback is, as well as _which namespace_ it applies to, but not _which element_ of the namespace that the fallback corresponds to. Is there an established rule for disambiguating which fallback applies to which of the multiple elements it could apply to?
I don't think this is needed, though. Either the client understands (say) OOB, in which case it applies the edit, otherwise do not. Multiple fallbacks for the same feature don't make sense. Dave.
participants (3)
-
Dave Cridland -
Marvin W. -
snit@cock.li