/** * Publish an event. * * @param item the item to publish. * @param node the node to publish on. * @throws NotConnectedException * @throws InterruptedException * @throws XMPPErrorException * @throws NoResponseException * @throws NotAPubSubNodeException * @throws NotALeafNodeException */ public void publish(Item item, String node) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, NotAPubSubNodeException, NotALeafNodeException { LeafNode pubSubNode = pepPubSubManager.getLeafNode(node); pubSubNode.publish(item); }
/** * Retrieve the OMEMO device list of a contact. * * @param connection authenticated XMPP connection. * @param contact BareJid of the contact of which we want to retrieve the device list from. * @return * @throws InterruptedException * @throws PubSubException.NotALeafNodeException * @throws SmackException.NoResponseException * @throws SmackException.NotConnectedException * @throws XMPPException.XMPPErrorException * @throws PubSubException.NotAPubSubNodeException */ private static OmemoDeviceListElement fetchDeviceList(XMPPConnection connection, BareJid contact) throws InterruptedException, PubSubException.NotALeafNodeException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotAPubSubNodeException { PubSubManager pm = PubSubManager.getInstance(connection, contact); String nodeName = OmemoConstants.PEP_NODE_DEVICE_LIST; LeafNode node = pm.getLeafNode(nodeName); if (node == null) { return null; } List<PayloadItem<OmemoDeviceListElement>> items = node.getItems(); if (items.isEmpty()) { return null; } return items.get(items.size() - 1).getPayload(); }
/** * Retrieve a users OMEMO bundle. * * @param connection authenticated XMPP connection. * @param contactsDevice device of which we want to retrieve the bundle. * @return OmemoBundle of the device or null, if it doesn't exist. * * @throws SmackException.NotConnectedException * @throws InterruptedException * @throws SmackException.NoResponseException * @throws XMPPException.XMPPErrorException * @throws PubSubException.NotALeafNodeException * @throws PubSubException.NotAPubSubNodeException */ private static OmemoBundleElement fetchBundle(XMPPConnection connection, OmemoDevice contactsDevice) throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, PubSubException.NotAPubSubNodeException { PubSubManager pm = PubSubManager.getInstance(connection, contactsDevice.getJid()); LeafNode node = pm.getLeafNode(contactsDevice.getBundleNodeName()); if (node == null) { return null; } List<PayloadItem<OmemoBundleElement>> bundleItems = node.getItems(); if (bundleItems.isEmpty()) { return null; } return bundleItems.get(bundleItems.size() - 1).getPayload(); }
LeafNode node; try { node = pm.getLeafNode(nodeName); } catch (XMPPException.XMPPErrorException e) {
throws NoResponseException, NotConnectedException, InterruptedException, XMPPErrorException, NotALeafNodeException { try { return getLeafNode(id); return getLeafNode(id);
pm.getLeafNode(OmemoConstants.PEP_NODE_BUNDLE_FROM_DEVICE_ID(id)).deleteAllItems(); } catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException | pm.getLeafNode(OmemoConstants.PEP_NODE_DEVICE_LIST).deleteAllItems(); } catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException |