Score:0

default_node_config is ignored when new nodes are created

bg flag

I have a fairly standard ejabberd install backed by MySQL and I want to pre-configure the PubSub nodes to set send_last_published_item to never or on_sub. Currently, I have users who can be subscribed to as many as 50 PubSub nodes which flood the client after logging in and I want to dial that down a bit as I am expecting that number to go up significantly in the future.

I updated ejabberd.yml and set a few values in default_node_config and then I created a new node via

<iq type='set' id='some-id'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <create node='123'/>
  </pubsub>
</iq>

However, when I checked the database, the new node ignored all defaults from default_node_config. This node has not been modified by someone else, it is created entirely anew with a configuration that ignores the defaults:

SELECT * FROM `pubsub_node_option` WHERE nodeid=9;

nodeid  name  val 
9 access_model  presence  
9 deliver_notifications true  
9 deliver_payloads  true  
9 itemreply none  
9 max_items 1 
9 max_payload_size  250000  
9 notification_type headline  
9 notify_config false 
9 notify_delete false 
9 notify_retract  false 
9 persist_items true  
9 presence_based_delivery true  
9 publish_model publishers  
9 purge_offline false 
9 roster_groups_allowed []  
9 rsm true  
9 send_last_published_item  on_sub_and_presence 
9 sql true  
9 subscribe true  

These values are suspiciously similar to the defaults from ejabberd/src/node_flat.erl.

This is what the configuration looks like:

  mod_pubsub:
    db_type: sql
    access_createnode: pubsub_createnode
    plugins:
      - flat
      - pep
    force_node_config:
      ## Avoid buggy clients to make their bookmarks public
      storage:bookmarks:
        access_model: whitelist
    default_node_config:
      send_last_published_item: never
      notification_type: normal
      notify_retract: false
      max_items: 4
      delivers_notifications: false
      notify_delete: true
      max_payload_size: 100

I've read the documentation so many times and the description for default_node_config is confusing to me:

default_node_config

To override default node configuration, regardless of node plugin. Value is a list of key-value definition. Node configuration still uses default configuration defined by node plugin, and overrides any items by value defined in this configurable list.

I read this as [This is to be used] to override default node configuration, regardless of node plugin. But then it says that the Node configuration still uses default configuration defined by the node plugin, and overrides any items by value defined in this configurable list.

This can be interpreted as default_node_config having precedence, but the second sentence is weird to me.

Am I doing something wrong or is this a bug?

Is there a way to configure the defaults for the node plugin? I am using the "flat" type for nodes.

Thanks!

Badlop avatar
ru flag
In a very quick read, this seems a bug. Otherwise, the documentation should be rephrased to be more clear. I see you crossposted this in https://github.com/processone/ejabberd/issues/4070 Can you add the additional information from this post to t hat page (it probably helps to investigate the problem)?
clawoo avatar
bg flag
Sure thing, I just did. For the moment I'm just updating my clients to publish in the correct configuration and ran a database query to update existing nodes.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.