idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
119,300
public Form getSearchForm ( XMPPConnection con , DomainBareJid searchService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { UserSearch search = new UserSearch ( ) ; search . setType ( IQ . Type . get ) ; search . setTo ( searchService ) ; IQ response = con . createSta...
Returns the form for all search fields supported by the search service .
119,301
public static String addTo ( Message message ) { if ( message . getStanzaId ( ) == null ) { message . setStanzaId ( StanzaIdUtil . newStanzaId ( ) ) ; } message . addExtension ( new DeliveryReceiptRequest ( ) ) ; return message . getStanzaId ( ) ; }
Add a delivery receipt request to an outgoing packet .
119,302
public static void publishPublicKey ( PepManager pepManager , PubkeyElement pubkeyElement , OpenPgpV4Fingerprint fingerprint ) throws InterruptedException , PubSubException . NotALeafNodeException , XMPPException . XMPPErrorException , SmackException . NotConnectedException , SmackException . NoResponseException { Stri...
Publish the users OpenPGP public key to the public key node if necessary . Also announce the key to other users by updating the metadata node .
119,303
public static PublicKeysListElement fetchPubkeysList ( XMPPConnection connection ) throws InterruptedException , XMPPException . XMPPErrorException , PubSubException . NotAPubSubNodeException , PubSubException . NotALeafNodeException , SmackException . NotConnectedException , SmackException . NoResponseException { retu...
Consult the public key metadata node and fetch a list of all of our published OpenPGP public keys .
119,304
public static boolean deletePubkeysListNode ( PepManager pepManager ) throws XMPPException . XMPPErrorException , SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException { PubSubManager pm = pepManager . getPepPubSubManager ( ) ; return pm . deleteNode ( PEP_NODE_PUBLIC_KEYS...
Delete our metadata node .
119,305
public static boolean deleteSecretKeyNode ( PepManager pepManager ) throws XMPPException . XMPPErrorException , SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException { PubSubManager pm = pepManager . getPepPubSubManager ( ) ; return pm . deleteNode ( PEP_NODE_SECRET_KEY ) ...
Delete the private backup node .
119,306
public Jid findRegistry ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { if ( preconfiguredRegistry != null ) { return preconfiguredRegistry ; } final XMPPConnection connection = connection ( ) ; ServiceDiscoveryManager sdm = ServiceDiscoveryManager . getInstanceFor (...
Try to find an XMPP IoT registry .
119,307
public boolean isRegistry ( BareJid jid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { Objects . requireNonNull ( jid , "JID argument must not be null" ) ; Jid registry = findRegistry ( ) ; if ( jid . equals ( registry ) ) { return true ; } if ( usedRegistries . conta...
Registry utility methods
119,308
public ArrayList < STUNService > loadSTUNServers ( java . io . InputStream stunConfigStream ) { ArrayList < STUNService > serversList = new ArrayList < > ( ) ; String serverName ; int serverPort ; try { XmlPullParser parser = XmlPullParserFactory . newInstance ( ) . newPullParser ( ) ; parser . setFeature ( XmlPullPars...
Load the STUN configuration from a stream .
119,309
private STUNService bestSTUNServer ( ArrayList < STUNService > listServers ) { if ( listServers . isEmpty ( ) ) { return null ; } else { return listServers . get ( 0 ) ; } }
Get the best usable STUN server from a list .
119,310
public void initialize ( ) throws XMPPException { LOGGER . fine ( "Initialized" ) ; if ( ! isResolving ( ) && ! isResolved ( ) ) { if ( currentServer . isNull ( ) ) { loadSTUNServers ( ) ; } if ( ! currentServer . isNull ( ) ) { clearCandidates ( ) ; resolverThread = new Thread ( new Runnable ( ) { public void run ( ) ...
Initialize the resolver .
119,311
CipherAndAuthTag retrieveMessageKeyAndAuthTag ( OmemoDevice sender , OmemoElement element ) throws CryptoFailedException , NoRawSessionException { int keyId = omemoManager . getDeviceId ( ) ; byte [ ] unpackedKey = null ; List < CryptoFailedException > decryptExceptions = new ArrayList < > ( ) ; List < OmemoKeyElement ...
Try to decrypt the transported message key using the double ratchet session .
119,312
static String decryptMessageElement ( OmemoElement element , CipherAndAuthTag cipherAndAuthTag ) throws CryptoFailedException { if ( ! element . isMessageElement ( ) ) { throw new IllegalArgumentException ( "decryptMessageElement cannot decrypt OmemoElement which is no MessageElement!" ) ; } if ( cipherAndAuthTag . get...
Use the symmetric key in cipherAndAuthTag to decrypt the payload of the omemoMessage . The decrypted payload will be the body of the returned Message .
119,313
static byte [ ] payloadAndAuthTag ( OmemoElement element , byte [ ] authTag ) { if ( ! element . isMessageElement ( ) ) { throw new IllegalArgumentException ( "OmemoElement has no payload." ) ; } byte [ ] payload = new byte [ element . getPayload ( ) . length + authTag . length ] ; System . arraycopy ( element . getPay...
Return the concatenation of the payload of the OmemoElement and the given auth tag .
119,314
private void updateStatistics ( ) { statisticsTable . setValueAt ( Integer . valueOf ( receivedIQPackets ) , 0 , 1 ) ; statisticsTable . setValueAt ( Integer . valueOf ( sentIQPackets ) , 0 , 2 ) ; statisticsTable . setValueAt ( Integer . valueOf ( receivedMessagePackets ) , 1 , 1 ) ; statisticsTable . setValueAt ( Int...
Updates the statistics table
119,315
private void addReadPacketToTable ( final SimpleDateFormat dateFormatter , final TopLevelStreamElement packet ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { String messageType ; Jid from ; String stanzaId ; if ( packet instanceof Stanza ) { Stanza stanza = ( Stanza ) packet ; from = stanza ...
Adds the received stanza detail to the messages table .
119,316
private void addSentPacketToTable ( final SimpleDateFormat dateFormatter , final TopLevelStreamElement packet ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { String messageType ; Jid to ; String stanzaId ; if ( packet instanceof Stanza ) { Stanza stanza = ( Stanza ) packet ; to = stanza . ge...
Adds the sent stanza detail to the messages table .
119,317
void cancel ( ) { connection . removeConnectionListener ( connListener ) ; ( ( ObservableReader ) reader ) . removeReaderListener ( readerListener ) ; ( ( ObservableWriter ) writer ) . removeWriterListener ( writerListener ) ; messagesTable = null ; }
Stops debugging the connection . Removes any listener on the connection .
119,318
private void notifyListeners ( ) { WriterListener [ ] writerListeners ; synchronized ( listeners ) { writerListeners = new WriterListener [ listeners . size ( ) ] ; listeners . toArray ( writerListeners ) ; } String str = stringBuilder . toString ( ) ; stringBuilder . setLength ( 0 ) ; for ( WriterListener writerListen...
Notify that a new string has been written .
119,319
public void addWriterListener ( WriterListener writerListener ) { if ( writerListener == null ) { return ; } synchronized ( listeners ) { if ( ! listeners . contains ( writerListener ) ) { listeners . add ( writerListener ) ; } } }
Adds a writer listener to this writer that will be notified when new strings are sent .
119,320
public boolean supportsFlexibleRetrieval ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return ServiceDiscoveryManager . getInstanceFor ( connection ) . serverSupportsFeature ( namespace ) ; }
Returns true if the server supports Flexible Offline Message Retrieval . When the server supports Flexible Offline Message Retrieval it is possible to get the header of the offline messages get specific messages delete specific messages etc .
119,321
public int getMessageCount ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { DiscoverInfo info = ServiceDiscoveryManager . getInstanceFor ( connection ) . discoverInfo ( null , namespace ) ; Form extendedInfo = Form . getFormFrom ( info ) ; if ( extendedInfo != null ) ...
Returns the number of offline messages for the user of the connection .
119,322
public void deleteMessages ( List < String > nodes ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { OfflineMessageRequest request = new OfflineMessageRequest ( ) ; request . setType ( IQ . Type . set ) ; for ( String node : nodes ) { OfflineMessageRequest . Item item = ...
Deletes the specified list of offline messages . The request will include the list of stamps that uniquely identifies the offline messages to delete .
119,323
public void deleteMessages ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { OfflineMessageRequest request = new OfflineMessageRequest ( ) ; request . setType ( IQ . Type . set ) ; request . setPurge ( true ) ; connection . createStanzaCollectorAndSend ( request ) . ne...
Deletes all offline messages of the user .
119,324
public Form getSearchForm ( DomainBareJid searchService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return userSearch . getSearchForm ( con , searchService ) ; }
Returns the form to fill out to perform a search .
119,325
public List < DomainBareJid > getSearchServices ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { ServiceDiscoveryManager discoManager = ServiceDiscoveryManager . getInstanceFor ( con ) ; return discoManager . findServices ( UserSearch . NAMESPACE , false , false ) ; }
Returns a collection of search services found on the server .
119,326
public static synchronized BoBManager getInstanceFor ( XMPPConnection connection ) { BoBManager bobManager = INSTANCES . get ( connection ) ; if ( bobManager == null ) { bobManager = new BoBManager ( connection ) ; INSTANCES . put ( connection , bobManager ) ; } return bobManager ; }
Get the singleton instance of BoBManager .
119,327
public boolean isSupportedByServer ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) . serverSupportsFeature ( NAMESPACE ) ; }
Returns true if Bits of Binary is supported by the server .
119,328
public BoBData requestBoB ( Jid to , BoBHash bobHash ) throws NotLoggedInException , NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { BoBData bobData = BOB_CACHE . lookup ( bobHash ) ; if ( bobData != null ) { return bobData ; } BoBIQ requestBoBIQ = new BoBIQ ( bobHash ) ; reque...
Request BoB data .
119,329
public static Thread go ( Runnable runnable ) { Thread thread = daemonThreadFrom ( runnable ) ; thread . start ( ) ; return thread ; }
Creates a new thread with the given Runnable marks it daemon starts it and returns the started thread .
119,330
public static Thread go ( Runnable runnable , String threadName ) { Thread thread = daemonThreadFrom ( runnable ) ; thread . setName ( threadName ) ; thread . start ( ) ; return thread ; }
Creates a new thread with the given Runnable marks it daemon sets the name starts it and returns the started thread .
119,331
public static synchronized HttpFileUploadManager getInstanceFor ( XMPPConnection connection ) { HttpFileUploadManager httpFileUploadManager = INSTANCES . get ( connection ) ; if ( httpFileUploadManager == null ) { httpFileUploadManager = new HttpFileUploadManager ( connection ) ; INSTANCES . put ( connection , httpFile...
Obtain the HttpFileUploadManager responsible for a connection .
119,332
public boolean discoverUploadService ( ) throws XMPPException . XMPPErrorException , SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) ; List < DiscoverInfo > servicesDiscoverIn...
Discover upload service .
119,333
public URL uploadFile ( File file ) throws InterruptedException , XMPPException . XMPPErrorException , SmackException , IOException { return uploadFile ( file , null ) ; }
Request slot and uploaded file to HTTP file upload service .
119,334
public URL uploadFile ( File file , UploadProgressListener listener ) throws InterruptedException , XMPPException . XMPPErrorException , SmackException , IOException { if ( ! file . isFile ( ) ) { throw new FileNotFoundException ( "The path " + file . getAbsolutePath ( ) + " is not a file" ) ; } final Slot slot = reque...
Request slot and uploaded file to HTTP file upload service with progress callback .
119,335
public Slot requestSlot ( String filename , long fileSize , String contentType , DomainBareJid uploadServiceAddress ) throws SmackException , InterruptedException , XMPPException . XMPPErrorException { final XMPPConnection connection = connection ( ) ; final UploadService defaultUploadService = this . defaultUploadServ...
Request a new upload slot with optional content type from custom upload service .
119,336
public static synchronized MultiUserChatLightManager getInstanceFor ( XMPPConnection connection ) { MultiUserChatLightManager multiUserChatLightManager = INSTANCES . get ( connection ) ; if ( multiUserChatLightManager == null ) { multiUserChatLightManager = new MultiUserChatLightManager ( connection ) ; INSTANCES . put...
Get a instance of a MUC Light manager for the given connection .
119,337
public synchronized MultiUserChatLight getMultiUserChatLight ( EntityBareJid jid ) { WeakReference < MultiUserChatLight > weakRefMultiUserChat = multiUserChatLights . get ( jid ) ; if ( weakRefMultiUserChat == null ) { return createNewMucLightAndAddToMap ( jid ) ; } MultiUserChatLight multiUserChatLight = weakRefMultiU...
Obtain the MUC Light .
119,338
public boolean isFeatureSupported ( DomainBareJid mucLightService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) . discoverInfo ( mucLightService ) . containsFeature ( MultiUserChatLight . NAMESPACE ) ...
Returns true if Multi - User Chat Light feature is supported by the server .
119,339
public List < Jid > getOccupiedRooms ( DomainBareJid mucLightService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { DiscoverItems result = ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) . discoverItems ( mucLightService ) ; List < DiscoverItems . Item > i...
Returns a List of the rooms the user occupies .
119,340
public List < DomainBareJid > getLocalServices ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) ; return sdm . findServices ( MultiUserChatLight . NAMESPACE , false , false ) ; }
Returns a collection with the XMPP addresses of the MUC Light services .
119,341
public List < Jid > getUsersAndRoomsBlocked ( DomainBareJid mucLightService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { MUCLightBlockingIQ muclIghtBlockingIQResult = getBlockingList ( mucLightService ) ; List < Jid > jids = new ArrayList < > ( ) ; if ( muclIghtBloc...
Get users and rooms blocked .
119,342
public List < Jid > getRoomsBlocked ( DomainBareJid mucLightService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { MUCLightBlockingIQ mucLightBlockingIQResult = getBlockingList ( mucLightService ) ; List < Jid > jids = new ArrayList < > ( ) ; if ( mucLightBlockingIQRe...
Get rooms blocked .
119,343
public void blockRoom ( DomainBareJid mucLightService , Jid roomJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > rooms = new HashMap < > ( ) ; rooms . put ( roomJid , false ) ; sendBlockRooms ( mucLightService , rooms ) ; }
Block a room .
119,344
public void blockRooms ( DomainBareJid mucLightService , List < Jid > roomsJids ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > rooms = new HashMap < > ( ) ; for ( Jid jid : roomsJids ) { rooms . put ( jid , false ) ; } sendBlockRooms ( mucLig...
Block rooms .
119,345
public void blockUser ( DomainBareJid mucLightService , Jid userJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > users = new HashMap < > ( ) ; users . put ( userJid , false ) ; sendBlockUsers ( mucLightService , users ) ; }
Block a user .
119,346
public void blockUsers ( DomainBareJid mucLightService , List < Jid > usersJids ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > users = new HashMap < > ( ) ; for ( Jid jid : usersJids ) { users . put ( jid , false ) ; } sendBlockUsers ( mucLig...
Block users .
119,347
public void unblockRoom ( DomainBareJid mucLightService , Jid roomJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > rooms = new HashMap < > ( ) ; rooms . put ( roomJid , true ) ; sendUnblockRooms ( mucLightService , rooms ) ; }
Unblock a room .
119,348
public void unblockRooms ( DomainBareJid mucLightService , List < Jid > roomsJids ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > rooms = new HashMap < > ( ) ; for ( Jid jid : roomsJids ) { rooms . put ( jid , true ) ; } sendUnblockRooms ( muc...
Unblock rooms .
119,349
public void unblockUser ( DomainBareJid mucLightService , Jid userJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > users = new HashMap < > ( ) ; users . put ( userJid , true ) ; sendUnblockUsers ( mucLightService , users ) ; }
Unblock a user .
119,350
public void unblockUsers ( DomainBareJid mucLightService , List < Jid > usersJids ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { HashMap < Jid , Boolean > users = new HashMap < > ( ) ; for ( Jid jid : usersJids ) { users . put ( jid , true ) ; } sendUnblockUsers ( muc...
Unblock users .
119,351
public static void addPrivateDataProvider ( String elementName , String namespace , PrivateDataProvider provider ) { String key = XmppStringUtils . generateKey ( elementName , namespace ) ; privateDataProviders . put ( key , provider ) ; }
Adds a private data provider with the specified element name and name space . The provider will override any providers loaded through the classpath .
119,352
public static void removePrivateDataProvider ( String elementName , String namespace ) { String key = XmppStringUtils . generateKey ( elementName , namespace ) ; privateDataProviders . remove ( key ) ; }
Removes a private data provider with the specified element name and namespace .
119,353
public void setPrivateData ( final PrivateData privateData ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { IQ privateDataSet = new PrivateDataIQ ( privateData ) ; connection ( ) . createStanzaCollectorAndSend ( privateDataSet ) . nextResultOrThrow ( ) ; }
Sets a private data value . Each chunk of private data is uniquely identified by an element name and namespace pair . If private data has already been set with the element name and namespace then the new private data will overwrite the old value .
119,354
public boolean isSupported ( ) throws NoResponseException , NotConnectedException , InterruptedException , XMPPErrorException { try { setPrivateData ( DUMMY_PRIVATE_DATA ) ; return true ; } catch ( XMPPErrorException e ) { if ( e . getStanzaError ( ) . getCondition ( ) == Condition . service_unavailable ) { return fals...
Check if the service supports private data .
119,355
static void moveAuthTag ( byte [ ] messageKey , byte [ ] cipherText , byte [ ] messageKeyWithAuthTag , byte [ ] cipherTextWithoutAuthTag ) { if ( messageKeyWithAuthTag . length != messageKey . length + 16 ) { throw new IllegalArgumentException ( "Length of messageKeyWithAuthTag must be length of messageKey + " + "lengt...
Move the auth tag from the end of the cipherText to the messageKey .
119,356
public void addRecipient ( OmemoDevice contactsDevice ) throws NoIdentityKeyException , CorruptedOmemoKeyException , UndecidedOmemoIdentityException , UntrustedOmemoIdentityException { OmemoFingerprint fingerprint ; fingerprint = OmemoService . getInstance ( ) . getOmemoStoreBackend ( ) . getFingerprint ( userDevice , ...
Add a new recipient device to the message .
119,357
public OmemoElement finish ( ) { OmemoHeaderElement_VAxolotl header = new OmemoHeaderElement_VAxolotl ( userDevice . getDeviceId ( ) , keys , initializationVector ) ; return new OmemoElement_VAxolotl ( header , ciphertextMessage ) ; }
Assemble an OmemoMessageElement from the current state of the builder .
119,358
public static byte [ ] generateKey ( String keyType , int keyLength ) throws NoSuchAlgorithmException { KeyGenerator generator = KeyGenerator . getInstance ( keyType ) ; generator . init ( keyLength ) ; return generator . generateKey ( ) . getEncoded ( ) ; }
Generate a new AES key used to encrypt the message .
119,359
public Version getVersion ( Jid jid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { if ( ! isSupported ( jid ) ) { return null ; } return connection ( ) . createStanzaCollectorAndSend ( new Version ( jid ) ) . nextResultOrThrow ( ) ; }
Request version information from a given JID .
119,360
public static void reply ( XMPPConnection connection , Message original , Message reply ) throws XMPPErrorException , InterruptedException , NotConnectedException , NoResponseException , FeatureNotSupportedException { MultipleRecipientInfo info = getMultipleRecipientInfo ( original ) ; if ( info == null ) { throw new I...
Sends a reply to a previously received stanza that was sent to multiple recipients . Before attempting to send the reply message some checks are performed . If any of those checks fails then an XMPPException is going to be thrown with the specific error detail .
119,361
private static DomainBareJid getMultipleRecipientServiceAddress ( XMPPConnection connection ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager . getInstanceFor ( connection ) ; return sdm . findService ( MultipleAddres...
Returns the address of the multiple recipients service . To obtain such address service discovery is going to be used on the connected server and if none was found then another attempt will be tried on the server items . The discovered information is going to be cached for 24 hours .
119,362
public static DelayInformation getDelayInformation ( Stanza packet ) { DelayInformation delayInformation = getXep203DelayInformation ( packet ) ; if ( delayInformation != null ) { return delayInformation ; } return getLegacyDelayInformation ( packet ) ; }
Get Delayed Delivery information . This method first looks for a PacketExtension with the XEP - 203 namespace and falls back to the XEP - 91 namespace .
119,363
public static synchronized PushNotificationsManager getInstanceFor ( XMPPConnection connection ) { PushNotificationsManager pushNotificationsManager = INSTANCES . get ( connection ) ; if ( pushNotificationsManager == null ) { pushNotificationsManager = new PushNotificationsManager ( connection ) ; INSTANCES . put ( con...
Get the singleton instance of PushNotificationsManager .
119,364
public boolean isSupported ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) . accountSupportsFeatures ( PushNotificationsElements . NAMESPACE ) ; }
Returns true if Push Notifications are supported by this account .
119,365
public boolean disableAll ( Jid pushJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return disable ( pushJid , null ) ; }
Disable all push notifications .
119,366
public boolean disable ( Jid pushJid , String node ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ ( pushJid , node ) ; return changePushNotificationsStatus ( disablePushNotification...
Disable push notifications of an specific node .
119,367
public synchronized boolean removeIdentity ( DiscoverInfo . Identity identity ) { if ( identity . equals ( this . identity ) ) return false ; identities . remove ( identity ) ; renewEntityCapsVersion ( ) ; return true ; }
Remove an identity from the client . Note that the client needs at least one identity the default identity which can not be removed .
119,368
public Set < DiscoverInfo . Identity > getIdentities ( ) { Set < Identity > res = new HashSet < > ( identities ) ; res . add ( identity ) ; return Collections . unmodifiableSet ( res ) ; }
Returns all identities of this client as unmodifiable Collection .
119,369
public static synchronized ServiceDiscoveryManager getInstanceFor ( XMPPConnection connection ) { ServiceDiscoveryManager sdm = instances . get ( connection ) ; if ( sdm == null ) { sdm = new ServiceDiscoveryManager ( connection ) ; instances . put ( connection , sdm ) ; } return sdm ; }
Returns the ServiceDiscoveryManager instance associated with a given XMPPConnection .
119,370
public synchronized void addDiscoverInfoTo ( DiscoverInfo response ) { response . addIdentities ( getIdentities ( ) ) ; for ( String feature : getFeatures ( ) ) { response . addFeature ( feature ) ; } response . addExtension ( extendedInfo ) ; }
Add discover info response data .
119,371
public DiscoverInfo discoverInfo ( Jid entityID ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { if ( entityID == null ) return discoverInfo ( null , null ) ; synchronized ( discoInfoLookupShortcutMechanisms ) { for ( DiscoInfoLookupShortcutMechanism discoInfoLookupShor...
Returns the discovered information of a given XMPP entity addressed by its JID . Use null as entityID to query the server
119,372
public DiscoverInfo discoverInfo ( Jid entityID , String node ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { DiscoverInfo disco = new DiscoverInfo ( ) ; disco . setType ( IQ . Type . get ) ; disco . setTo ( entityID ) ; disco . setNode ( node ) ; Stanza result = conne...
Returns the discovered information of a given XMPP entity addressed by its JID and note attribute . Use this message only when trying to query information which is not directly addressable .
119,373
public DiscoverItems discoverItems ( Jid entityID ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return discoverItems ( entityID , null ) ; }
Returns the discovered items of a given XMPP entity addressed by its JID .
119,374
public boolean accountSupportsFeatures ( CharSequence ... features ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return accountSupportsFeatures ( Arrays . asList ( features ) ) ; }
Check if the given features are supported by the connection account . This means that the discovery information lookup will be performed on the bare JID of the connection managed by this ServiceDiscoveryManager .
119,375
public boolean accountSupportsFeatures ( Collection < ? extends CharSequence > features ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { EntityBareJid accountJid = connection ( ) . getUser ( ) . asEntityBareJid ( ) ; return supportsFeatures ( accountJid , features ) ; }
Check if the given collection of features are supported by the connection account . This means that the discovery information lookup will be performed on the bare JID of the connection managed by this ServiceDiscoveryManager .
119,376
public boolean supportsFeature ( Jid jid , CharSequence feature ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return supportsFeatures ( jid , feature ) ; }
Queries the remote entity for it s features and returns true if the given feature is found .
119,377
public List < DiscoverInfo > findServicesDiscoverInfo ( DomainBareJid serviceName , String feature , boolean stopOnFirst , boolean useCache , Map < ? super Jid , Exception > encounteredExceptions ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { List < DiscoverInfo > ser...
Find all services under a given service that provide a given feature .
119,378
public DomainBareJid findProvisioningServerComponent ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { final XMPPConnection connection = connection ( ) ; ServiceDiscoveryManager sdm = ServiceDiscoveryManager . getInstanceFor ( connection ) ; List < DiscoverInfo > disco...
Try to find a provisioning server component .
119,379
public boolean isFriend ( Jid provisioningServer , BareJid friendInQuestion ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { LruCache < BareJid , Void > cache = negativeFriendshipRequestCache . lookup ( provisioningServer ) ; if ( cache != null && cache . containsKey ( ...
As the given provisioning server is the given JID is a friend .
119,380
public void disconnect ( ) { Presence unavailablePresence = null ; if ( isAuthenticated ( ) ) { unavailablePresence = new Presence ( Presence . Type . unavailable ) ; } try { disconnect ( unavailablePresence ) ; } catch ( NotConnectedException e ) { LOGGER . log ( Level . FINEST , "Connection is already disconnected" ,...
Closes the connection by setting presence to unavailable then closing the connection to the XMPP server . The XMPPConnection can still be used for connecting to the server again .
119,381
public synchronized void disconnect ( Presence unavailablePresence ) throws NotConnectedException { if ( unavailablePresence != null ) { try { sendStanza ( unavailablePresence ) ; } catch ( InterruptedException e ) { LOGGER . log ( Level . FINE , "Was interrupted while sending unavailable presence. Continuing to discon...
Closes the connection . A custom unavailable presence is sent to the server followed by closing the stream . The XMPPConnection can still be used for connecting to the server again . A custom unavailable presence is useful for communicating offline presence information such as On vacation . Typically just the status te...
119,382
protected final void notifyConnectionError ( final Exception exception ) { if ( ! isConnected ( ) ) { LOGGER . log ( Level . INFO , "Connection was already disconnected when attempting to handle " + exception , exception ) ; return ; } ASYNC_BUT_ORDERED . performAsyncButOrdered ( this , ( ) -> { currentConnectionExcept...
Sends out a notification that there was an error with the connection and closes the connection .
119,383
private void firePacketInterceptors ( Stanza packet ) { List < StanzaListener > interceptorsToInvoke = new LinkedList < > ( ) ; synchronized ( interceptors ) { for ( InterceptorWrapper interceptorWrapper : interceptors . values ( ) ) { if ( interceptorWrapper . filterMatches ( packet ) ) { interceptorsToInvoke . add ( ...
Process interceptors . Interceptors may modify the stanza that is about to be sent . Since the thread that requested to send the stanza will invoke all interceptors it is important that interceptors perform their work as soon as possible so that the thread does not remain blocked for a long period .
119,384
protected void processStanza ( final Stanza stanza ) throws InterruptedException { assert ( stanza != null ) ; final SmackDebugger debugger = this . debugger ; if ( debugger != null ) { debugger . onIncomingStreamElement ( stanza ) ; } lastStanzaReceived = System . currentTimeMillis ( ) ; invokeStanzaCollectorsAndNotif...
Processes a stanza after it s been fully parsed by looping through the installed stanza collectors and listeners and letting them examine the stanza to see if they are a match with the filter .
119,385
protected void send ( ComposableBody body ) throws BOSHException { if ( ! connected ) { throw new IllegalStateException ( "Not connected to a server!" ) ; } if ( body == null ) { throw new NullPointerException ( "Body mustn't be null!" ) ; } if ( sessionID != null ) { body = body . rebuild ( ) . setAttribute ( BodyQNam...
Send a HTTP request to the connection manager with the provided body element .
119,386
protected void initDebugger ( ) { writer = new Writer ( ) { public void write ( char [ ] cbuf , int off , int len ) { } public void close ( ) { } public void flush ( ) { } } ; try { readerPipe = new PipedWriter ( ) ; reader = new PipedReader ( readerPipe ) ; } catch ( IOException e ) { } super . initDebugger ( ) ; clie...
Initialize the SmackDebugger which allows to log and debug XML traffic .
119,387
public String toXML ( org . jivesoftware . smack . packet . XmlEnvironment enclosingNamespace ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( '<' ) . append ( getElementName ( ) ) . append ( " xmlns=\"" ) ; buf . append ( getNamespace ( ) ) . append ( "\" " ) ; synchronized ( candidates ) { if ( getCandi...
Return the XML representation for this element .
119,388
public boolean setRosterStore ( RosterStore rosterStore ) { this . rosterStore = rosterStore ; try { reload ( ) ; } catch ( InterruptedException | NotLoggedInException | NotConnectedException e ) { LOGGER . log ( Level . FINER , "Could not reload roster" , e ) ; return false ; } return true ; }
Set the roster store may cause a roster reload .
119,389
public void createItemAndRequestSubscription ( BareJid jid , String name , String [ ] groups ) throws NotLoggedInException , NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { createItem ( jid , name , groups ) ; sendSubscriptionRequest ( jid ) ; }
Creates a new roster entry and presence subscription . The server will asynchronously update the roster with the subscription status .
119,390
public void preApproveAndCreateEntry ( BareJid user , String name , String [ ] groups ) throws NotLoggedInException , NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException , FeatureNotSupportedException { preApprove ( user ) ; createItemAndRequestSubscription ( user , name , groups ) ;...
Creates a new pre - approved roster entry and presence subscription . The server will asynchronously update the roster with the subscription status .
119,391
public void preApprove ( BareJid user ) throws NotLoggedInException , NotConnectedException , InterruptedException , FeatureNotSupportedException { final XMPPConnection connection = connection ( ) ; if ( ! isSubscriptionPreApprovalSupported ( ) ) { throw new FeatureNotSupportedException ( "Pre-approving" ) ; } Presence...
Pre - approve user presence subscription .
119,392
public boolean isSubscriptionPreApprovalSupported ( ) throws NotLoggedInException { final XMPPConnection connection = getAuthenticatedConnectionOrThrow ( ) ; return connection . hasFeature ( SubscriptionPreApproval . ELEMENT , SubscriptionPreApproval . NAMESPACE ) ; }
Check for subscription pre - approval support .
119,393
public boolean removeSubscribeListener ( SubscribeListener subscribeListener ) { boolean removed = subscribeListeners . remove ( subscribeListener ) ; if ( removed && subscribeListeners . isEmpty ( ) ) { setSubscriptionMode ( previousSubscriptionMode ) ; } return removed ; }
Remove a subscribe listener . Also restores the previous subscription mode state if the last listener got removed .
119,394
public Set < RosterEntry > getEntries ( ) { Set < RosterEntry > allEntries ; synchronized ( rosterListenersAndEntriesLock ) { allEntries = new HashSet < > ( entries . size ( ) ) ; for ( RosterEntry entry : entries . values ( ) ) { allEntries . add ( entry ) ; } } return allEntries ; }
Returns a set of all entries in the roster including entries that don t belong to any groups .
119,395
public Presence getPresenceResource ( FullJid userWithResource ) { BareJid key = userWithResource . asBareJid ( ) ; Resourcepart resource = userWithResource . getResourcepart ( ) ; Map < Resourcepart , Presence > userPresences = getPresencesInternal ( key ) ; if ( userPresences == null ) { Presence presence = new Prese...
Returns the presence info for a particular user s resource or unavailable presence if the user is offline or if no presence information is available such as when you are not subscribed to the user s presence updates .
119,396
public List < Presence > getAllPresences ( BareJid bareJid ) { Map < Resourcepart , Presence > userPresences = getPresencesInternal ( bareJid ) ; List < Presence > res ; if ( userPresences == null ) { Presence unavailable = new Presence ( Presence . Type . unavailable ) ; unavailable . setFrom ( bareJid ) ; res = new A...
Returns a List of Presence objects for all of a user s current presences if no presence information is available such as when you are not subscribed to the user s presence updates .
119,397
public boolean iAmSubscribedTo ( Jid jid ) { if ( jid == null ) { return false ; } BareJid bareJid = jid . asBareJid ( ) ; RosterEntry entry = getEntry ( bareJid ) ; if ( entry == null ) { return false ; } return entry . canSeeHisPresence ( ) ; }
Check if the XMPP entity this roster belongs to is subscribed to the presence of the given JID .
119,398
private void setOfflinePresences ( ) { Presence packetUnavailable ; outerloop : for ( Jid user : presenceMap . keySet ( ) ) { Map < Resourcepart , Presence > resources = presenceMap . get ( user ) ; if ( resources != null ) { for ( Resourcepart resource : resources . keySet ( ) ) { packetUnavailable = new Presence ( Pr...
Changes the presence of available contacts offline by simulating an unavailable presence sent from the server .
119,399
private void fireRosterPresenceEvent ( final Presence presence ) { synchronized ( rosterListenersAndEntriesLock ) { for ( RosterListener listener : rosterListeners ) { listener . presenceChanged ( presence ) ; } } }
Fires roster presence changed event to roster listeners .