StanzaJS Discussion - 2020-07-23


  1. Kberry I haven't expected that I'll find people who are online here :) Glad to see you all
  2. Flavius Andrei hey, guys
  3. Flavius Andrei any idea if it's possible to get a jid's nodes using stanzajs?
  4. Flavius Andrei welcome, Kberry :)
  5. Lance unless you're looking for nodes related to a specific XEP, getDiscoItems is your best bet
  6. Flavius Andrei i've created a simple node on my account and now i want to list all the nodes i've created when viewing my profile…
  7. Lance are you talking about pubsub?
  8. Flavius Andrei yes
  9. Flavius Andrei xmpp.client.createNode
  10. Lance gotcha. client.getDiscoItems('') should return everything you have
  11. Flavius Andrei or… is there another way of creating nodes and then be able to retrieve all the nodes by creator's jid?
  12. Lance that's querying your bare JID
  13. Flavius Andrei yeah, this should be accesible to OTHER jids, not my own
  14. Lance same applies. query their bare JID
  15. Flavius Andrei so other jids should do getNodes for lance@stanza.org
  16. Flavius Andrei when calling discoItems i only get urn:xmpp:avatar:data and urn:xmpp:avatar:metadata
  17. Lance you called createNode to create a pep node, or a node on a different pubsub service?
  18. Flavius Andrei yeap, no matter i send plain xml to ejabberd or i use stanza for client.getDiscoItems, i only get the avatar nodes…
  19. Flavius Andrei this.client.createNode( 'pubsub.domain.tld', listTitle.replace(/\s+/g, '-').toLowerCase(), { title: listTitle, type: 'submit', fields: [ { type: 'text-single', name: 'pubsub#title', value: listTitle }, { type: 'text-single', name: 'pubsub#access_model', value: accessModel } ] } ) .then((node: PubsubCreate) => console.log('list created', node)) .catch((error) => console.log('failed to create the list', error));
  20. Flavius Andrei on pubsub subdomain...
  21. Lance ok, so this is not a pep node
  22. Lance so querying bare JID isn't going to work, since the node doesn't live on your bare JID
  23. Lance you'd need to get disco items for `pubsub.domain.tld`
  24. Lance but there's not a way to limit by creator iirc
  25. Flavius Andrei i am, but then i'd need to filter through all the results and only pick the jid i'm interested in
  26. Flavius Andrei which is pretty expensive resource wise
  27. Lance looking
  28. Lance i think theres a request to get affiliations that should give what you need
  29. Flavius Andrei regarding pep, i assume my entire roster would be automatically subscribed to it and other jids won't be able to subscribe to it
  30. Flavius Andrei regarding the affiliations, only the owner can retrieve those…
  31. Lance client.getAffiliations('pubsub.domain.tld') should do what you need, if the server supports them
  32. Lance ah, but that only returns all of _your_ affiliations, not someone elses
  33. Flavius Andrei client.getAffiliations(jid) also works but only returns the avatar nodes…
  34. Flavius Andrei calling it as you suggested returns the same, avatar nodes :)
  35. Flavius Andrei this doesn't really work
  36. Flavius Andrei this.client.getNodeAffiliations(this.client.config.jid, 'web-development').then((nodes: PubsubAffiliations) => console.log('NODES', nodes)); i get node-not-found
  37. Flavius Andrei item-not-found actually
  38. Lance you have to send the query to the bare JID housing the nodes. So use 'pubsub.domain.tld' instead of client.config.jid
  39. Flavius Andrei then i get "Owner privileges required". owner of whom? :)
  40. Flavius Andrei oh, of the node i'm querying for
  41. Flavius Andrei bottom line, i don't think there's a way to retrieve a jid's nodes… :(
  42. Flavius Andrei which kinda sucks
  43. Lance Yeah :/
  44. Lance XEP 60 is missing that case entirely
  45. Lance Which I _understand_
  46. Lance It'd be a pain to handle correctly with privacy concerns
  47. Lance You'd then need public/private affiliation marking, etc
  48. Flavius Andrei yes
  49. Flavius Andrei well, i'd do some magic
  50. Lance if you control the servers involved, then you can make whatever custom IQ you want to give you the data
  51. Flavius Andrei create the nodes, append "-private" and "-public" to their names (to filter for privacy) and then retrieve the nodes from the server, filter with this.client.getDiscoInfo('pubsub.domain.tld', item.node); and then do jid === details[0].fields[3].value[0] to find what i need
  52. Flavius Andrei the server is ejabberd, written in erlang… i barely managed to alter som vcard_search sql queries…
  53. Flavius Andrei don't think i'll be able to do custom IQs…
  54. Flavius Andrei thanks for the help
  55. Flavius Andrei maybe you'll have the time to look into why stanzajs won't play nice with the cordova plugin, iosrtc? :D
  56. Flavius Andrei Unhandled Promise Rejection: TypeError: Argument 1 ('track') to RTCPeerConnection.addTrack must be an instance of MediaStreamTrack
  57. Flavius Andrei i could provide more info if you're interested…
  58. Flavius Andrei this is not _entirely_ true though
  59. Flavius Andrei It'd be a pain to handle correctly with privacy concerns You'd then need public/private affiliation marking, etc
  60. Flavius Andrei because you can always run disco#info on a node and see who's the owner…
  61. Flavius Andrei so they might've as well added the functionality to retrieve a jid's nodes… even based on the access model and voila, privacy issue solved by itself