jdev - 2022-07-17


  1. Sam

    I decided to take another stab at implementing multi-item results on XEP-0004: Data Forms, but as usual I'm still confused. The spec makes it look like items and repoted can exist alongside field, title, etc. but what does it even mean to have a normal form that also contains reported/items? Is this correct that a form can have both normal fields and the multi-item stuff?

  2. Zash

    The spec does not forbid it, so it is allowed. Glob help us all.

  3. Sam

    The schema seems to suggest it's allowed (though as usual, I don't know XML schema and may be mis-reading something), but the meaning of the actual text seems very unclear to me

  4. Sam

    I guess a better question is "is anyone else doing or allowing this?"

  5. Sam

    aioxmpp seems to disallow fields being mixed in with items, but it looks like it would allow title/instructions as far as I can see

  6. Zash

    Someone asked about this recently, either here or xsf@, trying to find it.

  7. Sam

    Might have been me; I think I tried to do this a couple of months ago but I can't remember what was said

  8. Sam

    nbxmpp (Gajim) appears to allow title and instructions but disallow fields too; I guess I'll just do this since that's what others are doing (though if anyone has an example of doing something else, I'd love to know)

  9. Sam

    Although this seems entirely unsupported by the text or schema.

  10. Zash

    Aha, found https://logs.xmpp.org/xsf/2022-06-07?p=h#2022-06-07-50bc9a07d99ec16a

  11. Sam

    oh nice, thanks

  12. Sam

    drat; singpolyma makes a good argument for why both make sense, now I'm not sure what to do.

  13. Zash

    https://logs.xmpp.org/xsf/2022-06-08?p=h#2022-06-08-7b362a17b6eba8a8 hints at prior art of allowing both (or not disallowing)

  14. Zash

    I note that Prosody's util.dataforms doesn't do <reported> at all

  15. Zash

    There's a user search module doing it, but it's constructing the XML itself IIRC

  16. lovetox

    Sam, i never came across a use case where this is needed

  17. lovetox

    and i dont implement stuff that "maybe, in theory someone at someday could need"

  18. lovetox

    especially if it is not described as a clear use case for the xep

  19. lovetox

    and only is possible because nothing forbids it

  20. Sam

    singpolymas example is a pretty concrete one though (in jmp.chat they want to show the account balance followed by a table of recent transactions)

  21. Sam

    Sounds like there are already some incompatibilities due to the ambiguity in the spec, so maybe I should just not implement it at all.

  22. lovetox

    you know you cannot have only one dataform in a stanza

  23. Sam

    That normally means "this form or this other fallback form" in most specs though, not "display both these forms"

  24. Sam

    (to be clear, it sounded like you were saying "you must have multiple forms", but obviously that's not right, so I'm assuming you meant "it's possible to have multiple forms"?)

  25. lovetox

    yes its possible, depends on where you use that

  26. Sam

    Sure, so now if I include a normal form and a multi-item form we have an ambiguity about what that means that may depend on context, so I dunno if that approach is better

  27. lovetox

    are we talking about adhoc results?

  28. Sam

    Could be anything, this is just a generic library for building forms to be embedded in other things (ad-hoc is one of the things that already uses it)

  29. lovetox

    funny, the adhoc spec misses the FORM_TYPE in all its dataforms

  30. lovetox

    and i never heard of "fallback" forms

  31. lovetox

    either you support dataforms or not

  32. lovetox

    the adhoc spec does not say anything about multiple forms

  33. Sam

    I'd have to go look, but I'm pretty sure several specs define having multiple forms in one payload as "if you don't support something in the first form, use the second"

  34. Sam

    or "show the title and let the user choose between these two forms" or something along thos elines

  35. lovetox

    i think you misremember, you probably mean IBR

  36. lovetox

    which has a Dataform, and if you dont support a dataform, here are custom xep defined fileds as fallback

  37. Sam

    Could be, but either way it sounds like the meaning of multiple forms is also not well defined or is very context dependent, which still makes it hard to implement data forms cleanly

  38. lovetox

    there is no fallback for "i implemented only half of the dataform xep"

  39. lovetox

    but this would not have anything to do with your lib or?

  40. lovetox

    you just parse a dataform

  41. lovetox

    if its 2, then you parse 2

  42. Zash

    You don't strictly need FORM_TYPE to render a random form, no?

  43. lovetox

    its client business if he displays 2 or 1

  44. lovetox

    Zash, the problem xmpp should be extensible

  45. lovetox

    if the form does not define that its indeed the form from the xep

  46. lovetox

    i cannot filter the forms for the correct formtype

  47. lovetox

    means, if someone attaches a second form, i dont know which one to choose

  48. lovetox

    its like if you add a new custom node, without namespace

  49. lovetox

    yes its possible , but not really good design

  50. lovetox

    to the use case with the account balance, if someone adds a issue in Gajim requesting that i display multiple forms below each other on adhoc results

  51. lovetox

    i would implement that

  52. lovetox

    thats like 5 minutes of work

  53. Sam

    Even if we assume this is all a thing we could do that would work for every spec, it's still unclear to me whether multi-item forms should include title/instructions. It makes sense that they would, I just think we need some clarity here

  54. lovetox

    im didnt read the spec for that, but it seems like a nobrainer

  55. lovetox

    like here have a form, but i dont tell you what it is about

  56. lovetox

    does not seems like a good solution

  57. lovetox

    you could argue, its probably in the context of how you requested this clear

  58. Sam

    I don't disagree, but if we say "no fields, but can have instructions" we're just inventing stuff that the spec definitely doesn't say, so that seems like it will cause incompatibilities and problems.

  59. lovetox

    yes this should be clarified

  60. lovetox

    reading the XEP now though nothing idicates that this is not to be expected

  61. lovetox

    title and instructions are described

  62. lovetox

    and later there is one paragraph, about how a table can be displayed in a form

  63. Sam

    Right, but if title and instructions are allowed then why wouldn't fields be?

  64. lovetox

    yes, i agree, its not forbidden

  65. Sam

    But multiple libraries seem to forbid it, so I'm not sure what to do to avoid bad incompatibilities.

  66. lovetox

    it would though then really messy in my opinion

  67. lovetox

    like then the order really matters

  68. lovetox

    like what if reported comes in the middle of the fields etc

  69. lovetox

    like its clear that nobody had this use case in mind

  70. Sam

    Yah

  71. lovetox

    any sane dev would wrap this in some parent nodes

  72. lovetox

    and separate the forms

  73. Sam

    I'm not sure that's true

  74. Sam

    I suppose I need to know what clients are doing in real life. Eg. if most clients would just ignore the second form, now half the data you returned isn't being displayed. Doesn't seem like a good idea in that case.

  75. lovetox

    there is no way clients support this one way or another

  76. lovetox

    its just not a use case until now maybe

  77. lovetox

    and now we can decide which way to go

  78. Sam

    yah, maybe it's impossible to ensure good compatibility so we should just pick something, fix the XEP (or write a new XEP that clarifies it) and move on

  79. lovetox

    or do nothing, having one use case in decades of usage

  80. lovetox

    its just not supported in xmpp ..

  81. Sam

    Maybe, but that still leaves me with "I have to implement this, different clients implement it in different ways and I'm not sure which one I should do"

  82. lovetox

    i doubt this, you have one example where a lib parses both, reported and normal fields into one object?

  83. Sam

    Apparently Smack allows mixing them, but nbxmpp does not. Which is right? The current state of the world is fine only until some dev sends a mixed form from smack to nbxmpp and now they can't figure out why their thing is broken.

  84. lovetox

    smacks allows to parse it mixed?

  85. lovetox

    or smacks allows to create mixed forms?

  86. Sam

    Apparently; that's what someone said earlier

  87. Sam

    Both, I think? Let me try to figure it out, one moment

  88. lovetox

    because thats two very different things

  89. Sam

    Actually, I don't see multi-item forms in Smack at all, so maybe they were wrong

  90. Sam

    oh wait, there it is, looking again

  91. Sam

    Yah, looks like it allows both. It parses using the same dataform builder that you'd use to create your own, and it allows adding fields and items

  92. lovetox

    and then how does it make it accessable by the client?

  93. Sam

    You can call a method to get fields, you can call another method to get items

  94. lovetox

    .......

  95. lovetox

    damn it

  96. lovetox

    :D

  97. Sam

    Looks like it loses ordering info between the two; they're kept ordered, but separate

  98. lovetox

    yeah i guess then you have to decide :)

  99. lovetox

    of course its not easily doable, you would need to put extra thought into that

  100. lovetox

    but i guess its always, fields first

  101. lovetox

    items later

  102. lovetox

    atleast i cant think of a reason why i would display a Table first in GUI, and afterwards some info

  103. lovetox

    either way its probably not critical here

  104. Sam

    If I were to support both I think from my APIs perspective I would treat items as if they were just another field that takes multiple values (and the value is other fields).

  105. Sam

    Items are displayed like columns. If there's a field then more items, then they're just two separate tables with the same header.

  106. lovetox

    if i would implement that, i would make something like dataform.add_table()

  107. lovetox

    table.add_row()

  108. Sam

    yah, something like that

  109. Sam

    I'll write up all the possibilities from this discussion and send it to standards@. Maybe then we can come to a consensus and I can write an XEP clarifying this, however it comes out.

  110. lovetox

    i mean if i think about it, and we say, ok that was intended, dataforms support putting both in, its not terrible hard to update the dataform implementations

  111. Sam

    Email describing some of this sent to standards@, please mention anything I've left out or if you think I've mischaracterized anything.