From 3ad2891eb80d9381fed8547d6429904120af1f3e Mon Sep 17 00:00:00 2001
From: fiaxh <git@lightrise.org>
Date: Thu, 8 Aug 2019 03:17:34 +0200
Subject: Set OMEMO devicelist + bundle node access model to public

---
 plugins/omemo/src/protocol/stream_module.vala | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'plugins/omemo/src/protocol')

diff --git a/plugins/omemo/src/protocol/stream_module.vala b/plugins/omemo/src/protocol/stream_module.vala
index 258ff8c0..824098ba 100644
--- a/plugins/omemo/src/protocol/stream_module.vala
+++ b/plugins/omemo/src/protocol/stream_module.vala
@@ -74,7 +74,7 @@ public class StreamModule : XmppStreamModule {
             if (!am_on_devicelist) {
                 debug("Not on device list, adding id");
                 node.put_node(new StanzaNode.build("device", NS_URI).put_attribute("id", store.local_registration_id.to_string()));
-                stream.get_module(Pubsub.Module.IDENTITY).publish(stream, jid, NODE_DEVICELIST, NODE_DEVICELIST, id, node);
+                stream.get_module(Pubsub.Module.IDENTITY).publish(stream, jid, NODE_DEVICELIST, id, node, Xmpp.Xep.Pubsub.ACCESS_MODEL_OPEN);
             }
             publish_bundles_if_needed(stream, jid);
         }
@@ -130,6 +130,10 @@ public class StreamModule : XmppStreamModule {
         }
     }
 
+    public void clear_device_list(XmppStream stream) {
+        stream.get_module(Pubsub.Module.IDENTITY).delete_node(stream, null, NODE_DEVICELIST);
+    }
+
     private void on_other_bundle_result(XmppStream stream, Jid jid, int device_id, string? id, StanzaNode? node) {
         if (node == null) {
             // Device not registered, shouldn't exist
@@ -276,7 +280,7 @@ public class StreamModule : XmppStreamModule {
         }
         bundle.put_node(prekeys);
 
-        stream.get_module(Pubsub.Module.IDENTITY).publish(stream, null, @"$NODE_BUNDLES:$device_id", @"$NODE_BUNDLES:$device_id", "1", bundle);
+        stream.get_module(Pubsub.Module.IDENTITY).publish(stream, null, @"$NODE_BUNDLES:$device_id", "1", bundle, Xmpp.Xep.Pubsub.ACCESS_MODEL_OPEN);
     }
 
     public override string get_ns() {
-- 
cgit v1.2.3-70-g09d2