XSF Discussion - 2024-08-26


  1. Trung

    sort by time ?

  2. Trung

    clock don't run backward ;p

  3. moparisthebest

    It do in distributed systems πŸ’€

  4. deport

    oh shit

  5. jonas’

    moparisthebest, or, does anyone remember the first AMD dual-core processors where the time counters weren't synced between the cores? caused all kinds of fun bugs

  6. Zash

    > clock don't run backward ;p Someone told that to NTP yet?

  7. edhelas

    Time to write XEP xxxx: NTP over Pubsub

  8. lovetox

    kurisu, you simply store message the way they arrive, if you request only in one direction

  9. lovetox

    if you request in both direction, backwards and forwards, you load message sorted by time, and pray that the server has subsecond timestamps (which basically means no message will ever have the same timestamp)

  10. lovetox

    if the server does not have subsecond timestamps, you can decide to still life with messages loaded in the wrong order which have the same timestamp

  11. lovetox

    or you implement a very complicated logic how you store the order info, which to my knowledge no xmpp client has implemented till now

  12. Trung

    whatif server had a power cut and pushing rubbish ? will Donald Trump save Elon Musk for Harris ?

  13. kurisu

    > kurisu, you simply store message the way they arrive, if you request only in one direction Well, you also have messages that are just sent to you directly, not out of mam. It may so happen that a live message is sent to you before the client gets older ones from mam. Is that handled at all?

  14. Trung

    if the server has mam, i think it's *always* out of mam.

  15. Trung

    s/mam/MAM/

  16. Trung

    g

  17. kurisu

    Uhm?

  18. Menel

    Nah. If the client is connected, it will not query mam generally. Only at the connect

  19. Menel

    A smart client won't use messages until the initial mam load is complete

  20. Menel

    To not mix it up

  21. Menel

    Or sorts and deduplicates by timestamp locally again

  22. lovetox

    kurisu, you dont request message from mam you received live

  23. Trung

    client should sort by time is what am sayin' they get something that are "out of mam" they add to their local log. Should not concern mam at that point if i understand correctly.

  24. lovetox

    a message has a mam-id, even a life message because its stored on the server first

  25. lovetox

    you request messages *after* that mam-id

  26. lovetox

    ok if you sort by timestamp its probably wise to update timestamps of live message with timestamps from the server

  27. lovetox

    yeah tricky ..

  28. lovetox

    generally there is no nice solution

  29. lovetox

    MAM was never really good designed for that, the idea of MAM was that you only request in one direction

  30. lovetox

    so never backwards, some stuff was added later to make backwards easier, but order is then always tricky if you cache locally

  31. lovetox

    thats why Gajim only requests messages in one direction

  32. kurisu

    My goodness

  33. singpolyma

    It really depends on your datastore. Getting it right in a flat file for example, is trivial. In a sql database that has no natural ordering it is trickier to do the synthetic sort ids needed and so timestamp is "close enough" for most people

  34. singpolyma

    I've even seen clients requesting mam based on timestamp instead of based on id, but that's maybe a bridge too far in general

  35. kurisu

    If we're limiting ourselves to one way, it's no harder with sqlite than it is with a flat file, just use the default rowid which autoincrements and thus preserves the order.

  36. kurisu

    But if we're doing both ways... With sqlite one could find the lowest counter field value and decrement that I guess... While with a flat file prepending would mean overwriting the whole thing from what I understand

  37. singpolyma

    prepending is no issue, though yes it may have performance cost. the problem with decrementing is that negative ids may or may not be allowed. and then there's the mess if you allow "holes" which is where it actually gets hard

  38. singpolyma

    if you have only up to A and then you request backwards from Z to D ... you don't yet have B or C but how do you know that? and how do make sure to put them in the right place later?

  39. kurisu

    That's why the server ids should be sortable.

  40. singpolyma

    That would magically solve every version of this problem, yes

  41. moparisthebest

    What's this? We need another id on messages? πŸ˜πŸ’€

  42. kurisu

    the existing mam id could just be made meaningful

  43. Zash

    without a breaking change, creating MAM 2 ?

  44. moparisthebest

    As a client how could you tell, because ^

  45. singpolyma

    it would just need to be a new feature var or something that means "the ids from this mam are ordered"

  46. singpolyma

    for the client to know

  47. singpolyma

    we can make the ordered without the client knowing first, no harm and some benefit, but yes we would need discovery eventually

  48. singpolyma

    Like even without discovery it would make debugging a lot easier for the human who knows

  49. Zash eyes already done UUIDv7 support

  50. moparisthebest

    That seems like it'd be ok, next question is ordered how, easy if you mandate numeric, hard with strings

  51. Zash

    In the dawn of MAM, I argued for leaving IDs as opaque strings so servers could use whatever their databases uses for unique ids.

  52. singpolyma

    moparisthebest: UUIDv7 almost for sure is the right thing to do, but that can be up to the server

  53. moparisthebest

    And the server is expected to have messages sorted by what?

  54. Zash

    I see the archive as a simple FIFO. Messages are added to one end, get removed from the other.

  55. kurisu

    what's the point of uuivds oer just time with milliseconds

  56. kurisu

    what's the point of uuivds oer just unit time with milliseconds

  57. singpolyma

    moparisthebest: the server already has messages sorted

  58. kurisu

    what's the point of uuivds oer just unit time with milliseconds or something like that

  59. kurisu

    what's the point of uuivds oer just unit time with milliseconds or something like that, which you can also sort by like a normal integer...

  60. singpolyma

    kurisu: if you just want time you already have that

  61. singpolyma

    using uuidv7 gives you a stable total ordering even if two arrive the same millisecond

  62. singpolyma

    or using an incrementing integer server side gives you the same

  63. Zash

    or appending into a file!

  64. kurisu

    > I see the archive as a simple FIFO. Messages are added to one end, get removed from the other. that's how the client always ends up getting them unfortunately. IIRC Jami pulls off a whole git-like tree thing to reconcile history, but that's because it's p2p. It should be much easier with centralized storage like jabber, but yet isn't entirely easy without a sortable ids

  65. singpolyma

    Zash: yes, I meant in terms of ids, but yes

  66. Zash

    You can still infer ordering from MAM, you know you get messages in the same order (or reverse if you <flip-page>) and you know that messages from adjacent pages are adjacent to that

  67. Zash

    Tricky to translate into SQL, sure. Easier if you had a linked list I imagine.

  68. singpolyma

    yes, if you just have a linked list it's trivial

  69. lovetox

    its also rather trivial to ad a sortable id for the server to the store and adding a feature to disco inf

  70. lovetox

    its also rather trivial to ad a sortable id for the server to the store and adding a feature to disco info

  71. singpolyma

    What do people think about defining a new XMPP URI querytype for linking to messages? Something like xmpp:someone@example.com?ref;id=blah where id is either the @id or the stanza-id in a MUC case

  72. lovetox

    to use in what situation? because we have replies

  73. SavagePeanut

    links to messages in another room once we have "spaces"

  74. singpolyma

    SavagePeanut: we already have spaces, but I don't think that's relevant here :)

  75. singpolyma

    yes, links to messages in another room is one of the ways. but also even links to previous messages, not as a reply just as a "remember you said LINK" etc

  76. lovetox

    then you can type "Remember" and use a reply

  77. lovetox

    is this purley about using reply without a body?

  78. singpolyma

    It's about linking to a message in a context that is not a reply at all

  79. singpolyma

    sure, if it's in the same conversation one could sort of abuse replies for this

  80. lovetox

    the question is why a uri

  81. lovetox

    a uri makes for me only sense if its used outside of xmpp

  82. lovetox

    you want to click it in a browser

  83. moparisthebest

    Why not both?

  84. singpolyma

    I suppose most of the inside-XMPP use cases I have in mind would be handled fine by message forwarding as well, once I support that

  85. singpolyma

    but yes link from totally outside can be useful

  86. moparisthebest

    But even if you wanted it to only work in XMPP clients, wouldn't it still be a URI ? Otherwise how does gajim and Conversations link to the same post ?

  87. lovetox

    not sure what i should do with a link, it somehow depends on the feature that any user can query any message from any MUC archive?

  88. lovetox

    can i do that without joining?

  89. lovetox

    if not, i dont think i will query that message

  90. moparisthebest

    I suppose you'd join and query mam no ?

  91. lovetox

    ugh 🀒️

  92. SavagePeanut

    I don't think it'd do anything without clicking and joining

  93. lovetox

    why not simply forward the message you want to show someone

  94. lovetox

    its all already there defined, you can simply start implementing it

  95. moparisthebest

    A message alone isn't always helpful

  96. SavagePeanut

    "We discussed this in another room, start reading here:"

  97. lovetox

    yeah? and you can still do this with message forwarding

  98. SavagePeanut

    "We discussed this in another room, start reading here: <uri>"

  99. moparisthebest

    Yes, "this is where it was discussed: link"

  100. lovetox

    a forwarded message, contains the whole message

  101. lovetox

    a link is useless

  102. SavagePeanut

    > a forwarded message, contains the whole message But doesn't have everything after or immediatly before

  103. moparisthebest

    What message would you forward? The entire conversation ?

  104. lovetox

    a link i can not preview, i can show an empty box and say "click here if you want to see what this is"

  105. lovetox

    moparisthebest, the message i want to share?

  106. moparisthebest

    Yes, so how all links work?

  107. lovetox

    ?! did you see the proposed link?

  108. lovetox

    or are you talking about some link you have in mind but didnt tell us

  109. moparisthebest

    lovetox: one message isn't helpful alone, often you need to link an entire conversation with perhaps hundreds of messages

  110. lovetox

    not sure what you are talking about

  111. lovetox

    the proposed link has one ref to one mam id

  112. lovetox

    thats what iam talking about, but maybe tell us the feature you have in mind

  113. moparisthebest

    Which the UI needs to scroll to with all messages before and after filled in

  114. lovetox

    a forwarded message has also the mam id

  115. lovetox

    .....

  116. lovetox

    there is nothing you can put in a link, that you cant put into a forwarded message

  117. moparisthebest

    There are important differences

  118. lovetox

    are you seriously arguing that the uri spec is more versatile than whole xml spec?

  119. lovetox

    the point is, i forward a xml payload (message) that has everything another client needs to display something useful to the user

  120. lovetox

    a link has nothing i can display to the user

  121. lovetox

    except an empty box that reads "hey someone shared something, please click here, and i will join a chat with 1000 people" and download 2 mb of data for you to get one message"

  122. moparisthebest

    1. I can't put a forwarded message on my blog or project readme (biggest problem) 2. Forwarding you the message might violate security if you aren't allowed to see it. Sending a link would result in a nice "sorry you aren't allowed to see this"

  123. SavagePeanut

    2. At that point, copy/pasting it would violate security which is what people would do without forwarding it

  124. moparisthebest

    People can always do that

  125. singpolyma

    lovetox: I think you've convinced me to implement forwarding first before I come back to deciding if I need this URI

  126. moparisthebest

    These are real use cases that other systems have by the way (Sadly) many projects link to chat messages for documentation/downloads etc, slack, discord etc In slack itself if you send a link to a message and the user(s) don't have permission it'll ask if you want to forward instead

  127. moparisthebest

    > (Sadly) many projects link to chat messages for documentation/downloads etc, slack, discord etc How do we do this with XMPP without a URI ?

  128. SavagePeanut

    prompote the use of forums!

  129. singpolyma

    SavagePeanut: did you mis-spell discord?

  130. SavagePeanut

    😭 https://support.discord.com/hc/en-us/articles/6208479917079-Forum-Channels-FAQ

  131. kurisu

    Telegram has message links and those are occasionally used to link some posts from the web or even inside telegram itself. But then telegram also has chat history much more advanced than xmpp, it can do "breaks" in cache that singpolyma mentioned earlier today, so e.g. if you're following a link to a message sent a year ago, it will load only the messages around that message, and will load more as you scroll up or down.

  132. kurisu

    oh and forwarded messages are also links at the same time there

  133. singpolyma

    kurisu: xmpp can do that as well (only load some around the message in question)

  134. singpolyma

    By XMPP can I mean, MAM can

  135. kurisu

    Yeah in theory... But we discussed earlier today how awkward it gets in practice when you lack sortable message IDs

  136. kurisu

    And in practice I don't think any client does that

  137. kurisu

    And in practice I don't think any client does that?

  138. Menel

    But no client does that isn't an argument. If you now implement the telegram thing in xmpp no client will do that too. Seems even trivial https://xmpp.org/extensions/xep-0313.html#filter-time

  139. kurisu

    Isn't an argument for what

  140. Menel

    > And in practice I don't think any client does that?

  141. kurisu

    >seems Yes, *seems* as we discussed above.

  142. Menel

    For needing something else

  143. Menel

    It is one query to receive a specific part of history

  144. Menel

    With mam.

  145. kurisu

    If you're not caching it, that can be simple I guess.

  146. singpolyma

    yeah. the "hard part" is disjointed storage

  147. singpolyma

    downloading and rendering is 'easy'

  148. lissine

    kurisu: the feature you're describing is mostly unneeded because most servers have a short rentention time for history (a few weeks / a couple of months)

  149. lissine

    It would be more valuable to e.g. find a way to sync mam between clients than your feature request

  150. kurisu

    I don't see how that makes it indeed... I think you meant impossible

  151. lissine

    kurisu: unneeded i.e. not needed

  152. kurisu

    I don't see how that makes it unneeded... I think you meant impossible

  153. kurisu

    > It would be more valuable to e.g. find a way to sync mam between clients than your feature request At that point you'd be reinventing whatever jami has been doing I guess

  154. lissine

    > At that point you'd be reinventing whatever jami has been doing I guess It wouldn't be something you'd do everyday. It would be something you'd do when you get a new device and want to transfer your years of history

  155. lissine

    It is already possible to do this between two instances of the same client, but not between two different clients

  156. kurisu

    I think nowadays people expect servers to store that tbh, especially given that years of history are usually a dozen megabytes

  157. kurisu

    Without media

  158. singpolyma

    Yes. I think for community chat stuff that's pretty important these days

  159. moparisthebest

    > kurisu: the feature you're describing is mostly unneeded because most servers have a short rentention time for history (a few weeks / a couple of months) I don't know that this is true, but even if it is, that's just a deployment decision

  160. kurisu

    What I love most about these "decisions" is that you never know

  161. kurisu

    Which basically makes them random from user pov

  162. singpolyma

    Well user hopefully isn't making their stuff in a random server they don't know the policies of πŸ™‚

  163. kurisu

    Nobody reads "policies" of a server especially given that they're well concealed

  164. singpolyma

    If you don't know what a server is or what it can do why would you put your stuff there?

  165. kurisu

    Yeah yeah in the end the users don't care. In the end they end up sticking to things like telegram because they know if you put something there it's there for good and won't randomly get erased whenever the admin saw fit

  166. kurisu

    Whenever the admin saw fit to free the 10mb worth of your year long correspondence