private void updateLocalEntityCaps ( ) { XMPPConnection connection = connection ( ) ; DiscoverInfo discoverInfo = new DiscoverInfo ( ) ; discoverInfo . setType ( IQ . Type . result ) ; sdm . addDiscoverInfoTo ( discoverInfo ) ; // getLocalNodeVer() will return a result only after currentCapsVersion is set. Therefore // set it first and then call getLocalNodeVer() currentCapsVersion = generateVerificationString ( discoverInfo ) ; final String localNodeVer = getLocalNodeVer ( ) ; discoverInfo . setNode ( localNodeVer ) ; addDiscoverInfoByNode ( localNodeVer , discoverInfo ) ; if ( lastLocalCapsVersions . size ( ) > 10 ) { CapsVersionAndHash oldCapsVersion = lastLocalCapsVersions . poll ( ) ; sdm . removeNodeInformationProvider ( entityNode + ' ' + oldCapsVersion . version ) ; } lastLocalCapsVersions . add ( currentCapsVersion ) ; if ( connection != null ) JID_TO_NODEVER_CACHE . put ( connection . getUser ( ) , new NodeVerHash ( entityNode , currentCapsVersion ) ) ; final List < Identity > identities = new LinkedList <> ( ServiceDiscoveryManager . getInstanceFor ( connection ) . getIdentities ( ) ) ; sdm . setNodeInformationProvider ( localNodeVer , new AbstractNodeInformationProvider ( ) { List < String > features = sdm . getFeatures ( ) ; List < ExtensionElement > packetExtensions = sdm . getExtendedInfoAsList ( ) ; @ Override public List < String > getNodeFeatures ( ) { return features ; } @ Override public List < Identity > getNodeIdentities ( ) { return identities ; } @ Override public List < ExtensionElement > getNodePacketExtensions ( ) { return packetExtensions ; } } ) ; // Re-send the last sent presence, and let the stanza interceptor // add a <c/> node to it. // See http://xmpp.org/extensions/xep-0115.html#advertise // We only send a presence packet if there was already one send // to respect ConnectionConfiguration.isSendPresence() if ( connection != null && connection . isAuthenticated ( ) && presenceSend != null ) { try { connection . sendStanza ( presenceSend . cloneWithNewId ( ) ) ; } catch ( InterruptedException | NotConnectedException e ) { LOGGER . log ( Level . WARNING , "Could could not update presence with caps info" , e ) ; } } }
Updates the local user Entity Caps information with the data provided