jdev - 2023-07-20


  1. nicoco

    Not that I don't trust edhelas, but better safe than sorry, so… Right now "bridged contacts" have this identity (for some, "pc" is replaced by "phone"): ```xml <identity category="client" type="pc" /> ``` Is it still correct and am I going to break other clients than movim if I add another identity of category="gateway" to them, eg: ``` <identity category="client" type="phone" name="Slidge (Telegram)" /> <identity category="gateway" type="telegram" name="Slidge (Telegram)" /> ```

  2. nicoco

    Not that I don't trust edhelas, but better safe than sorry, so… Right now "bridged contacts" have this identity (for some, "pc" is replaced by "phone"): ```xml <identity category="client" type="pc" /> ``` Is it still correct and am I going to break other clients than movim if I add another identity of category="gateway" to them, eg: ```xml <identity category="client" type="phone" name="Slidge (Telegram)" /> <identity category="gateway" type="telegram" name="Slidge (Telegram)" /> ```

  3. edhelas

    You don't trust me :'(

  4. lovetox

    but its not a gateway ..

  5. lovetox

    gateway should be on the component that *is* the gateway

  6. edhelas

    Ah !

  7. lovetox

    just my opinion, but i see what you want to do

  8. lovetox

    you want to discover that a contact is connected via a gateway

  9. edhelas

    But as a client I'd like to know if the presence of the contact is actually from a gateway then 🤔

  10. edhelas

    Then i can display a nice icon or something in the UI

  11. lovetox

    yeah i guess as long as both identitys are there its good

  12. lovetox

    just make sure that the actual gateway is discoverable *as* gateway

  13. lovetox

    and not is the same as a contact

  14. lovetox

    i also dont see any other category that could be used

  15. lovetox

    When multiple identity elements are provided, the name attributes for each identity element SHOULD have the same value.

  16. lovetox

    > When multiple identity elements are provided, the name attributes for each identity element SHOULD have the same value.

  17. lovetox

    seems important to note from the standard

  18. lovetox

    not sure why though

  19. nicoco

    oh, good catch, I was wondering about the name, but I happily respect this SHOULD

  20. nicoco

    the component has gateway+account+pubsub+conference identity

  21. nicoco

    thanks

  22. larma

    is this for disco to full jid or bare jid of users?

  23. nicoco

    full jid

  24. lovetox

    i would assume both, why would there be a difference?

  25. MattJ

    A big difference

  26. nicoco

    not sure what I return on contact bare JID

  27. nicoco

    let me check

  28. larma

    because type=client is full jid, bare jid should be type=account typically

  29. lovetox

    ah, ok yeah clients never deal with querys to bare i guess

  30. lovetox

    so this would be needed to be answered by the gateway or server

  31. nicoco

    well I reply the same on the bare JID too, so I need to fix this I guess

  32. nicoco

    just identity type=account and no features is what it should reply?

  33. nicoco

    because features are per-client, right?

  34. larma

    except you have features on the account, like pubsub

  35. larma

    (what we typically call PEP)

  36. lovetox

    does anyone know why the name attribute must be the same?

  37. Zash

    redundant duplicated redundancy everywhere?

  38. lovetox

    probably because there should only be one name

  39. larma

    also I would assume an additional category=gateway to be fine on the bare jid?

  40. Zash

    I wonder why you have to include the `jid` attribute on pubsub node listings, where *everything* has the same jid anyway

  41. Zash

    I also wonder why this doesn't apply to the `node` attribute

  42. Zash

    XEP-0030 🤷️

  43. Zash

    Just XEP-0030 things 🤷️

  44. nicoco

    interestingly https://xmpp.org/extensions/xep-0163.html#example-5 has "client" on the bare JID (examples not normative, got it)

  45. larma

    that's a full jid (from=romeo@montague.lit/orchard)

  46. nicoco

    oh yeah, confused from and to, sry

  47. lovetox

    larma, there is not type=account, you meant category=account=?

  48. larma

    yes, category=account and category=client was what I meant in that message

  49. larma

    why did every anybody think that using category+type was better than type+subtype or category+subcategory? 😀

  50. larma

    why did anybody ever think that using category+type was better than type+subtype or category+subcategory? 😀

  51. lovetox

    larma, does dino allow backwards mam querys in MUCs? like on scrolling upwards?

  52. nicoco

    so for bare JIDs (of *contacts*), does this sound reasonable? I implement a minimal subset of PEP so that the contacts can have nicknames, avatars and vcards ```xml <identity category="account" type="registered" /> <identity category="pubsub" type="pep" /> <feature var="http://jabber.org/protocol/pubsub" /> <feature var="http://jabber.org/protocol/pubsub#retrieve-items" /> <feature var="http://jabber.org/protocol/pubsub#subscribe" /> ```

  53. nicoco

    oh, and the same gateway/telegram identity too

  54. nicoco

    > larma, does dino allow backwards mam querys in MUCs? like on scrolling upwards? I'm not larma but I don't think so, from my tests on muc join dino just requests 20 messages and that's it? I implement the <flip/> thing but I don't think I've found a client to do "real life tests" against

  55. lovetox

    nicoco, the flip page thing is quite important, when i implement backwards queries in gajim, i will only do it for services that offer that feature

  56. nicoco

    cool, hopefully I'll discover that automated testing covered it successfully. and if not, I'll fix it :)

  57. larma

    lovetox, why is flipping important for backwards sync?

  58. lovetox

    it makes the implementation much easier, because you can request history without dealing with holes

  59. lovetox

    apart from that its more efficient

  60. larma

    I don't see how it makes a huge difference. You request a page of say 10 messages. With flip-page, those messages on the page come in a different order, but beside that, nothing changes. Reordering the messages on the client shouldn't be too hard either (just wait for all messages of the page to arrive, flip it, continue processing as if you got the page flipped initially)

  61. lovetox

    yeah thats, it you had to implement a whole mechanism where your request multiple stanzas, wait for completion, reinstert them into your pipeline so they act like "just received" messages

  62. lovetox

    but yeah if you did all that, and dealt with all issues of that design, i guess it does not make much difference anymore, apart from beeing simply slower to display messages

  63. larma

    I mean, I understand it's useful, but I wonder why it makes more of a difference for MAM upwards scrolling than for syncing history with the user's own MAM server

  64. larma

    And if you already have the code and logic to handle servers that don't do #extended, it's really the same code and logic for MUC MAM servers as it is for the user's own server

  65. lovetox

    i would never implement that for the users account server

  66. lovetox

    downloading tousands of messages from your homeserver takes seconds, instead of having that complexity i simply ask the user if he wants to have a full sync with his home server

  67. lovetox

    apart from it beeing useless as everyone using omemo anyway

  68. larma

    But I mean, you had to write that code for handling holes in your local database anyway for syncing with your home server, no?

  69. larma

    So why not use the same code when fetching from MUC MAM servers

  70. lovetox

    what holes?

  71. lovetox

    you request messages from your server from the last known stanza-id

  72. lovetox

    how can there ever be a "hole"

  73. larma

    uhm, ok, I mean you *can* do that

  74. lovetox

    uhm, you must do that, otherwise how do you tell the user he received a message :D

  75. larma

    but that means you'll have to wait several minutes if there is a lot of history since you logged in last time just to get the latest messages, which are probably the ones that matter to the user *now*

  76. lovetox

    several minutes? to download a few MB, did you test this on a 2000 modem connection?

  77. lovetox

    several minutes? to download a few MB, did you test this on a year 2000 modem connection?

  78. larma

    We changed our code for that because it *was* to slow

  79. larma

    because what matters is not how many MB it is, but the latency of the server responding to your requests

  80. lovetox

    yes sync needs longer on a slow connection, as does browsing the web, i think users understand that

  81. larma

    because each page needs at least one full roundtrip

  82. lovetox

    luckily we can choose the page size

  83. larma

    not arbitrarily

  84. Kev

    You can choose the page size you request, not necessarily what you'll be given.

  85. lovetox

    i wonder larma, did you feel it was slow, or did users complain?

  86. larma

    both

  87. lovetox

    and now you fetch an arbitrary amount first from the server, and later load more?

  88. lovetox

    that was my question yesterday, how do you keep the messages in order in the local db?

  89. lovetox

    you insert later messages first into your db

  90. lovetox

    and afterwards earlier

  91. lovetox

    on what exactly do you sort before you display the messages to the user?

  92. larma

    your MAM server puts a timestamp with the time it received the message. If you sort by that it's the same ordering as if you ordered by arrival time

  93. larma

    your MAM server puts a timestamp with the time it received the message. If you sort by that it's the same ordering as if you ordered by arrival time (ignoring server time not being synced properly)

  94. lovetox

    and you did test this, when multiple messages have the same timestamp?

  95. lovetox

    because i found no solution for that problem, with mam backfills, messages with the same timestamp will be in the wrong order

  96. lovetox

    it works fine for a forward query, because you can sort on insertion order IF timestamps are the same

  97. lovetox

    but with a backfill, you would need it the other way around

  98. larma

    but even with backfill, the messages are in order and the pages are in order, so you do still have the same strict ordering on the messages

  99. lovetox

    yes if you receive them they are ordered, but the question is how can you preserve the order when writing into the db

  100. lovetox

    if you do backfill query where the first message has timestamp = 10, and you insert it into your db, and afterwards make a backfill query where the last timestamp = 10, and insert that again

  101. lovetox

    you will have it in the wrong order inside the db

  102. lovetox

    or do you do backfill queries with timestamps?

  103. lovetox

    and ensure so that if you receive something you receive all messages from a particular timestamp

  104. singpolyma

    nicoco: I would have to test, but I bet adding identity of gateway on something that is not a gateway will confuse the heck out of my app

  105. singpolyma

    It will probably list all your contacts as gateways then in the "add new contact" dialog

  106. singpolyma

    We already have client/sms so if you need this info at that level without doing disco on the domain could register client/telegram etc why not?

  107. nicoco

    singpolyma: Huh! This is the sort of thing that I feared. edhelas, thoughts?

  108. lovetox

    the question is not if it breaks *some* client

  109. lovetox

    the question is, can a gateway identity be attached to a client or account

  110. Zash

    is it technically legal? if so, better to find and fix the clients that break, or do nothing and let them continue to be broken?

  111. lovetox

    i would say if we say, no, this would limit us to express what that client is, and would lead to worse UX

  112. singpolyma

    I think the registry is pretty clear

  113. lovetox

    so i tend to want to say yes

  114. singpolyma

    Gateway means it is a gateway

  115. singpolyma

    And as I say we have evidence of this with client/sms already existing in registry

  116. lovetox

    singpolyma, that would be wrong

  117. lovetox

    or lets say we would lose other information

  118. lovetox

    for example the nice information that a client is a phone

  119. singpolyma

    What would be wrong?

  120. singpolyma

    You can have client/phone and hypothetical client/telegram both if you know the client is a phone

  121. lovetox

    you mean attaching multiple times the same category?

  122. singpolyma

    Yes

  123. lovetox

    i dont think this is intended

  124. lovetox

    all types are either/or stuff

  125. singpolyma

    Except when they're not, as here

  126. nicoco

    FWIW I'm OK with whatever the tribe decides. I agree that the proper question is whether this is legal/correct or not.

  127. singpolyma

    nicoco: it's legal, just doesn't mean what you want it to mean imo

  128. lovetox

    I'm not sold on adding all gateways into the client category

  129. lovetox

    One could argue that we don't need it at all and clients should simply disco also the domain to find out if it's a gateway

  130. lovetox

    This should be easy and need to be done only once

  131. singpolyma

    Certainly that would be my default opinion as well

  132. singpolyma

    I only mentioned that client/sms exists as prior art indicating the registry may lean the other way. But disco on domain is a very sensible option

  133. singpolyma

    Usually with a gateway the domain will be in roster anyway, in which case you can even use caps

  134. nicoco

    I don't have a strong opinion about what the correct behaviour is. Also, I don't develop any client so I'm inclined to listen to what client developers prefer. FWIW, before edhelas asked this, I had understood the same way as singpolyma, ie, identity=gateway means "I'm a gateway service" and not "I'm a _puppet_ (=bridged contact)".

  135. lovetox

    singpolyma, i thought about what we talked about with the negative incrementing field, when backfilling, i think this works good for the MUC case, where you want to get something before your first join

  136. lovetox

    but with MUC, we have the situation, that a user might not join a very long time, and when we join we dont want to get all history, maybe stretching months

  137. lovetox

    so naturally a hole is created

  138. lovetox

    to backfill a hole you cannot use the negative incremented field ..

  139. Kev

    u64, anyone?

  140. singpolyma

    lovetox: a hole might need a tuple, yeah

  141. Kev

    I think you want to record 'holes' outside of the storage of messages. Personally, I'd do it by the IDs of the surrounding messages.

  142. Kev

    And for sorting of the message list, I'd do something like a u64 based on the time of the last message in a page in the high bits, and doing up/down from there in the low bits, or similar.

  143. Kev

    (Which allows sensible fiddling then, if the time sequence breaks down)

  144. lovetox

    Kev: what's a u64 can you point me to something, my Google foo is not good enough

  145. lovetox

    singpolyma: a tuple of what

  146. singpolyma

    lovetox: well, the problem is you have messages in local archive let's say you've given sequence number 100. Now you get new messages but you want to page backwards and maybe not get them all because the hole is so big so you don't know how much "bigger" than 100 to be. So you assign 101,0 then 101,-1 then 101,-2 all the way back when paging backwards these always sort greater than 100 due to 101 but are internally ordered by the second number. Forward paging from these resumes at 102 etc

  147. singpolyma

    (100 in this system is implicitly 100,0)

  148. Kev

    > : what's a u64 can you point me to something, my Google foo is not good enough 64bit unsigned int.

  149. singpolyma

    Kev: right. You're suggesting bit-packing the tuple, effectively

  150. Kev

    I don't think I am. I think I'm suggesting that the holes be recorded in a different table (assuming SQL) from the messages themselves.

  151. Kev

    The tuples can simply be hole=(last id before hole, first id after hole).

  152. singpolyma

    It's not about recording the holes, it's about how to make the ordering work out without renumbering

  153. Kev

    The u64 thing was just a way of ensuring that when you fill holes you still have room in your sorting sequence for the messages to be in the 'right place'.

  154. singpolyma

    Right

  155. lovetox

    Ok thanks for the input, will try to work with this

  156. Hello

    Hello how are you doing everyone