jdev - 2022-09-21


  1. nicoco_

    I think I've managed to forge a correct metadata publish thing, but for some reason xmpp clients don't seem to try and retrieve the actual avatar data. Can someone spot what's wrong in these 3 stanzas from the gajim XML console? Could it be I am missing a disco#feature thing? https://paste.sr.ht/~nicoco/0f9051db51f6c39739eb4f06c74cf3728a79f4dc

  2. lovetox

    Run gajim -v and it will tell you what's wrong

  3. nicoco_

    thx for the idea lovetox: > Disco info malformed: dummy.localhost Caps hashes differ: I+de1e1XDUWqmfsV2dQlfugNNOk= != UYVitpA8UsRh8d2G0/8fsVQ9+Sc= damn these caps/disco/pubsub/pep things are sooooo hard to get right

  4. Link Mauve

    lovetox, in these stanzas, the @to Gajim sends the disco#info to is wrong, right?

  5. Link Mauve

    Why is it asking the domain instead of the account?

  6. Link Mauve

    The second stanza should be to="baba@dummy.localhost" instead of to="dummy.localhost".

  7. nicoco_

    Link Mauve: dummy.localhost also has its own avatar, so I think it's OK that gajim sends this too?

  8. Link Mauve

    Oh right.

  9. Link Mauve

    But then that’s unrelated to baba@dummy.localhost’s avatar.

  10. Link Mauve

    And might be your issue?

  11. nicoco_

    neither dummy.localhost's and baba@dummy.localhost's avatars are requested. maybe the stanzas I posted were not cleverly selected by me, I apologize. it's still not clear to me which entity between the gateway component and "puppet JID" (baba@) needs to advertise which caps/disco. I'm trying to get rid of this caps hash warning for a start, but it feels I'm completely misusing slixmpp for some reason.

  12. nicoco_

    neither dummy.localhost's nor baba@dummy.localhost's avatars are requested. maybe the stanzas I posted were not cleverly selected by me, I apologize. it's still not clear to me which entity between the gateway component and "puppet JID" (baba@) needs to advertise which caps/disco. I'm trying to get rid of this caps hash warning for a start, but it feels I'm completely misusing slixmpp for some reason.

  13. Link Mauve

    nicoco_, I tested it using xmpp-rs’s generate-caps example, it returned ParseError("Required attribute 'type' must not be empty.")

  14. Link Mauve

    See https://xmpp.org/registrar/disco-categories.html#gateway

  15. Link Mauve

    Those are the allowed gateway types, you might want to add some once you support their services.

  16. Link Mauve

    See XEP-0030 section 10.2.1.

  17. nicoco_

    hehe well, gateway types are pretty outdated, let's try and pretend this is AIM then :)

  18. Link Mauve

    nicoco_, that’s why I said you may want to ask the registrar to add the ones you want to support.

  19. nicoco_

    thanks for the suggestion but I am not at ease asking for anything "official" since all these disco/nodes/caps/pubsub/pep concepts are VERY blurry in my mind. up until now I had hacked something with vcard-temp and pushing roster items with their alias for nicknames, but now that I start trying to follow the "modern" XEPs, I'm starting to lose self-confidence. I need to do some reading probably

  20. nicoco_

    thanks for the suggestion but I don't feel comfortable asking for anything "official" since all these disco/nodes/caps/pubsub/pep concepts are VERY blurry in my mind. up until now I had hacked something with vcard-temp and pushing roster items with their alias for nicknames, but now that I start trying to follow the "modern" XEPs, I'm starting to lose self-confidence. I need to do some reading probably

  21. Link Mauve

    Caps aren’t only for PEP, they tell other entities everything you support, so it’s quite important to get it right.

  22. Link Mauve

    Otherwise, other entities won’t be able to tell what you support, and either send you things you don’t understand, or more likely send stuff that adhere to the very baseline of XMPP they think every other entity supports.

  23. Link Mauve

    Basically disabling everything advanced in their UI.

  24. Link Mauve

    nicoco_, with type="aim", xmpp-rs says your caps should be <c xmlns='http://jabber.org/protocol/caps' hash="sha-1" node="http://slixmpp.com/ver/1.8.2" ver="LzPKML/zA6ZRJRXL7xsQA4kemhE="/>.

  25. Link Mauve

    And the intermediate string, after concatenation, is gateway/aim//The great legacy network (slidge)<http://jabber.org/protocol/caps<http://jabber.org/protocol/chatstates<http://jabber.org/protocol/commands<http://jabber.org/protocol/disco#info<http://jabber.org/protocol/nick+notify<http://jabber.org/protocol/nick<http://jabber.org/protocol/shim#SubID<http://jabber.org/protocol/shim<jabber:iq:oob<jabber:iq:register<jabber:iq:search<jabber:x:data<jabber:x:oob<urn:xmpp:avatar:data<urn:xmpp:avatar:metadata+notify<urn:xmpp:avatar:metadata<urn:xmpp:carbons:2<urn:xmpp:chat-markers:0<urn:xmpp:fasten:0<urn:xmpp:forward:0<urn:xmpp:message-correct:0<urn:xmpp:message-retract:0<urn:xmpp:reactions:0<urn:xmpp:receipts<urn:xmpp:reply:0<

  26. nicoco_

    yes, I managed to have caps correct, at least for the puppets, by accident after a lot of trial and error a while ago, and did not want to touch this part of the code anymore since then - clients send chat states, presences, markers, it was all good so it's a perfect time to break it all now =) but adding PEP support forces me to look at this stinky part of the code again, which is probably going to be a good thing in the end, but boy it is painful. it's probably extra confusing for a gateway that does not only have its own JID, but also puppet JIDs, and these puppet JIDs need to have some "puppet resource", then where do the "node" concept fit in this hierarchy is not clear to me, and well, maybe slixmpp's modules were not built with this extra complexity in mind too.

  27. Link Mauve

    I hope that helps you debug your issue, if you don’t know what to do with these don’t hesitate to ask me for a more in-depth explanation!

  28. Link Mauve

    nicoco_, PEP is only on the account, so on your puppets’ bare JID.

  29. Link Mauve

    Their resources don’t appear there.

  30. nicoco_

    thanks for your help! I think I should not bother trying to generate the caps verstring myself, but try and understand how to do it properly with slixmpp's helpers, so maybe I'll shout some questions in slix's muc instead

  31. Link Mauve

    Sure!

  32. nicoco_

    >nicoco_, PEP is only on the account, so on your puppets’ bare JID. hum ok that's interesting, because I remember having to advertise caps *with a resource* for clients to send markers and composing/paused chat states, but this is different for PEP, I did not realize that.

  33. Link Mauve

    I’ve never used slixmpp for component, I usually write its plugins with only clients in mind, but XEP-0030 and 0115 predate my involvement by a lot. ^^

  34. Link Mauve

    nicoco_, conceptually, a resource is a connected client (even if it’s fake in your case), a user can have multiple of those connected at a same time, each with a different featureset, so with different caps.

  35. Link Mauve

    But PEP is entirely handled by the server, with no involvement of connected clients (that way your contacts can see your avatar even when you’re offline, for instance), so it lives on your bare JID.

  36. Link Mauve

    Note also that in the case of avatars, it’s not about your puppets’ caps, but about their contacts’ caps.

  37. Link Mauve

    So actual XMPP users.

  38. Link Mauve

    They are the ones having the +notify.

  39. nicoco_

    slix's xep0030 and xep0115 are pretty hard to understand for my "hobbyist dev" brain. but I think I'll have to dive into them to implement some sort of "disco#items" access control to get things right in a "gateway with multiple users" context. although maybe not with what I understood about PEP yesterday. but maybe. but maybe not. anyway, the fact

  40. nicoco_

    slix's xep0030 and xep0115 are pretty hard to understand for my "hobbyist dev" brain. but I think I'll have to dive into them to implement some sort of "disco#items" access control to get things right in a "gateway with multiple users" context. although maybe not with what I understood about PEP yesterday. but maybe. but maybe not.

  41. pep.

    "that way you contacts can see your avatar even when you're offline" which is funny because the audience of avatars is sometimes used to indicate offline-ness. Or maybe it's only in MUC because there is makes some sense of you don't keep a cache

  42. Link Mauve

    MUC doesn’t really have the concept of offline participants, they are not participants any longer.

  43. Link Mauve

    nicoco_, oh no I was wrong, the actual caps string is: gateway/aim/en/The great legacy network (slidge)<http://jabber.org/protocol/caps<http://jabber.org/protocol/chatstates<http://jabber.org/protocol/commands<http://jabber.org/protocol/disco#info<http://jabber.org/protocol/nick+notify<http://jabber.org/protocol/nick<http://jabber.org/protocol/shim#SubID<http://jabber.org/protocol/shim<jabber:iq:oob<jabber:iq:register<jabber:iq:search<jabber:x:data<jabber:x:oob<urn:xmpp:avatar:data<urn:xmpp:avatar:metadata+notify<urn:xmpp:avatar:metadata<urn:xmpp:carbons:2<urn:xmpp:chat-markers:0<urn:xmpp:fasten:0<urn:xmpp:forward:0<urn:xmpp:message-correct:0<urn:xmpp:message-retract:0<urn:xmpp:reactions:0<urn:xmpp:receipts<urn:xmpp:reply:0<

  44. Link Mauve

    I forgot to copy the xml:lang="en" from the iq.

  45. nicoco_

    Link Mauve, can you confirm that I am getting things right here: - `baba@dummy.localhost/slidge` should have `http://jabber.org/protocol/chatstates`, `urn:xmpp:message-correct:0`, etc. in its `disco#items` for clients to send all the cool modern IM features and not just message bodys. - `baba@dummy.localhost` (bare) should have `urn:xmpp:avatar:metadata`, `urn:xmpp:avatar:data`, `http://jabber.org/protocol/nick` in its disco#items and nothing else (well vcard, user gaming, geoloc at some point, but let's try and get avatars working first) - `baba@dummy.localhost` (bare) will send to `test@localhost` (the actual XMPP user physical person, I heard there are still some left on earth) the `pubsub#event/avatar metadata` thing - hopefully, if everything's done right, movim/gajim/conversations/whatever will retrieve the actual avatar with an iq to `baba@dummy.localhost`, which `dummy.localhost` will receive -- this is where I'm stuck right now, this does not happen, but probably related to the disco/caps thing. - `baba@dummy.localhost` should send the iq reply with the base64 encoded avatar

  46. nicoco_

    about the caps string, I think slixmpp should handle that, and I should not have to generate it myself... but the xep_0030 module works in mysterious ways

  47. Link Mauve

    It’s the xep_0115 module which generates it I think.

  48. nicoco_

    indeed, you're right

  49. nicoco_

    but I hope that if have add all the disco features and call `await xmpp.pluging["xep_0115"].update_caps(jid=contact.jid)`, It'll work 🤞

  50. nicoco_

    but I hope that if add all the disco features and call `await xmpp.pluging["xep_0115"].update_caps(jid=contact.jid)`, It'll work 🤞

  51. nicoco_

    but I hope that if add all the disco ~features~ items and call `await xmpp.pluging["xep_0115"].update_caps(jid=contact.jid)`, It'll work 🤞

  52. Link Mauve

    nicoco_, first - you’re right. Second - no, the account JID should have a pep identity, an account identity, and the relevant PubSub features (those from the http://jabber.org/protocol/pubsub# namespace) but not the avatar and nick stuff.

  53. Link Mauve

    Avatar and nick are for PubSub to expose, not for disco#info.

  54. Link Mauve

    Third, fourth and fifth - are correct.

  55. Link Mauve

    It’s likely that clients won’t talk PubSub to your account JIDs if they don’t advertise they are PubSub services.

  56. nicoco_

    >Avatar and nick are for PubSub to expose, not for disco#info. >clients won’t talk PubSub to your account JIDs if they don’t advertise they are PubSub services. I think this is the part I completely missed in my attempts to get this working so far. sounds like I've got some experiments to run with this in mind now. thanks again

  57. lovetox

    i think you are all confused

  58. lovetox

    if a client requests avatars or nick from pubsub, does not depend on any disco info

  59. Link Mauve

    lovetox, it could check that it’s an actual PubSub service.

  60. lovetox

    what? pubsub events come from the account

  61. lovetox

    if i disco the account, i will not get a pubsub service disco back

  62. Link Mauve

    You will actually get a category pubsub type pep identity, and various pubsub features.

  63. lovetox

    the issue here is, his component sends a pubsub event to gajim, and gajim does not react like he wants

  64. lovetox

    no disco will fix that

  65. lovetox

    Link Mauve, ?! if i disco link@mauve.net i will get back type=pep?!?

  66. Link Mauve

    Yes.

  67. lovetox

    ah damn, we disco the resource, nobody discos the account

  68. lovetox

    ok, yes gajim doesnt do this, i would also dont know why it should

  69. lovetox

    if i get a event, i act on it

  70. lovetox

    either on the other side is a pubsub service or i get an error

  71. Link Mauve

    lovetox, a PubSub service could support the http://jabber.org/protocol/pubsub#presence-subscribe feature but not the http://jabber.org/protocol/pubsub#retrieve-items one.

  72. Link Mauve

    But yes, handling an error is also fine.

  73. nicoco_

    your discussion got me even more confused, but stanzas are better than words aren't they? I fixed the caps verstring nonsense and to try and start simple, I am just trying to get the bridge component to correctly use 0084 for its own avatar (we'll puppet JIDs later) gajim logs show that the pubsub#event seems correctly parsed ("Received avatar metadata: dummy.localhost - ...") but gajim does not try to "retrieve" the actual avatard data movim on the other hand, makes 2 iq gets: urn:xmpp:avatar:data and urn:xmpp:avatar:metadata, but for some reason the :data one is missing the "item id" so I guess there is still something wrong with identity/disco/namespaces or something any idea what's wrong with this? https://paste.sr.ht/~nicoco/f73001f408de0d46f386b6c69ed05f2a893e04c4

  74. nicoco_

    your discussion got me even more confused, but stanzas are better than words aren't they? I fixed the caps verstring nonsense and to try and start simple, I am just trying to get the bridge component to correctly use 0084 for its own avatar (we'll see puppet JIDs later) gajim logs show that the pubsub#event seems correctly parsed ("Received avatar metadata: dummy.localhost - ...") but gajim does not try to "retrieve" the actual avatard data movim on the other hand, makes 2 iq gets: urn:xmpp:avatar:data and urn:xmpp:avatar:metadata, but for some reason the :data one is missing the "item id" so I guess there is still something wrong with identity/disco/namespaces or something any idea what's wrong with this? https://paste.sr.ht/~nicoco/f73001f408de0d46f386b6c69ed05f2a893e04c4

  75. Link Mauve

    nicoco_, does Gajim support gateway avatars?

  76. Link Mauve

    Where does it show it?

  77. nicoco_

    with vcard-temp, definitely!

  78. nicoco_

    https://upload.slidge.im:5281/file_share/Wi5sj8z8RB7J6yTOySVbpPHw/753b8ae3-24b3-4cc3-b12e-05d7ef77be7c.png

  79. Link Mauve

    Ok.

  80. nicoco_

    this is with vcard-temp

  81. Link Mauve

    edhelas, you may want to fix the missing item id in the urn:xmpp:avatar:data query.

  82. nicoco_

    gajim doesn't react at all, but movim seems to attempt to download the thing

  83. Link Mauve

    nicoco_, why does Movim also iq get urn:xmpp:avatar:metadata? Didn’t you just send it an event with it?

  84. nicoco_

    I did, it does not make sense. I wonder if movim behavior is abnormal, or if my abnormal (?) stanzas trigger this abnormal behaviour

  85. nicoco_

    abnormal is the word

  86. Link Mauve

    I’d expect the former, as your stanza from earlier looked correct.

  87. nicoco_

    any way, it's the million dollar question everytime I try to implement something: "is it my component or the clients that are non conform?"

  88. nicoco_

    ok let's try to reply to movim even if the retrieval request is non conform and see if it displays the avatar correctly

  89. Link Mauve

    nicoco_, in the second stanza in your log, Movim actually requests all items on the urn:xmpp:avatar:data, it’s perfectly valid.

  90. Link Mauve

    And you then should reply with all the avatar versions you have, possibly just one.

  91. Link Mauve

    See XEP-0060 section 6.5.2.

  92. nicoco_

    ok let me try to reply correctly to movim then, thanks

  93. edhelas

    https://upload.movim.eu/files/9d94237298995552fa13436420195fbca436dce7/3PAb1PLeyVRb/image.png

  94. nicoco_

    the avatar is updated in the movim ui, yeehaa! not in gajim, though, I am unsure what's missing for gajim to retrieve the avatar. lovetox you're saying the component behavior is non conform and that's why it won't work in gajim?

  95. lovetox

    no i didnt say that

  96. lovetox

    i said you should read the log

  97. lovetox

    but then you posted something about disco, which you found in the log, which was unrelated to the whole issue

  98. nicoco_

    oh ok well this other wild bug of my thing appeared out of the blue ^^

  99. nicoco_

    anything you see in this debug log that would explain why gajim doesn't try to retrieve the avatar? https://paste.sr.ht/~nicoco/4be6088c71a03e7a00f99ca63fa7fa42684511a2

  100. lovetox

    yes it says

  101. lovetox

    Avatar already known: dummy.localhost 238694fd6478dfe0a17297ff5758efb6fa6c47f0

  102. lovetox

    thats why we dont download it, because its not new

  103. lovetox

    why it is not displayed, maybe a caching issue, or you played around too much

  104. lovetox

    try removing ~/.cache/gajim/cache.d

  105. lovetox

    try removing ~/.cache/gajim/cache.db

  106. lovetox

    and restart gajim

  107. lovetox

    is the component added to the roster?

  108. nicoco_

    yes it's in the roster. it's probably the cache thing indeed, since my component responded with incorrect stuff before, it messed things up probably. will try with a clean profile and removing all gajim cache

  109. nicoco_

    and it seems to work. thanks a lot for your help!

  110. lovetox

    i think the idea that you can have alternate formats in your user avatar is rather hard to use

  111. lovetox

    the problem arises, because the id of the node = sha of the image/png content type

  112. lovetox

    so you need to save that to know when the avatar changes

  113. lovetox

    but if you dont use image/png, you download something else

  114. lovetox

    which has a different hash

  115. lovetox

    and then it becomes a problem, of how do i know i downloaded this already?

  116. lovetox

    now you need to save in some db, the node id hash side by side with whatever you downloaded

  117. lovetox

    hash i usually good to check if a file is really that file

  118. lovetox

    but this is broken in this scenario

  119. lovetox

    it becomes a, lookup that hash in some db that maps to the actual hash of some file

  120. lovetox

    adding to that is that people thought the XEP actually want to provide a way to upload different resolutions of the same content-type

  121. lovetox

    but this is not the intention of the XEP, its always about different content-types, not different resolutions of the same

  122. lovetox

    if we look back now, how many clients actually implement pubilshing multiple types, and downloading multiple types?

  123. lovetox

    probably none

  124. lovetox

    and, if i think about, how would you add or update a content-type which is not image/png

  125. lovetox

    you are not allowed to change the node id, because it always is the hash of the image/png type

  126. lovetox

    so you cannot communicate updates

  127. lovetox

    ah no that works, because the hash is inside the info element

  128. lovetox

    so you simply have to ignore the node id

  129. lovetox

    and check all the info items

  130. nicoco_

    FWIW, I've taken the "let's make everything a PNG" road, since I needed the conversion for the hash anyway, I figured let's keep things simple. early optimization blablabla

  131. nicoco_

    FWIW, I've taken the "let's make everything a PNG" road, since I needed the conversion for the hash anyway, I figured let's keep things simple. premature optimization blablabla