public void createNodeToAllowComments(String blogPostId) { String nodeName = PublishCommentExtension.NODE + "/" + blogPostId; PubSubManager pubSubManager = PubSubManager.getInstance(XMPPSession.getInstance().getXMPPConnection()); try { // create node ConfigureForm configureForm = new ConfigureForm(DataForm.Type.submit); configureForm.setPublishModel(PublishModel.open); configureForm.setAccessModel(AccessModel.open); Node node = pubSubManager.createNode(nodeName, configureForm); // subscribe to comments String myJIDString = getUser().toString(); node.subscribe(myJIDString); } catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException e) { e.printStackTrace(); } }
protected LeafNode getRandomPubnode(PubSubManager pubMgr, boolean persistItems, boolean deliverPayload) throws XMPPException { ConfigureForm form = new ConfigureForm(FormType.submit); form.setPersistentItems(persistItems); form.setDeliverPayloads(deliverPayload); form.setAccessModel(AccessModel.open); return (LeafNode)pubMgr.createNode("/test/Pubnode" + System.currentTimeMillis(), form); }