private static OmemoBundleElement fetchBundle ( XMPPConnection connection , OmemoDevice contactsDevice ) throws SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException , XMPPException . XMPPErrorException , PubSubException . NotALeafNodeException , PubSubException . NotAPubSubNodeException { PubSubManager pm = PubSubManager . getInstanceFor ( 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 ( ) ; }
Retrieve a users OMEMO bundle .