diff db/pubsub.sql @ 478:b544109ab4c4

Privileged Entity update + Pubsub Account Management partial implementation + Public Pubsub Subscription /!\ pgsql schema needs to be updated /!\ /!\ server conf needs to be updated for privileged entity: only the new `urn:xmpp:privilege:2` namespace is handled now /!\ Privileged entity has been updated to hanlde the new namespace and IQ permission. Roster pushes are not managed yet. XEP-0376 (Pubsub Account Management) is partially implemented. The XEP is not fully specified at the moment, and my messages on standard@ haven't seen any reply. Thus for now only "Subscribing", "Unsubscribing" and "Listing Subscriptions" is implemented, "Auto Subscriptions" and "Filtering" is not. Public Pubsub Subscription (https://xmpp.org/extensions/inbox/pubsub-public-subscriptions.html) is implemented; the XEP has been accepted by council but is not yet published. It will be updated to use subscription options instead of the <public> element actually specified, I'm waiting for publication to update the XEP. unsubscribe has been updated to return the `<subscription>` element as expected by XEP-0060 (sat_tmp needs to be updated). database schema has been updated to add columns necessary to keep track of subscriptions to external nodes and to mark subscriptions as public.
author Goffi <goffi@goffi.org>
date Wed, 11 May 2022 13:39:08 +0200
parents 0d38c3529972
children cfa40fa108a4
line wrap: on
line diff
--- a/db/pubsub.sql	Mon Jan 03 16:48:22 2022 +0100
+++ b/db/pubsub.sql	Wed May 11 13:39:08 2022 +0200
@@ -15,8 +15,8 @@
     deliver_payloads boolean NOT NULL DEFAULT TRUE,
     max_items integer NOT NULL DEFAULT 0
         CHECK (max_items >= 0),
-	overwrite_policy text NOT NULL DEFAULT 'original_publisher'
-		CHECK (overwrite_policy IN ('original_publisher', 'any_publisher')),
+    overwrite_policy text NOT NULL DEFAULT 'original_publisher'
+        CHECK (overwrite_policy IN ('original_publisher', 'any_publisher')),
     serial_ids boolean NOT NULL DEFAULT FALSE,
     consistent_publisher boolean NOT NULL DEFAULT FALSE,
     fts_language text NOT NULL DEFAULT 'generic',
@@ -53,14 +53,21 @@
     subscription_id serial PRIMARY KEY,
     entity_id integer NOT NULL REFERENCES entities ON DELETE CASCADE,
     resource text,
-    node_id integer NOT NULL REFERENCES nodes ON delete CASCADE,
+    node_id integer REFERENCES nodes ON DELETE CASCADE,
+    /* when we reference an external node (with PAM), node_id is NULL and service and node
+     * are set */
+    ext_service text,
+    ext_node text,
     state text NOT NULL DEFAULT 'subscribed'
         CHECK (state IN ('subscribed', 'pending', 'unconfigured')),
     subscription_type text
         CHECK (subscription_type IN (NULL, 'items', 'nodes')),
     subscription_depth text
         CHECK (subscription_depth IN (NULL, '1', 'all')),
-    UNIQUE (entity_id, resource, node_id));
+    public boolean NOT NULL DEFAULT FALSE,
+    UNIQUE (entity_id, resource, node_id)),
+    UNIQUE (entity_id, ext_service, ext_node)),
+    ;
 
 CREATE TABLE items (
     item_id serial PRIMARY KEY,
@@ -154,4 +161,4 @@
     value text
 );
 
-INSERT INTO metadata VALUES ('version', '9');
+INSERT INTO metadata VALUES ('version', '10');