-
lovetox
does it make sense to try PLAIN on a host from xmpp-client?
-
lovetox
or does xmpp-client always mean START TLS
-
MattJ
PLAIN? The SASL mechanism?
-
lovetox
no, i mean no TLS
-
MattJ
Or do you mean a totally unencrypted connection?
-
lovetox
unencrypted
-
MattJ
It doesn't make sense to ever try an unencrypted connection
-
Kev
If what SRV resolves to doesn't offer TLS, it's a matter of local policy whether you'll continue without it.
-
lovetox
try is the wrong word
-
lovetox
the user wants to connect PLAIN, do i resolve xmpp-client and try there
-
MattJ
Yes
-
lovetox
or do i just resolve domain
-
lovetox
and use 5222
-
MattJ
You would still obey SRV
-
Kev
You always use SRV unless the user explicitly asks you not to (if you support such a thing).
-
lovetox
i wondered because xmpps-client is explicitly for DIRECT TLS
-
lovetox
so even if the user wants PLAIN, i would never try there
-
lovetox
i wondererd if xmpp-client is explicitly for START TLS
-
Kev
Calling it PLAIN is somewhat misleading. PLAIN is a SASL mechanism.
-
Kev
You mean 'The user asks to never use TLS', I think?
-
flow
lovetox, no, xmpp-client is for the TCP binding of XMPP defined bin RFC6120
-
lovetox
yes, the user asks to connect unencrypted
-
lovetox
ok good, thats what i wanted to know
-
lovetox
so i still have to resolve xmpp-client, before i go the domain:5222 fallback route
-
MattJ
Yes
-
flow
lovetox, that is what is written down in rfc6120 ;)
-
lovetox
i wondered why did we add websocket and bosh into a TXT record
-
lovetox
why not xmpp-client-websocket._tcp ..
-
MattJ
Because they need URLs
-
lovetox
ah its not allwoed
-
lovetox
ok
-
lovetox
its bit weird because it doesnt allow for weight and priority
-
lovetox
but i guess that would be really an edge case to have more than one websocket connection point
-
MattJ
HTTP doesn't
-
lovetox
ah so it always has to be over 80/443
-
MattJ
Yes
-
lovetox
that makes sense then
-
MattJ
We were discussing recently the 20 year-old bug report for Firefox to support SRV for HTTP
-
MattJ
Web folk have no interest in it
-
lovetox
writing since quite a time to move all connection/dns logic from gajim into nbxmpp
-
lovetox
if you want to support, xmpps, xmpp, websocket, unencrypted, proxy for websocket and tcp, setting a custom host (no srv resolution)
-
lovetox
and the lib should handle that all automatically, does get a bit complicated :D
-
MattJ
Indeed
-
MattJ
Someone needs to make a flowchart
-
flow
lovetox, that's exactly what I am also currently dealing with in my not-so-small smack refactor project
-
lovetox
but i have the luck of GLib taking most of the dns resolution away from me
-
lovetox
because if i would have to deal with stuff like happy eyeballs etc
-
lovetox
then i think it gets a bit crazy :)
-
flow
I think you probably want happy eyeballs not only on the DNS level, but also on the connection level
-
lovetox
actually they ever provide methods like connect_to_service() where i just pass "xmpps-client"
-
flow
e.g. initiate TCP connections to the ipv4 and ipv6 endpoints in parallel
-
lovetox
yes flow GLib does that
-
lovetox
i incorrectly said DNS resolution, but GLib also does my connection
-
flow
nice
-
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
-
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 ;)
-
lovetox
hm no because they are not equivalent
-
flow
(I actually thought about doing that in Smack but decided against it for the moment, only the endpoint discovery runs concurrently)
-
flow
lovetox, I'd argue they are equivalent
-
lovetox
not direct tls has fewer roundtrips
-
lovetox
websocket is not as efficient as tcp
-
flow
sure, but why does it matter
-
lovetox
why does efficiency matter?
-
flow
that's not what I said
-
lovetox
of course i will try the way with fewest roundtrips first
-
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?
-
lovetox
also the chance that xmpps connect is failing although the server admin specified a srv record for it
-
lovetox
is probably minimal to 0
-
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
-
lovetox
so they race both
-
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?
-
lovetox
because its much more work
-
lovetox
and almost no benefit
-
Kev
It also possibly depends what you mean by 'connecting'.
-
lovetox
opening a writeable socket
-
flow
lovetox, right, that's why I decided against it (for now)
-
Kev
A server operator probably isn't going to thank you for doing 6* as many TLS negotiations as you need, etc.
-
flow
Kev, true, but you could just not do TLS and define "connected" as layer 4 connection (e.g. TCP) established
-
lovetox
yes only open a socket
-
lovetox
also i do not retry with different connection method, if something fails while TLS negotiation or even on xmpp level
-
lovetox
then its just failed, im not helping the admin shadowing broken connection points
-
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
-
lovetox
yeah exactly, no it does not make sense to me
-
Kev
Or not misconfigured, but a local transparent proxy is breaking HTTP.
-
lovetox
this way the point will never get fixed
-
flow
lovetox, I usually follow that argumentation, but it's the job of a client library to establish a connection whenever possible
-
flow
aborting the connection attempt seems even for me a little bit to harsh
-
lovetox
i think we have to disagree here
-
flow
of course we have
-
lovetox
and i think you never implement this right?
-
flow
define "this" pls
-
lovetox
retry different connection method if tls or xmpplevel fails
-
flow
I was explicitly only talking about TLS negotiation
-
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
-
lovetox
yeah retry on error on xmpp level is just wrong for me
-
lovetox
and TLS .. maybe
-
lovetox
but think its tricky, would have to find out what TLS errors are errors where i want to try different
-
lovetox
cert error for example definitly not
-
flow
I'd thought especially cert errors
-
lovetox
and really do i want to connect desperatly to a server , where the admin didnt set up TLS correctly
-
lovetox
i dont know
-
flow
*does *not* iterate
-
lovetox
yeah i need to implement also POSH
-
lovetox
i forgot about that one
-
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)
-
leosbrf
.
-
MattJ
,
-
MattJ
You mean that you have a message, it says it is "in reply to message XYZ" and you need to find message XYZ?
-
leosbrf
yes
-
leosbrf
I also could make a query starting from 'message XYZ' and returning all other messages after it
-
leosbrf
but the xmpp specs only gives me three fields: with, start, end
-
MattJ
Yeah, the current version of the XEP doesn't really support this use-case
-
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.
-
MattJ
Ha
-
MattJ
But no, that's a terrible solution :)
-
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 🤔
-
Zash
You shouldn't assume anything about archive ids, they're opaque strings.
-
Zash
As for ejabberd requiring all three MAM form fields, that's just weird.
-
lovetox
it does not
-
Zash
Looks like it to me
-
lovetox
maybe we talk about different things
-
lovetox
but its impossible, the prime uscase and example in MAM is querying the archive without any formfield set
-
lovetox
and im pretty sure i never did set all 3 formfields ever
-
Zash
Every time I try that with an ejabberd, I get an error back.
-
lovetox
and MAM works fine
-
Zash
MUC-MAM tho
-
lovetox
why would that be different
-
Zash
Don't ask me
-
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" />
-
lovetox
please show the xml of your query
-
leosbrf
sure, one sec
-
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 'with' of type 'urn:xmpp:mam:1'</text></error></iq>
-
lovetox
em, yeah nobody does it like that
-
Zash
Oh because the fields are there?
-
Zash
Works with Prosody
-
leosbrf
<iq id="supported_query_fields" to="some_room@conference.localhost" type="get" xmlns="jabber:client"><query xmlns="urn:xmpp:mam:2"/></iq>
-
lovetox
correct
-
lovetox
then i would say you dont respect the XEP zash
-
lovetox
the xep says server must only use the default if the field is omitted
-
lovetox
not if the value is omitted
-
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>
-
lovetox
leosbrf, you need to do a "set" query, not a "get"
-
lovetox
what you request is the filter options
-
lovetox
but you dont need filters
-
lovetox
the xep is a bit weird this way, but there are 2 important distinctions
-
Zash
No code I have can distinguish between <field> being omitted and <value> being omitted.
-
lovetox
filterng and limiting
-
lovetox
as you see the filtering options dont help you with your usecase
-
lovetox
so just set no filter, which would tirgger the server to give you all messages in the archive
-
lovetox
but because you dont want all messages, you limit this result now to one message with a specific id
-
lovetox
you can do this with adding a rsm node
-
leosbrf
lovetox , how can I limit that? What is the stanza that I need to send to server?
-
lovetox
<set xmlns='http://jabber.org/protocol/rsm'> <max>1</max> <after>09af3-cc343-b409f</after> </set>
-
lovetox
but as pointed out, you would need the message id, before the one you want
-
lovetox
you sadly cant request a specific id, you can only get all message after an id or before an id
-
lovetox
https://xmpp.org/extensions/xep-0313.html#query-paging
-
lovetox
btw what xep do you want to implement here that needs that?
-
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>
-
lovetox
what xep you want to implement?
-
lovetox
what is "reply to"
-
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
-
leosbrf
lovetox 👆
-
lovetox
so not a XEP
-
lovetox
you doing your own thing
-
lovetox
yeah attaching something to a message is a big discussion right now, and its currently not possible
-
lovetox
because MAM is not adapted to that usecase
-
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?
-
leosbrf
@lovetox , Anyway, thank you for the information provided