/** * Query the access model of {@code node}. If it is different from {@code accessModel}, change the access model * of the node to {@code accessModel}. * * @see <a href="https://xmpp.org/extensions/xep-0060.html#accessmodels">XEP-0060 §4.5 - Node Access Models</a> * * @param node {@link LeafNode} whose PubSub access model we want to change * @param accessModel new access model. * * @throws XMPPException.XMPPErrorException in case of an XMPP protocol error. * @throws SmackException.NotConnectedException if we are not connected. * @throws InterruptedException if the thread is interrupted. * @throws SmackException.NoResponseException if the server doesn't respond. */ public static void changeAccessModelIfNecessary(LeafNode node, AccessModel accessModel) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { ConfigureForm current = node.getNodeConfiguration(); if (current.getAccessModel() != accessModel) { ConfigureForm updateConfig = new ConfigureForm(DataForm.Type.submit); updateConfig.setAccessModel(accessModel); node.sendConfigurationForm(updateConfig); } }
PubSub pubsub = new PubSub(); cfg.setAccessModel(AccessModel.open); cfg.setPersistentItems(false); cfg.setPublishModel(PublishModel.open);
form.setPersistentItems(false); form.setDeliverPayloads(true); form.setAccessModel(AccessModel.open);
form.setPersistentItems(false); form.setDeliverPayloads(true); form.setAccessModel(AccessModel.open); return (LeafNode)manager.createNode(nodePath, form); } catch (XMPPException e) {