Details

      Description

      Commit log for included patch:

      Add a good chunk of support for XEP-0248: PubSub Collection Nodes.

      • No schema changes. The only change you might need to care about is
        the one for node_default marked 'API-CHANGE'.
      • Notifications can be delivered via collection nodes. These
        notifications are distinguished between item and node types.
      • [API-CHANGE] To accomodate XEP-0060 better, I've allowed owners to
        have subscription 'none'. This required a change in node_default
        when creating the node. If you create your own nodes without using
        node_default's function, you should probably do this, too.
      • Since subscription options aren't available, assume default
        options of depth 'all' and type 'nodes' for collection nodes and
        'items' for leaf nodes. This does violate the XEP, but is still
        pretty useful for most people and without changing schema I'm not
        sure what else to do.
      • Add support for "pubsub#collection" text-multis in node
        configuration form.
      • Support for notifications of: item publish, item retract, node
        configuration, node purge, node creation, node deletion.
      • Fix a bug when notifying about node deletion, where even owners
        wouldn't get a notification.
      • Normalized a lot of the broadcast code to reduce my typing strain.
      • added mod_pubsub:make_stanza/4 to support SHIM headers.
      • added namespace constants to jlib.hrl for SHIM headers.

      MISSING:

      • Subscription options are basically required, but they will require
        a schema change or adding a table.
      • Configuration forms do not distinguish between collection and leaf
        nodes, in violation of the XEP.
      • Subscription depth defaults to all because I can't pass it up from
        get_states/2 in the nodetree module. This also violates the XEP.
      • Localization of configuration form for 'pubsub#collection'

      Additional Notes:

      As alluded to above, this is an almost-completely-backwards-compatible patch. Everything should continue to work using the new support, but new behavior won't be added. The behavior is contingent on a nodetree module which does the right thing, and a change to a node. The node change is straight -forward, so here it is:

      %% Get all the states for the current node and the states for all its
      %% parents.
      get_states(Host, Node) ->
          Parents = nodetree_dag:find_parents(Host, Node),
          QS = qlc:q([State || State <- mnesia:table(pubsub_state),
                               element(2, State#pubsub_state.stateid) == {Host, Node}]),
          QP = qlc:q([State || State <- mnesia:table(pubsub_state),
                              #pubsub_node{nodeid = {PHost, PNode}} <- Parents,
                              element(2, State#pubsub_state.stateid) == {PHost, PNode}]),
          {result, qlc:e(qlc:append(QS, QP))}.
      

      That relies on the nodetree_dag, which I'm including in this mail.

      1. coll-item-publish.patch.gz
        0.6 kB
        Brian Cully
      2. nodetree_dag.erl
        9 kB
        Brian Cully
      3. sub-depth-fix.patch.gz
        0.3 kB
        Brian Cully
      4. xep-0248.patch
        26 kB
        Brian Cully
      5. xep-0248.patch
        26 kB
        Brian Cully
      6. xep-0248.patch.gz
        9 kB
        Brian Cully
      7. xep-0248.patch.gz
        9 kB
        Christophe Romain
      8. xep-0248.patch.gz
        9 kB
        Brian Cully

        Issue Links

          Activity

          Hide
          Brian Cully
          added a comment -

          This is the patch and nodetree which makes use of it.

          Show
          Brian Cully
          added a comment - This is the patch and nodetree which makes use of it.
          Hide
          Brian Cully
          added a comment -

          This file supercedes the last patch. It includes nodetree_dag, and the requisite changes to node_default.

          Show
          Brian Cully
          added a comment - This file supercedes the last patch. It includes nodetree_dag, and the requisite changes to node_default.
          Hide
          Christophe Romain
          added a comment -

          I don't get your point: "To accomodate XEP-0060 better, I've allowed owners to have subscription 'none'. "
          but your patch sets subscription = subscribed on node creation.
          on node creation, subscription should remain none as it is now.

          Show
          Christophe Romain
          added a comment - I don't get your point: "To accomodate XEP-0060 better, I've allowed owners to have subscription 'none'. " but your patch sets subscription = subscribed on node creation. on node creation, subscription should remain none as it is now.
          Hide
          Christophe Romain
          added a comment -

          good point about the bug when notifying about node deletion, where even owners wouldn't get a notification !
          I missed that one

          Show
          Christophe Romain
          added a comment - good point about the bug when notifying about node deletion, where even owners wouldn't get a notification ! I missed that one
          Hide
          Brian Cully
          added a comment -

          I set it to "subscribed" to mimic the current auto-subscription of
          node owners when a node is created, which is advisable behavior if
          I've understood PSA correctly.

          The actual change was via presence_can_deliver and state_can_deliver,
          which filter out subscriptions of type "none" before looking at
          affiliation. This allows an owner to change their subscription to
          "none" and no longer get notifications.

          -bjc

          Show
          Brian Cully
          added a comment - I set it to "subscribed" to mimic the current auto-subscription of node owners when a node is created, which is advisable behavior if I've understood PSA correctly. The actual change was via presence_can_deliver and state_can_deliver, which filter out subscriptions of type "none" before looking at affiliation. This allows an owner to change their subscription to "none" and no longer get notifications. -bjc
          Hide
          Christophe Romain
          added a comment -
          Show
          Christophe Romain
          added a comment - got it. for the record: http://xmpp.org/extensions/xep-0060.html#auto-subscribe
          Hide
          Brian Cully
          added a comment -

          Interesting. I haven't run across that section of the XEP before. It will have an impact on EJAB-876 for node owners (they currently get a subscription of "nodes" at depth 1, which is the normal default according to XEP-0248).

          I assume, regardless of presence, if you set your subscription to "none" explicitly you should no longer receive notifications?

          Show
          Brian Cully
          added a comment - Interesting. I haven't run across that section of the XEP before. It will have an impact on EJAB-876 for node owners (they currently get a subscription of "nodes" at depth 1, which is the normal default according to XEP-0248). I assume, regardless of presence, if you set your subscription to "none" explicitly you should no longer receive notifications?
          Hide
          Christophe Romain
          added a comment -

          yes

          Show
          Christophe Romain
          added a comment - yes
          Hide
          Brian Cully
          added a comment -

          Update for ejabberd SVN 2098. This supercedes the old patch. Here are the notes:

          Implement multi-collection support, as defined in XEP-0248.

          Most parts of XEP-0248 are implemented, with the exception of
          association and dissociation messages (Examples 20 and 23.)

          To turn on this behavior, you have to use nodetree_dag as your
          nodetree plugin. As much as possible, existing behavior was preserved
          when using nodetree_default.

          Patch notes:

          • [API-CHANGE] Change #pubsub_node.parent to #pubsub_node.parents

          Because a node can have more than one parent, this field becomes a
          list and named as a plural. Existing tables are transformed when
          out-of-date.

          • [API-CHANGE] Add NodeTree:get_parentnodes/3 and
            NodeTree:get_parentnodes_tree/3

          These are used when traversing collections for event
          notifications. nodetree_default only returns itself, preserving
          existing behavior.

          • Node plugins no longer set node_type in default options. This is
            already stored in the #pubsub_node.type slot.
          • Add node_dag plugin, which currently only advertises
            multi-collection support.

          Bug fixes:

          • Fix compilation problems with node.template.
          Show
          Brian Cully
          added a comment - Update for ejabberd SVN 2098. This supercedes the old patch. Here are the notes: Implement multi-collection support, as defined in XEP-0248. Most parts of XEP-0248 are implemented, with the exception of association and dissociation messages (Examples 20 and 23.) To turn on this behavior, you have to use nodetree_dag as your nodetree plugin. As much as possible, existing behavior was preserved when using nodetree_default. Patch notes: [API-CHANGE] Change #pubsub_node.parent to #pubsub_node.parents Because a node can have more than one parent, this field becomes a list and named as a plural. Existing tables are transformed when out-of-date. [API-CHANGE] Add NodeTree:get_parentnodes/3 and NodeTree:get_parentnodes_tree/3 These are used when traversing collections for event notifications. nodetree_default only returns itself, preserving existing behavior. Node plugins no longer set node_type in default options. This is already stored in the #pubsub_node.type slot. Add node_dag plugin, which currently only advertises multi-collection support. Bug fixes: Fix compilation problems with node.template.
          Hide
          Brian Cully
          added a comment -

          I should mention, this requires the current patch from EJAB-845. This supercedes EJAB-876.

          Show
          Brian Cully
          added a comment - I should mention, this requires the current patch from EJAB-845 . This supercedes EJAB-876 .
          Hide
          Christophe Romain
          added a comment -

          attached, updated patch against r2118 which include subscription option

          Show
          Christophe Romain
          added a comment - attached, updated patch against r2118 which include subscription option
          Hide
          Brian Cully
          added a comment -

          Updated patch - same as the last one you sent, but includes nodetree_dag:get_node/1. The one in nodetree_tree works, so is just proxied through.

          Show
          Brian Cully
          added a comment - Updated patch - same as the last one you sent, but includes nodetree_dag:get_node/1. The one in nodetree_tree works, so is just proxied through.
          Hide
          Christophe Romain
          added a comment -

          patch included in r2157 (not fully validated yet anyway)

          Show
          Christophe Romain
          added a comment - patch included in r2157 (not fully validated yet anyway)
          Hide
          Brian Cully
          added a comment -

          The existing trunk has a bug when computing subscription depths. Depth 1 means one node below the current node, not the current node.

          Show
          Brian Cully
          added a comment - The existing trunk has a bug when computing subscription depths. Depth 1 means one node below the current node, not the current node.
          Hide
          Brian Cully
          added a comment -

          This patch fixes node_dag to deny item publish to collection nodes with not-allowed/publish errors.

          Show
          Brian Cully
          added a comment - This patch fixes node_dag to deny item publish to collection nodes with not-allowed/publish errors.
          Hide
          Christophe Romain
          added a comment -

          all patches included for few weeks, all seems ok. performance impact is negligible when not using dag.
          this is still to be ported to ejabberd-3.0 anyway

          Show
          Christophe Romain
          added a comment - all patches included for few weeks, all seems ok. performance impact is negligible when not using dag. this is still to be ported to ejabberd-3.0 anyway
          Hide
          Christophe Romain
          added a comment -

          i'll close this issue is nobody complains about the feature

          Show
          Christophe Romain
          added a comment - i'll close this issue is nobody complains about the feature
          Hide
          Guillaume Perrot
          added a comment -

          Is this feature available (or planned) in the ODBC version ?
          It seems that collections support needs the "dag_odbc" plugin and threre is no node_dag_odbc.erl/nodetree_dag_odbc files.

          Show
          Guillaume Perrot
          added a comment - Is this feature available (or planned) in the ODBC version ? It seems that collections support needs the "dag_odbc" plugin and threre is no node_dag_odbc.erl/nodetree_dag_odbc files.
          Hide
          Christophe Romain
          added a comment -

          we're waiting for xep-0060 v1.13 to be commited very soon for
          clarification. by now it references xep-0248 which is deferred.
          seems like dag will be dropped from the spec.

          Show
          Christophe Romain
          added a comment - we're waiting for xep-0060 v1.13 to be commited very soon for clarification. by now it references xep-0248 which is deferred. seems like dag will be dropped from the spec.
          Hide
          Christophe Romain
          added a comment -

          i meant, feature not planned in odbc while not sure collection as dag
          remains in the spec

          Show
          Christophe Romain
          added a comment - i meant, feature not planned in odbc while not sure collection as dag remains in the spec

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 31 weeks, 6 days ago

                Issue deployment