jdev - 2020-01-15


  1. lovetox

    does it make sense to try PLAIN on a host from xmpp-client?

  2. lovetox

    or does xmpp-client always mean START TLS

  3. MattJ

    PLAIN? The SASL mechanism?

  4. lovetox

    no, i mean no TLS

  5. MattJ

    Or do you mean a totally unencrypted connection?

  6. lovetox

    unencrypted

  7. MattJ

    It doesn't make sense to ever try an unencrypted connection

  8. Kev

    If what SRV resolves to doesn't offer TLS, it's a matter of local policy whether you'll continue without it.

  9. lovetox

    try is the wrong word

  10. lovetox

    the user wants to connect PLAIN, do i resolve xmpp-client and try there

  11. MattJ

    Yes

  12. lovetox

    or do i just resolve domain

  13. lovetox

    and use 5222

  14. MattJ

    You would still obey SRV

  15. Kev

    You always use SRV unless the user explicitly asks you not to (if you support such a thing).

  16. lovetox

    i wondered because xmpps-client is explicitly for DIRECT TLS

  17. lovetox

    so even if the user wants PLAIN, i would never try there

  18. lovetox

    i wondererd if xmpp-client is explicitly for START TLS

  19. Kev

    Calling it PLAIN is somewhat misleading. PLAIN is a SASL mechanism.

  20. Kev

    You mean 'The user asks to never use TLS', I think?

  21. flow

    lovetox, no, xmpp-client is for the TCP binding of XMPP defined bin RFC6120

  22. lovetox

    yes, the user asks to connect unencrypted

  23. lovetox

    ok good, thats what i wanted to know

  24. lovetox

    so i still have to resolve xmpp-client, before i go the domain:5222 fallback route

  25. MattJ

    Yes

  26. flow

    lovetox, that is what is written down in rfc6120 ;)

  27. lovetox

    i wondered why did we add websocket and bosh into a TXT record

  28. lovetox

    why not xmpp-client-websocket._tcp ..

  29. MattJ

    Because they need URLs

  30. lovetox

    ah its not allwoed

  31. lovetox

    ok

  32. lovetox

    its bit weird because it doesnt allow for weight and priority

  33. lovetox

    but i guess that would be really an edge case to have more than one websocket connection point

  34. MattJ

    HTTP doesn't

  35. lovetox

    ah so it always has to be over 80/443

  36. MattJ

    Yes

  37. lovetox

    that makes sense then

  38. MattJ

    We were discussing recently the 20 year-old bug report for Firefox to support SRV for HTTP

  39. MattJ

    Web folk have no interest in it

  40. lovetox

    writing since quite a time to move all connection/dns logic from gajim into nbxmpp

  41. lovetox

    if you want to support, xmpps, xmpp, websocket, unencrypted, proxy for websocket and tcp, setting a custom host (no srv resolution)

  42. lovetox

    and the lib should handle that all automatically, does get a bit complicated :D

  43. MattJ

    Indeed

  44. MattJ

    Someone needs to make a flowchart

  45. flow

    lovetox, that's exactly what I am also currently dealing with in my not-so-small smack refactor project

  46. lovetox

    but i have the luck of GLib taking most of the dns resolution away from me

  47. lovetox

    because if i would have to deal with stuff like happy eyeballs etc

  48. lovetox

    then i think it gets a bit crazy :)

  49. flow

    I think you probably want happy eyeballs not only on the DNS level, but also on the connection level

  50. lovetox

    actually they ever provide methods like connect_to_service() where i just pass "xmpps-client"

  51. flow

    e.g. initiate TCP connections to the ipv4 and ipv6 endpoints in parallel

  52. lovetox

    yes flow GLib does that

  53. lovetox

    i incorrectly said DNS resolution, but GLib also does my connection

  54. flow

    nice

  55. lovetox

    though i had to implement socks5 proxy myself, because the code is really broken in GLib, but socks5 is really minimal, so not a problem

  56. flow

    now you may only want to make parallel connect_to_service calls for tcp+tls/direct-tls/websocket/bosh and use the transport whoever finishes first ;)

  57. lovetox

    hm no because they are not equivalent

  58. flow

    (I actually thought about doing that in Smack but decided against it for the moment, only the endpoint discovery runs concurrently)

  59. flow

    lovetox, I'd argue they are equivalent

  60. lovetox

    not direct tls has fewer roundtrips

  61. lovetox

    websocket is not as efficient as tcp

  62. flow

    sure, but why does it matter

  63. lovetox

    why does efficiency matter?

  64. flow

    that's not what I said

  65. lovetox

    of course i will try the way with fewest roundtrips first

  66. flow

    yes, there is a higher overhead in some transports, but isn't it also important to the user that the connection is established fast?

  67. lovetox

    also the chance that xmpps connect is failing although the server admin specified a srv record for it

  68. lovetox

    is probably minimal to 0

  69. lovetox

    eyeballs for ipv4, and ipv6 was made, because some networks didnt allow for ipv6, and some did, so there was no way to tell at start what will succeed

  70. lovetox

    so they race both

  71. flow

    lovetox, why try the one with the fewest roundstrips first when you could try all concurrently and simple use the one that finishes connecting first?

  72. lovetox

    because its much more work

  73. lovetox

    and almost no benefit

  74. Kev

    It also possibly depends what you mean by 'connecting'.

  75. lovetox

    opening a writeable socket

  76. flow

    lovetox, right, that's why I decided against it (for now)

  77. Kev

    A server operator probably isn't going to thank you for doing 6* as many TLS negotiations as you need, etc.

  78. flow

    Kev, true, but you could just not do TLS and define "connected" as layer 4 connection (e.g. TCP) established

  79. lovetox

    yes only open a socket

  80. lovetox

    also i do not retry with different connection method, if something fails while TLS negotiation or even on xmpp level

  81. lovetox

    then its just failed, im not helping the admin shadowing broken connection points

  82. flow

    well retry a different XMPP transport after a TLS negoation failure appears sensible. After all it could be a misconfigured BOSH endpoint while the other endpoint is correctly configured

  83. lovetox

    yeah exactly, no it does not make sense to me

  84. Kev

    Or not misconfigured, but a local transparent proxy is breaking HTTP.

  85. lovetox

    this way the point will never get fixed

  86. flow

    lovetox, I usually follow that argumentation, but it's the job of a client library to establish a connection whenever possible

  87. flow

    aborting the connection attempt seems even for me a little bit to harsh

  88. lovetox

    i think we have to disagree here

  89. flow

    of course we have

  90. lovetox

    and i think you never implement this right?

  91. flow

    define "this" pls

  92. lovetox

    retry different connection method if tls or xmpplevel fails

  93. flow

    I was explicitly only talking about TLS negotiation

  94. flow

    No, since Smack past and current design does iterate over different transports. It's only the new design that allows for modular transports to be used for the same connection, so I was not able to implement it in the past

  95. lovetox

    yeah retry on error on xmpp level is just wrong for me

  96. lovetox

    and TLS .. maybe

  97. lovetox

    but think its tricky, would have to find out what TLS errors are errors where i want to try different

  98. lovetox

    cert error for example definitly not

  99. flow

    I'd thought especially cert errors

  100. lovetox

    and really do i want to connect desperatly to a server , where the admin didnt set up TLS correctly

  101. lovetox

    i dont know

  102. flow

    *does *not* iterate

  103. lovetox

    yeah i need to implement also POSH

  104. lovetox

    i forgot about that one

  105. leosbrf

    Hello all, I'm trying to implement a "reply to" requirement. I use an ejabberd server. Can anyone point me directions on how I can implement this? I know about Threads (xep-0201), but the problem is that I need to get the parent message from the server and I didn't find a way to query for specific messages (I don't have all the message history, because I'm paging it)

  106. leosbrf

    .

  107. MattJ

    ,

  108. MattJ

    You mean that you have a message, it says it is "in reply to message XYZ" and you need to find message XYZ?

  109. leosbrf

    yes

  110. leosbrf

    I also could make a query starting from 'message XYZ' and returning all other messages after it

  111. leosbrf

    but the xmpp specs only gives me three fields: with, start, end

  112. MattJ

    Yeah, the current version of the XEP doesn't really support this use-case

  113. Zash

    hack: ask for one message and set rsm 'before' to the one you want and 'max=1', then request the message after the one you get.

  114. MattJ

    Ha

  115. MattJ

    But no, that's a terrible solution :)

  116. leosbrf

    Zash , I tried that solution, but I would have to send a start/end filter. But the stanza only gives me an id which I believe is a unix timestamp. Still, I could not convert it to a proper datetime string accepted by the form_type. It gives me a NAN error 🤔

  117. Zash

    You shouldn't assume anything about archive ids, they're opaque strings.

  118. Zash

    As for ejabberd requiring all three MAM form fields, that's just weird.

  119. lovetox

    it does not

  120. Zash

    Looks like it to me

  121. lovetox

    maybe we talk about different things

  122. lovetox

    but its impossible, the prime uscase and example in MAM is querying the archive without any formfield set

  123. lovetox

    and im pretty sure i never did set all 3 formfields ever

  124. Zash

    Every time I try that with an ejabberd, I get an error back.

  125. lovetox

    and MAM works fine

  126. Zash

    MUC-MAM tho

  127. lovetox

    why would that be different

  128. Zash

    Don't ask me

  129. leosbrf

    in ejabberd (my settings) you could pass zero or more of the following fields: <field var="with" type="jid-single" label="User JID" /> <field var="start" type="text-single" label="Search from the date" /> <field var="end" type="text-single" label="Search until the date" /> <field var="withtext" type="text-single" label="Search the text" />

  130. lovetox

    please show the xml of your query

  131. leosbrf

    sure, one sec

  132. Zash

    <iq id='2' type='set' to='kuketzblog@rooms.dismail.de'><query queryid='f850e845-ce9e-4fd1-875d-206c6394ddbe' xmlns='urn:xmpp:mam:2'><x type='submit' xmlns='jabber:x:data'><field type='hidden' var='FORM_TYPE'><value>urn:xmpp:mam:2</value></field><field type='jid-single' var='with'/><field type='text-single' var='start'/><field type='text-single' var='end'/></x><set xmlns='http://jabber.org/protocol/rsm'/></query></iq> <iq type='error' from='kuketzblog@rooms.dismail.de' id='2' xml:lang='sv'><query queryid='f850e845-ce9e-4fd1-875d-206c6394ddbe' xmlns='urn:xmpp:mam:2'><set xmlns='http://jabber.org/protocol/rsm'/><x xmlns='jabber:x:data' type='submit'><field type='hidden' var='FORM_TYPE'><value>urn:xmpp:mam:2</value></field><field type='jid-single' var='with'/><field type='text-single' var='start'/><field type='text-single' var='end'/></x></query><error type='modify' code='400'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>Bad value of field &apos;with&apos; of type &apos;urn:xmpp:mam:1&apos;</text></error></iq>

  133. lovetox

    em, yeah nobody does it like that

  134. Zash

    Oh because the fields are there?

  135. Zash

    Works with Prosody

  136. leosbrf

    <iq id="supported_query_fields" to="some_room@conference.localhost" type="get" xmlns="jabber:client"><query xmlns="urn:xmpp:mam:2"/></iq>

  137. lovetox

    correct

  138. lovetox

    then i would say you dont respect the XEP zash

  139. lovetox

    the xep says server must only use the default if the field is omitted

  140. lovetox

    not if the value is omitted

  141. leosbrf

    and it returns: <iq xmlns="jabber:client" xml:lang="en" to="admin@localhost/106417850532246324662946" from="some_room@conference.localhost" type="result" id="supported_query_fields"> <query xmlns="urn:xmpp:mam:2"> <x xmlns="jabber❌data" type="form"> <field var="FORM_TYPE" type="hidden"> <value>urn:xmpp:mam:2</value> </field> <field var="with" type="jid-single" label="User JID" /> <field var="start" type="text-single" label="Search from the date" /> <field var="end" type="text-single" label="Search until the date" /> <field var="withtext" type="text-single" label="Search the text" /> </x> </query> </iq>

  142. lovetox

    leosbrf, you need to do a "set" query, not a "get"

  143. lovetox

    what you request is the filter options

  144. lovetox

    but you dont need filters

  145. lovetox

    the xep is a bit weird this way, but there are 2 important distinctions

  146. Zash

    No code I have can distinguish between <field> being omitted and <value> being omitted.

  147. lovetox

    filterng and limiting

  148. lovetox

    as you see the filtering options dont help you with your usecase

  149. lovetox

    so just set no filter, which would tirgger the server to give you all messages in the archive

  150. lovetox

    but because you dont want all messages, you limit this result now to one message with a specific id

  151. lovetox

    you can do this with adding a rsm node

  152. leosbrf

    lovetox , how can I limit that? What is the stanza that I need to send to server?

  153. lovetox

    <set xmlns='http://jabber.org/protocol/rsm'> <max>1</max> <after>09af3-cc343-b409f</after> </set>

  154. lovetox

    but as pointed out, you would need the message id, before the one you want

  155. lovetox

    you sadly cant request a specific id, you can only get all message after an id or before an id

  156. lovetox

    https://xmpp.org/extensions/xep-0313.html#query-paging

  157. lovetox

    btw what xep do you want to implement here that needs that?

  158. leosbrf

    I stuck in getting that id. Because when I request the room history, the stanzas returned have this format: <message xmlns="jabber:client" to="admin@localhost/3247206387247491563010" from="some_room@conference.localhost"> <result xmlns="urn:xmpp:mam:2" id="1578509255305907"> <forwarded xmlns="urn:xmpp:forward:0"> <message xmlns="jabber:client" xml:lang="en" from="some_room@conference.localhost/leo1" type="groupchat"> <x xmlns="http://jabber.org/protocol/muc#user"> <item jid="leo1@localhost/107114335247801189862018" /> </x> <archived xmlns="urn:xmpp:mam:tmp" by="some_room@conference.localhost" id="1578509255305907" /> <stanza-id xmlns="urn:xmpp:sid:0" by="some_room@conference.localhost" id="1578509255305907" /> <urls /> <body>someone send a message</body> </message> <delay xmlns="urn:xmpp:delay" from="conference.localhost" stamp="2020-01-08T18:47:35.305907Z" /> </forwarded> </result> </message>

  159. lovetox

    what xep you want to implement?

  160. lovetox

    what is "reply to"

  161. leosbrf

    what is "reply to"? that is a similar functionality that whatsapp provides (you click a message and click reply). The way I implement, I would store the message id in the child message

  162. leosbrf

    lovetox 👆

  163. lovetox

    so not a XEP

  164. lovetox

    you doing your own thing

  165. lovetox

    yeah attaching something to a message is a big discussion right now, and its currently not possible

  166. lovetox

    because MAM is not adapted to that usecase

  167. leosbrf

    hmm, so that is the reason why I spent some hours researching and found none implementation..hehe . But something you said before gave me directions. In this example: <after>09af3-cc343-b409f</after>. Is this code something dynamically generated for the current query request?

  168. leosbrf

    @lovetox , Anyway, thank you for the information provided