jdev - 2022-02-13


  1. pulkomandy

    Hello, I'm trying to implement some xhtml-im in Renga so I can get irc colors and styling from Biboumi. But I don't see the xhtml in the messages I receive. I am testing with messages stored in the backlog of a muc (no mam implementation yet in renga), could that be a problem? What else should I check?

  2. pulkomandy

    I have added the namespace to my disco info (I think), and it doesn't seem to help

  3. moparisthebest

    I didn't know biboumi did xhtml-im

  4. pulkomandy

    https://github.com/louiz/biboumi/blob/master/src/bridge/colors.cpp A very small subset of it, to render some of IRC formatting (foreground and colors, bold, italics, underline)

  5. Maranda

    pulkomandy: last I checked biboumi did appear to strip all XHTML-IM from reflected messages

  6. Link Mauve

    Maranda, it doesn’t parse XHTML-IM from XMPP clients, but it does convert IRC formatting to XHTML-IM.

  7. Link Mauve

    pulkomandy, I have never tested it from the MAM history, but looking at the sqlite schema it doesn’t seem to store it.

  8. Maranda

    Link Mauve: well but if a xmpp client sends a message containing XHTML-IM is it supposed to reflect it back mangling the stanza and stripping the XHTML-IM content?

  9. Link Mauve

    Maranda, yes, since it couldn’t parse the XHTML-IM it just reflects the body.

  10. Link Mauve

    So that you don’t think it worked and have the same view as other IRC users.

  11. Maranda

    Does it preserve the id at least?

  12. Link Mauve

    Not sure.

  13. Link Mauve

    IRC also doesn’t have this concept.

  14. Maranda is trying to figure a bug with bifrost

  15. Maranda

    Which is not exactly a bug... But biboumi not preserving id on reflection and mangling the stanza completely confused deduplication indeedly

  16. Maranda

    Which is not exactly a bug... But biboumi not preserving id on reflection and mangling the stanza completely confuses deduplication indeedly

  17. Maranda probably should also keep a hash of the message body

  18. Link Mauve

    Maranda, an issue with that is how to handle split messages?

  19. Link Mauve

    Say you sent a message over two lines, and got a reflection of the first line in one message, and the second line in another message.

  20. Link Mauve

    What should you do? What should biboumi do?

  21. Maranda

    Huhu but is there actually a need to split out reflected messages on the XMPP Horizon...?

  22. Maranda thinks not.

  23. Link Mauve

    Well, this is about IRC, not XMPP.

  24. Link Mauve

    IRC doesn’t support messages longer than 512 bytes (including your recipient name, some command, and the phase of the moon).

  25. pulkomandy

    > pulkomandy, I have never tested it from the MAM history, but looking at the sqlite schema it doesn’t seem to store it. That's a bit unexpected, so MAM loses all formatting and possibly anything in a message that it doesn't support? Not really what I expect from an archive?

  26. Link Mauve

    Actually if the IRC colors are stored in the body in the table it might, but I have no easy way to test MAM here, especially not with formatting, since I have no other IRC client than biboumi.

  27. Maranda

    Link Mauve: well if I send a message longer than 512 bytes it's fine if it gets split on IRC, less so if the reflected message by biboumi MUC interface gives me back 2 messages instead of one, not that it's forbidden or anything by the spec that I can recall.. but for sure that may confuse some clients.

  28. Link Mauve

    Maranda, you’d be confused as well if you got kicked for having flooded a room, and not understand why because to you it was a single message.

  29. Maranda

    Well if biboumi does mangle the stanza, doesn't preserve the id, may not preserve the message body contents and even split out reflections, I got nothing to match on 😆

  30. Maranda

    Oookay

  31. nephele

    ircv3 has message ids link mauve

  32. Link Mauve

    Might be useful, could you mention that on the biboumi bug tracker?

  33. Link Mauve

    Do IRC servers use this extension?

  34. nephele

    I don't know, i have not investigated it much

  35. nephele

    https://ircv3.net/specs/extensions/message-ids

  36. nephele

    Where is the bugtracker?

  37. Link Mauve

    At https://lab.louiz.org/louiz/biboumi/-/issues

  38. nephele

    You need message tags enabled to use that spec anyhow, you could also use message tags to store xmpp specific data potentially

  39. Link Mauve

    How does that work?

  40. Link Mauve

    Is it a container for arbitrary payloads?

  41. nephele

    kinda, yeah

  42. nephele

    "Message tags are a mechanism for adding additional metadata on a per-message basis. This is achieved via an extension to the protocol message format, enabled via capability negotiation."

  43. nephele

    spec: https://ircv3.net/specs/extensions/message-tags

  44. nephele

    link mauve: any specific ticket? or just put the link somewhere?

  45. Link Mauve

    I’m not sure, and I’m going to take a nap, yesterday has been tiring.

  46. Link Mauve

    Sorry, if you haven’t found anything I’ll look for one in about one hour or so.

  47. nephele

    okay, I didn't know where you wanted that info, I'd have to dig out my gitlan credentials... so if you want to add it that is cool too :)

  48. pulkomandy

    I confirm that I get xhtml-im for new irc messages but not from muc backlog. That makes my testing a bit more difficult, being able to re-check the same message would be nice

  49. pulkomandy

    Now let's write a css parser…

  50. Zash wishes for the SVG approach to styles

  51. Zash

    I.e. attributes like `color="blue"` instead of `style="color:blue"`

  52. nephele

    I should learn how xml works, and see if i can make my formatted messages work with xml instead of json

  53. pulkomandy

    so... the xhtml-im content is <html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>[<span style='color:blue;'>HaikuArchives/Renga</span>] <span style='color:brown;'>pulkomandy</span> pushed <span style='color:green;'>1</span> commit to <span style='color:green;'>master</span> [+0/-0/±1] <span style='color:lightmagenta;'>https://github.com/HaikuArchives/Renga/compare/8d709ab45869...98879d2afdec</span></body></html>

  54. pulkomandy

    trying to iterate over this with gloox I get one cdata string "[] pushed commit to [+0/-0/±1]" and 5 spans

  55. pulkomandy

    not sure I can reconstruct the correct message from that :/

  56. pulkomandy

    (that's one single cdata lumping together whatever is outside the spans)

  57. Maranda

    Gloox 😰

  58. pulkomandy

    it was working reasonably well until now

  59. pulkomandy

    do I have to rewrite my whole client yet again using something else?

  60. Maranda

    No, but I think just the mention spawns at least some decade old painful memories 😅

  61. pulkomandy

    well I opened a bug on gloox bugtracker about it as I don't see a way I can reconstruct the message correctly from their API. And I'd rather not add another XML parser to my client (getting one to work right is enough of a problem, I think?)

  62. Link Mauve

    In poezio, I chose to serialise the XHTML-IM body to string, and re-parse it with a SAX parser, which gives events in-order based on the position in the stream.

  63. Link Mauve

    Very convenient for appending characters to a buffer as we go.

  64. pulkomandy

    yes, I can do that, I guess. So are there any recommendations for an XML parser easy to use from C++ for this?

  65. Link Mauve

    Most likely gloox already uses one, so you may want to reuse the same.

  66. pulkomandy

    I think gloox does its own parsing, see Tag::parse in https://camaya.net/api/gloox-trunk/tag_8cpp_source.html

  67. pulkomandy

    or is that parsing xpath quesries?

  68. Link Mauve

    Looks like XPath indeed.

  69. Link Mauve

    ldd doesn’t list any known SAX library though.

  70. pulkomandy

    yes, xml parser is here: https://camaya.net/api/gloox-trunk/parser_8cpp_source.html

  71. Link Mauve

    So maybe it does do its own thing.

  72. Link Mauve

    Riht.

  73. Link Mauve

    Right.

  74. pulkomandy

    so I don't get anything lower level than the Tag class from that

  75. Link Mauve

    Wut, why does gloox handle XML comments?

  76. Link Mauve

    Lines 308-322.

  77. Link Mauve

    pulkomandy, Tag::addCData seems to add it to both the m_cdata and the m_nodes members, you want to iterate on the latter.

  78. Link Mauve

    Nodes in XML are either element nodes or text nodes.

  79. pulkomandy

    but m_nodes is private and has no getter or iterator in Tag

  80. Link Mauve

    Seems to be the issue you want to fix then.

  81. pulkomandy

    yes, seems reasonable to add a way to access this if it's already there

  82. pulkomandy

    ok, that worked :). Now let's add the css parser

  83. moparisthebest

    Sam, re: host-meta tests, minimal nginx.conf's required: https://github.com/moparisthebest/xmpp-proxy/blob/master/integration/23-s2s-websocket-host-meta/nginx1.conf & https://github.com/moparisthebest/xmpp-proxy/blob/master/integration/24-s2s-websocket-host-meta-json/nginx1.conf pretty simple I think