Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the pubsub#type field #3914

Closed
edhelas opened this issue Oct 4, 2022 · 9 comments
Closed

Expose the pubsub#type field #3914

edhelas opened this issue Oct 4, 2022 · 9 comments

Comments

@edhelas
Copy link

edhelas commented Oct 4, 2022

XEP-0060 exposes pubsub#type. This field has been recently redefined in Version 1.23.0 (2022-01-14)

It would be great to expose the configuration of this field and display in in the node metadata.

This change will be really useful for this XEP proposal that uses it extensively: xsf/xeps#1211

@badlop
Copy link
Member

badlop commented Oct 7, 2022

Do you mean this simple patch:

diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl
index 7b01c4af0..861b502db 100644
--- a/src/mod_pubsub.erl
+++ b/src/mod_pubsub.erl
@@ -969,6 +969,7 @@ node_disco_info(Host, Node, _From, _Identity, _Features) ->
 			  _ -> []
 		       end,
 		Meta = [{title, get_option(Options, title, <<>>)},
+			{type, get_option(Options, type, <<>>)},
 			{description, get_option(Options, description, <<>>)},
 			{owner, [jid:make(LJID) || {LJID, Aff} <- Affs, Aff =:= owner]},
 			{publisher, [jid:make(LJID) || {LJID, Aff} <- Affs, Aff =:= publisher]},

@edhelas
Copy link
Author

edhelas commented Oct 7, 2022

Yes, it should also be set using the pubsub node configuration.
Not sure if this patch is taking care of it 🤔

@badlop
Copy link
Member

badlop commented Oct 10, 2022

Probably doesn't take care of that. What exact XEP section and/or XEP example are you referring to?

@edhelas
Copy link
Author

edhelas commented Oct 10, 2022

Sorry, my link was wrong, here is the correct one: https://xmpp.org/extensions/xep-0060.html#revision-history-v1.23.0
The pubsub#type field was redefined and clarified in this 0060 change. It is basically no more than a string from the XMPP server perspective (except if you want to apply the constraints related to the namespace set in the node pubsub#types).

@badlop
Copy link
Member

badlop commented Oct 11, 2022

Yes, it should also be set using the pubsub node configuration.
Not sure if this patch is taking care of it thinking

I'll ask again: how to check that?

@edhelas
Copy link
Author

edhelas commented Nov 9, 2022

Basically from the server side, it is exactly the same thing as pubsub#title, set in the Pubsub node configuration.

You can check if the element has been set correctly using this kind of request: https://xmpp.org/extensions/xep-0060.html#example-18
And you can configure it this way: https://xmpp.org/extensions/xep-0060.html#owner-configure-submit

That's mostly it :)

@edhelas
Copy link
Author

edhelas commented Dec 8, 2022

Redundant with #3820

@badlop
Copy link
Member

badlop commented Dec 12, 2022

Ok, let's see:

  1. I install ejabberd from git
  2. Create a node with https://xmpp.org/extensions/xep-0060.html#example-126
  3. Submit node configuration with https://xmpp.org/extensions/xep-0060.html#example-147
  4. Query node info with https://xmpp.org/extensions/xep-0060.html#example-17
  5. I see the response contains
        <field var='pubsub#type'
	type='text-single'
	label='...'>
          <value>urn:example:e2ee:bundle</value>
        </field>
  1. And, after applying the small patch mentioned in Expose the pubsub#type field #3914 (comment), a disco#info query gets as result:
<iq xml:lang='es'
	to='[email protected]/elsinore'
	from='pubsub.shakespeare.lit'
	type='result'
	id='78:481808'>
  <query node='princely_musings'
	xmlns='http://jabber.org/protocol/disco#info'>
      ...
      <field var='pubsub#type'
	type='text-single'
	label='Payload type'>
        <value>urn:example:e2ee:bundle</value>
      </field>

Does that solve the problem?

@edhelas
Copy link
Author

edhelas commented Dec 12, 2022

Looks good for me !
Thanks a lot for your time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants