idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
19,400
private XHTMLText appendOpenBodyTag ( String style , String lang ) { text . halfOpenElement ( Message . BODY ) ; text . xmlnsAttribute ( NAMESPACE ) ; text . optElement ( STYLE , style ) ; text . xmllangAttribute ( lang ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that indicates that a body section begins .
19,401
public XHTMLText appendOpenHeaderTag ( int level , String style ) { if ( level > 3 || level < 1 ) { throw new IllegalArgumentException ( "Level must be between 1 and 3" ) ; } text . halfOpenElement ( H + Integer . toString ( level ) ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ...
Appends a tag that indicates a header a title of a section of the message .
19,402
public XHTMLText appendCloseHeaderTag ( int level ) { if ( level > 3 || level < 1 ) { throw new IllegalArgumentException ( "Level must be between 1 and 3" ) ; } text . closeElement ( H + Integer . toBinaryString ( level ) ) ; return this ; }
Appends a tag that indicates that a header section ends .
19,403
public XHTMLText appendImageTag ( String align , String alt , String height , String src , String width ) { text . halfOpenElement ( IMG ) ; text . optAttribute ( "align" , align ) ; text . optAttribute ( "alt" , alt ) ; text . optAttribute ( "height" , height ) ; text . optAttribute ( "src" , src ) ; text . optAttribu...
Appends a tag that indicates an image .
19,404
public XHTMLText appendLineItemTag ( String style ) { text . halfOpenElement ( LI ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that indicates the start of a new line item within a list .
19,405
public XHTMLText appendOpenOrderedListTag ( String style ) { text . halfOpenElement ( OL ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that creates an ordered list . Ordered means that the order of the items in the list is important . To show this browsers automatically number the list .
19,406
public XHTMLText appendOpenUnorderedListTag ( String style ) { text . halfOpenElement ( UL ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that creates an unordered list . The unordered part means that the items in the list are not in any particular order .
19,407
public XHTMLText appendOpenParagraphTag ( String style ) { text . halfOpenElement ( P ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that indicates the start of a new paragraph . This is usually rendered with two carriage returns producing a single blank line in between the two paragraphs .
19,408
public XHTMLText appendOpenInlinedQuoteTag ( String style ) { text . halfOpenElement ( Q ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that indicates that an inlined quote section begins .
19,409
public XHTMLText appendOpenSpanTag ( String style ) { text . halfOpenElement ( SPAN ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; }
Appends a tag that allows to set the fonts for a span of text .
19,410
public List < Subscription > getSubscriptions ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return getSubscriptions ( null , null ) ; }
Get the subscriptions currently associated with this node .
19,411
public List < Subscription > getSubscriptionsAsOwner ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return getSubscriptionsAsOwner ( null , null ) ; }
Get the subscriptions currently associated with this node as owner .
19,412
public List < Affiliation > getAffiliations ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return getAffiliations ( null , null ) ; }
Get the affiliations of this node .
19,413
public List < Affiliation > getAffiliationsAsOwner ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { return getAffiliationsAsOwner ( null , null ) ; }
Retrieve the affiliation list for this node as owner .
19,414
public Subscription subscribe ( String jid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { PubSub pubSub = createPubsubPacket ( Type . set , new SubscribeExtension ( jid , getId ( ) ) ) ; PubSub reply = sendPubsubPacket ( pubSub ) ; return reply . getExtension ( PubSub...
The user subscribes to the node using the supplied jid . The bare jid portion of this one must match the jid for the connection .
19,415
public Subscription subscribe ( String jid , SubscribeForm subForm ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { PubSub request = createPubsubPacket ( Type . set , new SubscribeExtension ( jid , getId ( ) ) ) ; request . addExtension ( new FormNode ( FormNodeType . O...
The user subscribes to the node using the supplied jid and subscription options . The bare jid portion of this one must match the jid for the connection .
19,416
public void unsubscribe ( String jid , String subscriptionId ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { sendPubsubPacket ( createPubsubPacket ( Type . set , new UnsubscribeExtension ( jid , getId ( ) , subscriptionId ) ) ) ; }
Remove the specific subscription related to the specified JID .
19,417
public SubscribeForm getSubscriptionOptions ( String jid , String subscriptionId ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { PubSub packet = sendPubsubPacket ( createPubsubPacket ( Type . get , new OptionsExtension ( jid , getId ( ) , subscriptionId ) ) ) ; FormNod...
Get the options for configuring the specified subscription .
19,418
@ SuppressWarnings ( "unchecked" ) public void addItemEventListener ( @ SuppressWarnings ( "rawtypes" ) ItemEventListener listener ) { StanzaListener conListener = new ItemEventTranslator ( listener ) ; itemEventToListenerMap . put ( listener , conListener ) ; pubSubManager . getConnection ( ) . addSyncStanzaListener (...
Register a listener for item publication events . This listener will get called whenever an item is published to this node .
19,419
public void removeItemEventListener ( @ SuppressWarnings ( "rawtypes" ) ItemEventListener listener ) { StanzaListener conListener = itemEventToListenerMap . remove ( listener ) ; if ( conListener != null ) pubSubManager . getConnection ( ) . removeSyncStanzaListener ( conListener ) ; }
Unregister a listener for publication events .
19,420
public void addConfigurationListener ( NodeConfigListener listener ) { StanzaListener conListener = new NodeConfigTranslator ( listener ) ; configEventToListenerMap . put ( listener , conListener ) ; pubSubManager . getConnection ( ) . addSyncStanzaListener ( conListener , new EventContentFilter ( EventElementType . co...
Register a listener for configuration events . This listener will get called whenever the node s configuration changes .
19,421
public void removeConfigurationListener ( NodeConfigListener listener ) { StanzaListener conListener = configEventToListenerMap . remove ( listener ) ; if ( conListener != null ) pubSubManager . getConnection ( ) . removeSyncStanzaListener ( conListener ) ; }
Unregister a listener for configuration events .
19,422
public void addItemDeleteListener ( ItemDeleteListener listener ) { StanzaListener delListener = new ItemDeleteTranslator ( listener ) ; itemDeleteToListenerMap . put ( listener , delListener ) ; EventContentFilter deleteItem = new EventContentFilter ( EventElementType . items . toString ( ) , "retract" ) ; EventConten...
Register an listener for item delete events . This listener gets called whenever an item is deleted from the node .
19,423
public void removeItemDeleteListener ( ItemDeleteListener listener ) { StanzaListener conListener = itemDeleteToListenerMap . remove ( listener ) ; if ( conListener != null ) pubSubManager . getConnection ( ) . removeSyncStanzaListener ( conListener ) ; }
Unregister a listener for item delete events .
19,424
private void setAcceptedLocalCandidate ( TransportCandidate bestLocalCandidate ) { for ( int i = 0 ; i < resolver . getCandidateCount ( ) ; i ++ ) { if ( resolver . getCandidate ( i ) . getIp ( ) . equals ( bestLocalCandidate . getIp ( ) ) && resolver . getCandidate ( i ) . getPort ( ) == bestLocalCandidate . getPort (...
Set the best local transport candidate we have offered and accepted by the other endpoint .
19,425
protected void doStart ( ) { try { sendTransportCandidatesOffer ( ) ; setNegotiatorState ( JingleNegotiatorState . PENDING ) ; } catch ( Exception e ) { LOGGER . log ( Level . WARNING , "exception" , e ) ; } }
Called from above to start the negotiator during a session - initiate .
19,426
private void addRemoteCandidate ( TransportCandidate rc ) { if ( rc != null ) { if ( acceptableTransportCandidate ( rc , offeredCandidates ) ) { synchronized ( remoteCandidates ) { remoteCandidates . add ( rc ) ; } checkRemoteCandidate ( rc ) ; } } }
Add a remote candidate to the list . The candidate will be checked in order to verify if it is usable .
19,427
private void checkRemoteCandidate ( final TransportCandidate offeredCandidate ) { offeredCandidate . addListener ( new TransportResolverListener . Checker ( ) { public void candidateChecked ( TransportCandidate cand , final boolean validCandidate ) { if ( validCandidate ) { if ( getNegotiatorState ( ) == JingleNegotiat...
Check asynchronously the new transport candidate .
19,428
private void addValidRemoteCandidate ( TransportCandidate remoteCandidate ) { if ( remoteCandidate != null ) { synchronized ( validRemoteCandidates ) { LOGGER . fine ( "Added valid candidate: " + remoteCandidate . getIp ( ) + ":" + remoteCandidate . getPort ( ) ) ; validRemoteCandidates . add ( remoteCandidate ) ; } } ...
Add a valid remote candidate to the list . The remote candidate has been checked and the remote
19,429
private List < TransportCandidate > obtainCandidatesList ( Jingle jingle ) { List < TransportCandidate > result = new ArrayList < > ( ) ; if ( jingle != null ) { for ( JingleContent jingleContent : jingle . getContentsList ( ) ) { if ( jingleContent . getName ( ) . equals ( parentNegotiator . getName ( ) ) ) { for ( Ji...
Parse the list of transport candidates from a Jingle packet .
19,430
private synchronized void sendTransportCandidateOffer ( TransportCandidate cand ) throws NotConnectedException , InterruptedException { if ( ! cand . isNull ( ) ) { addOfferedCandidate ( cand ) ; JingleContent content = parentNegotiator . getJingleContent ( ) ; content . addJingleTransport ( getJingleTransport ( cand )...
Send an offer for a transport candidate
19,431
private void sendTransportCandidatesOffer ( ) throws XMPPException , SmackException , InterruptedException { List < TransportCandidate > notOffered = resolver . getCandidatesList ( ) ; notOffered . removeAll ( offeredCandidates ) ; for ( Object aNotOffered : notOffered ) { sendTransportCandidateOffer ( ( TransportCandi...
Create a Jingle stanza where we announce our transport candidates .
19,432
private IQ receiveContentAcceptAction ( Jingle jingle ) throws XMPPException { IQ response = null ; List < TransportCandidate > accepted = obtainCandidatesList ( jingle ) ; if ( ! accepted . isEmpty ( ) ) { for ( TransportCandidate cand : accepted ) { LOGGER . fine ( "Remote accepted candidate addr: " + cand . getIp ( ...
One of our transport candidates has been accepted .
19,433
private void triggerTransportEstablished ( TransportCandidate local , TransportCandidate remote ) throws NotConnectedException , InterruptedException { List < JingleListener > listeners = getListenersList ( ) ; for ( JingleListener li : listeners ) { if ( li instanceof JingleTransportListener ) { JingleTransportListene...
Trigger a Transport session established event .
19,434
private void triggerTransportClosed ( TransportCandidate cand ) { List < JingleListener > listeners = getListenersList ( ) ; for ( JingleListener li : listeners ) { if ( li instanceof JingleTransportListener ) { JingleTransportListener mli = ( JingleTransportListener ) li ; mli . transportClosed ( cand ) ; } } }
Trigger a Transport closed event .
19,435
public synchronized void cancel ( ) { if ( cancelled ) { return ; } cancelled = true ; connection . removeStanzaCollector ( this ) ; notifyAll ( ) ; if ( collectorToReset != null ) { collectorToReset . cancel ( ) ; } }
Explicitly cancels the stanza collector so that no more results are queued up . Once a stanza collector has been cancelled it cannot be re - enabled . Instead a new stanza collector must be created .
19,436
public List < Stanza > getCollectedStanzasAfterCancelled ( ) { if ( ! cancelled ) { throw new IllegalStateException ( "Stanza collector was not yet cancelled" ) ; } if ( collectedCache == null ) { collectedCache = new ArrayList < > ( getCollectedCount ( ) ) ; collectedCache . addAll ( resultQueue ) ; } return collected...
Return a list of all collected stanzas . This method must be invoked after the collector has been cancelled .
19,437
protected void processStanza ( Stanza packet ) { if ( packetFilter == null || packetFilter . accept ( packet ) ) { synchronized ( this ) { if ( resultQueue . size ( ) == maxQueueSize ) { Stanza rolledOverStanza = resultQueue . poll ( ) ; assert rolledOverStanza != null ; } resultQueue . add ( packet ) ; notifyAll ( ) ;...
Processes a stanza to see if it meets the criteria for this stanza collector . If so the stanza is added to the result queue .
19,438
public static void onCreate ( Context context ) { sContext = context ; context . registerReceiver ( ALARM_BROADCAST_RECEIVER , new IntentFilter ( PING_ALARM_ACTION ) ) ; sAlarmManager = ( AlarmManager ) context . getSystemService ( Context . ALARM_SERVICE ) ; sPendingIntent = PendingIntent . getBroadcast ( context , 0 ...
Register a pending intent with the AlarmManager to be broadcasted every half hour and register the alarm broadcast receiver to receive this intent . The receiver will check all known questions if a ping is Necessary when invoked by the alarm intent .
19,439
public synchronized Collection < String > getNames ( ) { if ( map == null ) { return Collections . emptySet ( ) ; } return Collections . unmodifiableSet ( new HashMap < String , String > ( map ) . keySet ( ) ) ; }
Returns an unmodifiable collection of the names that can be used to get values of the stanza extension .
19,440
public synchronized String getValue ( String name ) { if ( map == null ) { return null ; } return map . get ( name ) ; }
Returns a stanza extension value given a name .
19,441
public synchronized void setValue ( String name , String value ) { if ( map == null ) { map = new HashMap < String , String > ( ) ; } map . put ( name , value ) ; }
Sets a stanza extension value using the given name .
19,442
public void rootWindowClosing ( WindowEvent evt ) { ( ( ObservableReader ) reader ) . removeReaderListener ( readerListener ) ; ( ( ObservableWriter ) writer ) . removeWriterListener ( writerListener ) ; }
Notification that the root window is closing . Stop listening for received and transmitted packets .
19,443
protected static String generateSessionId ( ) { return String . valueOf ( randomGenerator . nextInt ( Integer . MAX_VALUE ) + randomGenerator . nextInt ( Integer . MAX_VALUE ) ) ; }
Generate a unique session ID .
19,444
public void setSessionState ( JingleSessionState stateIs ) { LOGGER . fine ( "Session state change: " + sessionState + "->" + stateIs ) ; stateIs . enter ( ) ; sessionState = stateIs ; }
Validate the state changes .
19,445
public boolean isFullyEstablished ( ) { boolean result = true ; for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( ! contentNegotiator . isFullyEstablished ( ) ) result = false ; } return result ; }
Return true if all of the media managers have finished .
19,446
public synchronized void receivePacketAndRespond ( IQ iq ) throws XMPPException , SmackException , InterruptedException { List < IQ > responses = new ArrayList < > ( ) ; String responseId ; LOGGER . fine ( "Packet: " + iq . toXML ( ) ) ; try { responses . addAll ( dispatchIncomingPacket ( iq , null ) ) ; if ( iq != nul...
Process and respond to an incoming packet . This method is called from the stanza listener dispatcher when a new stanza has arrived . The method is responsible for recognizing the stanza type and depending on the current state delivering it to the right event handler and wait for a response . The response will be anoth...
19,447
public Jingle sendFormattedJingle ( IQ iq , Jingle jout ) throws NotConnectedException , InterruptedException { if ( jout != null ) { if ( jout . getInitiator ( ) == null ) { jout . setInitiator ( getInitiator ( ) ) ; } if ( jout . getResponder ( ) == null ) { jout . setResponder ( getResponder ( ) ) ; } if ( jout . ge...
Complete and send a packet . Complete all the null fields in a Jingle reponse using the session information we have or some info from the incoming packet .
19,448
public IQ createAck ( IQ iq ) { IQ result = null ; if ( iq != null ) { if ( iq . getType ( ) . equals ( IQ . Type . set ) ) { IQ ack = IQ . createResultIQ ( iq ) ; result = ack ; } } return result ; }
Acknowledge a IQ packet .
19,449
public static synchronized JingleSession getInstanceFor ( XMPPConnection con ) { if ( con == null ) { throw new IllegalArgumentException ( "XMPPConnection cannot be null" ) ; } JingleSession result = null ; synchronized ( sessions ) { if ( sessions . containsKey ( con ) ) { result = sessions . get ( con ) ; } } return ...
Returns the JingleSession related to a particular connection .
19,450
private void installConnectionListeners ( final XMPPConnection connection ) { if ( connection != null ) { connectionListener = new AbstractConnectionClosedListener ( ) { public void connectionTerminated ( ) { unregisterInstanceFor ( connection ) ; } } ; connection . addConnectionListener ( connectionListener ) ; } }
Configure a session setting some action listeners ...
19,451
protected void updatePacketListener ( ) { removeAsyncPacketListener ( ) ; LOGGER . fine ( "UpdatePacketListener" ) ; packetListener = new StanzaListener ( ) { public void processStanza ( Stanza packet ) { try { receivePacketAndRespond ( ( IQ ) packet ) ; } catch ( Exception e ) { LOGGER . log ( Level . WARNING , "excep...
Install the stanza listener . The listener is responsible for responding to any stanza that we receive ...
19,452
public void addMediaListener ( JingleMediaListener li ) { for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( contentNegotiator . getMediaNegotiator ( ) != null ) { contentNegotiator . getMediaNegotiator ( ) . addListener ( li ) ; } } }
Add a listener for jmf negotiation events .
19,453
public void removeMediaListener ( JingleMediaListener li ) { for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( contentNegotiator . getMediaNegotiator ( ) != null ) { contentNegotiator . getMediaNegotiator ( ) . removeListener ( li ) ; } } }
Remove a listener for jmf negotiation events .
19,454
public void addTransportListener ( JingleTransportListener li ) { for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( contentNegotiator . getTransportNegotiator ( ) != null ) { contentNegotiator . getTransportNegotiator ( ) . addListener ( li ) ; } } }
Add a listener for transport negotiation events .
19,455
public void removeTransportListener ( JingleTransportListener li ) { for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( contentNegotiator . getTransportNegotiator ( ) != null ) { contentNegotiator . getTransportNegotiator ( ) . removeListener ( li ) ; } } }
Remove a listener for transport negotiation events .
19,456
public void setupListeners ( ) { JingleMediaListener jingleMediaListener = new JingleMediaListener ( ) { public void mediaClosed ( PayloadType cand ) { } public void mediaEstablished ( PayloadType pt ) throws NotConnectedException , InterruptedException { if ( isFullyEstablished ( ) ) { Jingle jout = new Jingle ( Jingl...
Setup the listeners that act on events coming from the lower level negotiators .
19,457
protected void triggerSessionClosed ( String reason ) { List < JingleListener > listeners = getListenersList ( ) ; for ( JingleListener li : listeners ) { if ( li instanceof JingleSessionListener ) { JingleSessionListener sli = ( JingleSessionListener ) li ; sli . sessionClosed ( reason , this ) ; } } close ( ) ; }
Trigger a session closed event .
19,458
protected void triggerSessionClosedOnError ( XMPPException exc ) { for ( ContentNegotiator contentNegotiator : contentNegotiators ) { contentNegotiator . stopJingleMediaSession ( ) ; for ( TransportCandidate candidate : contentNegotiator . getTransportNegotiator ( ) . getOfferedCandidates ( ) ) candidate . removeCandid...
Trigger a session closed event due to an error .
19,459
protected void triggerMediaReceived ( String participant ) { List < JingleListener > listeners = getListenersList ( ) ; for ( JingleListener li : listeners ) { if ( li instanceof JingleSessionListener ) { JingleSessionListener sli = ( JingleSessionListener ) li ; sli . sessionMediaReceived ( this , participant ) ; } } ...
Trigger a media received event .
19,460
public void terminate ( String reason ) throws XMPPException , NotConnectedException , InterruptedException { if ( isClosed ( ) ) return ; LOGGER . fine ( "Terminate " + reason ) ; Jingle jout = new Jingle ( JingleActionEnum . SESSION_TERMINATE ) ; jout . setType ( IQ . Type . set ) ; sendStanza ( jout ) ; triggerSessi...
Terminates the session with a custom reason .
19,461
public void close ( ) { if ( isClosed ( ) ) return ; setSessionState ( JingleSessionStateEnded . getInstance ( ) ) ; for ( ContentNegotiator contentNegotiator : contentNegotiators ) { contentNegotiator . stopJingleMediaSession ( ) ; for ( TransportCandidate candidate : contentNegotiator . getTransportNegotiator ( ) . g...
Terminate negotiations .
19,462
public IQ createJingleError ( IQ iq , JingleError jingleError ) { IQ errorPacket = null ; if ( jingleError != null ) { StanzaError . Builder builder = StanzaError . getBuilder ( StanzaError . Condition . undefined_condition ) ; builder . addExtension ( jingleError ) ; errorPacket = IQ . createErrorResponse ( iq , build...
Complete and send an error . Complete all the null fields in an IQ error response using the session information we have or some info from the incoming packet .
19,463
public void startOutgoing ( ) throws IllegalStateException , SmackException , InterruptedException { updatePacketListener ( ) ; setSessionState ( JingleSessionStatePending . getInstance ( ) ) ; Jingle jingle = new Jingle ( JingleActionEnum . SESSION_INITIATE ) ; for ( JingleMediaManager mediaManager : getMediaManagers ...
This is the starting point for intitiating a new session .
19,464
private void startNegotiators ( ) { for ( ContentNegotiator contentNegotiator : contentNegotiators ) { TransportNegotiator transNeg = contentNegotiator . getTransportNegotiator ( ) ; transNeg . start ( ) ; } }
When we initiate a session we need to start a bunch of negotiators right after we receive the result stanza for our session - initiate . This is where we start them .
19,465
public Presence cloneWithNewId ( ) { Presence clone = clone ( ) ; clone . setStanzaId ( StanzaIdUtil . newStanzaId ( ) ) ; return clone ; }
Clone this presence and set a newly generated stanza ID as the clone s ID .
19,466
public synchronized OutputStream sendFile ( String fileName , long fileSize , String description ) throws XMPPException , SmackException , InterruptedException { if ( isDone ( ) || outputStream != null ) { throw new IllegalStateException ( "The negotiation process has already" + " been attempted on this file transfer" ...
This method handles the negotiation of the file transfer and the stream it only returns the created stream after the negotiation has been completed .
19,467
public static void registerSASLMechanism ( SASLMechanism mechanism ) { synchronized ( REGISTERED_MECHANISMS ) { REGISTERED_MECHANISMS . add ( mechanism ) ; Collections . sort ( REGISTERED_MECHANISMS ) ; } }
Registers a new SASL mechanism .
19,468
public static Map < String , String > getRegisterdSASLMechanisms ( ) { Map < String , String > answer = new LinkedHashMap < > ( ) ; synchronized ( REGISTERED_MECHANISMS ) { for ( SASLMechanism mechanism : REGISTERED_MECHANISMS ) { answer . put ( mechanism . getClass ( ) . getName ( ) , mechanism . toString ( ) ) ; } } ...
Returns the registered SASLMechanism sorted by the level of preference .
19,469
public static boolean unregisterSASLMechanism ( String clazz ) { synchronized ( REGISTERED_MECHANISMS ) { Iterator < SASLMechanism > it = REGISTERED_MECHANISMS . iterator ( ) ; while ( it . hasNext ( ) ) { SASLMechanism mechanism = it . next ( ) ; if ( mechanism . getClass ( ) . getName ( ) . equals ( clazz ) ) { it . ...
Unregister a SASLMechanism by it s full class name . For example org . jivesoftware . smack . sasl . javax . SASLCramMD5Mechanism .
19,470
public void challengeReceived ( String challenge , boolean finalChallenge ) throws SmackSaslException , NotConnectedException , InterruptedException { try { currentMechanism . challengeReceived ( challenge , finalChallenge ) ; } catch ( InterruptedException | SmackSaslException | NotConnectedException e ) { authenticat...
The server is challenging the SASL authentication we just sent . Forward the challenge to the current SASLMechanism we are using . The SASLMechanism will eventually send a response to the server . The length of the challenge - response sequence varies according to the SASLMechanism in use .
19,471
public void authenticated ( Success success ) throws SmackException , InterruptedException { if ( success . getData ( ) != null ) { challengeReceived ( success . getData ( ) , true ) ; } currentMechanism . checkIfSuccessfulOrThrow ( ) ; authenticationSuccessful = true ; synchronized ( this ) { notify ( ) ; } }
Notification message saying that SASL authentication was successful . The next step would be to bind the resource .
19,472
public void addAddress ( Type type , Jid jid , String node , String desc , boolean delivered , String uri ) { Address address = new Address ( type ) ; address . setJid ( jid ) ; address . setNode ( node ) ; address . setDescription ( desc ) ; address . setDelivered ( delivered ) ; address . setUri ( uri ) ; addresses ....
Adds a new address to which the stanza is going to be sent or was sent .
19,473
public void publish ( Item item , String node ) throws NotConnectedException , InterruptedException , NoResponseException , XMPPErrorException , NotAPubSubNodeException , NotALeafNodeException { LeafNode pubSubNode = pepPubSubManager . getLeafNode ( node ) ; pubSubNode . publish ( item ) ; }
Publish an event .
19,474
public void addTransports ( final List < JingleTransport > transports ) { synchronized ( transports ) { for ( JingleTransport transport : transports ) { addJingleTransport ( transport ) ; } } }
Adds a list of transports to add to the packet .
19,475
public RemoteCommand getRemoteCommand ( Jid jid , String node ) { return new RemoteCommand ( connection ( ) , node , jid ) ; }
Returns a command that represents an instance of a command in a remote host . It is used to execute remote commands . The concept is similar to RMI . Every invocation on this command is equivalent to an invocation in the remote command .
19,476
private static IQ respondError ( AdHocCommandData response , StanzaError . Builder error ) { response . setType ( IQ . Type . error ) ; response . setError ( error ) ; return response ; }
Responds an error with an specific error .
19,477
private LocalCommand newInstanceOfCmd ( String commandNode , String sessionID ) throws XMPPErrorException , InstantiationException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException { AdHocCommandInfo commandInfo = commands . get ( commandNode ) ;...
Creates a new instance of a command to be used by a new execution request
19,478
public synchronized Set < String > getNames ( ) { if ( map == null ) { return Collections . emptySet ( ) ; } return Collections . unmodifiableSet ( map . keySet ( ) ) ; }
Returns a Set of the names that can be used to get values of the private data .
19,479
public boolean isFullyEstablished ( ) { boolean result = true ; MediaNegotiator mediaNeg = getMediaNegotiator ( ) ; if ( ( mediaNeg == null ) || ! mediaNeg . isFullyEstablished ( ) ) { result = false ; } TransportNegotiator transNeg = getTransportNegotiator ( ) ; if ( ( transNeg == null ) || ! transNeg . isFullyEstabli...
Return true if the transport and content negotiators have finished .
19,480
public JingleNegotiatorState getNegotiatorState ( ) { JingleNegotiatorState result = JingleNegotiatorState . PENDING ; if ( ( mediaNeg != null ) && ( transNeg != null ) ) { if ( ( mediaNeg . getNegotiatorState ( ) == JingleNegotiatorState . SUCCEEDED ) || ( transNeg . getNegotiatorState ( ) == JingleNegotiatorState . S...
The negotiator state for the ContentNegotiators is a special case . It is a roll - up of the sub - negotiator states .
19,481
public static Boolean getBooleanAttribute ( XmlPullParser parser , String name ) { String valueString = parser . getAttributeValue ( "" , name ) ; if ( valueString == null ) return null ; valueString = valueString . toLowerCase ( Locale . US ) ; return parseXmlBoolean ( valueString ) ; }
Get the boolean value of an argument .
19,482
public String getAttributes ( ) { StringBuilder str = new StringBuilder ( ) ; if ( getSid ( ) != null ) str . append ( " sid='" ) . append ( getSid ( ) ) . append ( '\'' ) ; if ( getPass ( ) != null ) str . append ( " pass='" ) . append ( getPass ( ) ) . append ( '\'' ) ; if ( getPortA ( ) != - 1 ) str . append ( " por...
Get the attributes string .
19,483
protected IQChildElementXmlStringBuilder getIQChildElementBuilder ( IQChildElementXmlStringBuilder str ) { str . attribute ( "sid" , sid ) ; str . rightAngleBracket ( ) ; if ( bridgeAction . equals ( BridgeAction . create ) ) str . append ( "<candidate/>" ) ; else if ( bridgeAction . equals ( BridgeAction . change ) ) ...
Get the Child Element XML of the Packet
19,484
@ SuppressWarnings ( "deprecation" ) public static RTPBridge getRTPBridge ( XMPPConnection connection , String sessionID ) throws NotConnectedException , InterruptedException { if ( ! connection . isConnected ( ) ) { return null ; } RTPBridge rtpPacket = new RTPBridge ( sessionID ) ; rtpPacket . setTo ( RTPBridge . NAM...
Get a new RTPBridge Candidate from the server . If a error occurs or the server don t support RTPBridge Service null is returned .
19,485
@ SuppressWarnings ( "deprecation" ) public static String getPublicIP ( XMPPConnection xmppConnection ) throws NotConnectedException , InterruptedException { if ( ! xmppConnection . isConnected ( ) ) { return null ; } RTPBridge rtpPacket = new RTPBridge ( RTPBridge . BridgeAction . publicip ) ; rtpPacket . setTo ( RTPB...
Get Public Address from the Server .
19,486
public synchronized String start ( ) { if ( started ) return null ; String result = createProcessor ( ) ; if ( result != null ) { started = false ; } result = createTransmitter ( ) ; if ( result != null ) { processor . close ( ) ; processor = null ; started = false ; } else { started = true ; } processor . start ( ) ; ...
Starts the transmission . Returns null if transmission started ok . Otherwise it returns a string with the reason why the setup failed . Starts receive also .
19,487
public void stop ( ) { if ( ! started ) return ; synchronized ( this ) { try { started = false ; if ( processor != null ) { processor . stop ( ) ; processor = null ; for ( RTPManager rtpMgr : rtpMgrs ) { rtpMgr . removeReceiveStreamListener ( audioReceiver ) ; rtpMgr . removeSessionListener ( audioReceiver ) ; rtpMgr ....
Stops the transmission if already started . Stops the receiver also .
19,488
private int getPacketSize ( Format codecFormat , int milliseconds ) throws IllegalArgumentException { String encoding = codecFormat . getEncoding ( ) ; if ( encoding . equalsIgnoreCase ( AudioFormat . GSM ) || encoding . equalsIgnoreCase ( AudioFormat . GSM_RTP ) ) { return milliseconds * 4 ; } else if ( encoding . equ...
Get the best stanza size for a given codec and a codec rate
19,489
private String createTransmitter ( ) { PushBufferDataSource pbds = ( PushBufferDataSource ) dataOutput ; PushBufferStream [ ] pbss = pbds . getStreams ( ) ; rtpMgrs = new RTPManager [ pbss . length ] ; SessionAddress localAddr , destAddr ; InetAddress ipAddr ; SendStream sendStream ; audioReceiver = new AudioReceiver (...
Use the RTPManager API to create sessions for each jmf track of the processor .
19,490
public void setTrasmit ( boolean active ) { for ( SendStream sendStream : sendStreams ) { try { if ( active ) { sendStream . start ( ) ; LOGGER . fine ( "START" ) ; } else { sendStream . stop ( ) ; LOGGER . fine ( "STOP" ) ; } } catch ( IOException e ) { LOGGER . log ( Level . WARNING , "exception" , e ) ; } } }
Set transmit activity . If the active is true the instance should transmit . If it is set to false the instance should pause transmit .
19,491
public void sendGeolocation ( GeoLocation geoLocation ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException , NotALeafNodeException { getNode ( ) . publish ( new PayloadItem < GeoLocation > ( geoLocation ) ) ; }
Send geolocation through the PubSub node .
19,492
public void stopPublishingGeolocation ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException , NotALeafNodeException { GeoLocation emptyGeolocation = new GeoLocation . Builder ( ) . build ( ) ; getNode ( ) . publish ( new PayloadItem < GeoLocation > ( emptyGeolocation ) ) ; }
Send empty geolocation through the PubSub node .
19,493
@ SuppressWarnings ( "unused" ) public void setOmemoStoreBackend ( OmemoStore < T_IdKeyPair , T_IdKey , T_PreKey , T_SigPreKey , T_Sess , T_Addr , T_ECPub , T_Bundle , T_Ciph > omemoStore ) { if ( this . omemoStore != null ) { throw new IllegalStateException ( "An OmemoStore backend has already been set." ) ; } this . ...
Set an omemoStore as backend . Throws an IllegalStateException if there is already a backend set .
19,494
protected OmemoRatchet < T_IdKeyPair , T_IdKey , T_PreKey , T_SigPreKey , T_Sess , T_Addr , T_ECPub , T_Bundle , T_Ciph > getOmemoRatchet ( OmemoManager manager ) { OmemoRatchet < T_IdKeyPair , T_IdKey , T_PreKey , T_SigPreKey , T_Sess , T_Addr , T_ECPub , T_Bundle , T_Ciph > omemoRatchet = omemoRatchets . get ( manage...
Return the deposited instance of the OmemoRatchet for the given manager . If there is none yet create a new one deposit it and return it .
19,495
void init ( OmemoManager . LoggedInOmemoManager managerGuard ) throws InterruptedException , CorruptedOmemoKeyException , XMPPException . XMPPErrorException , SmackException . NotConnectedException , SmackException . NoResponseException , PubSubException . NotALeafNodeException { OmemoManager manager = managerGuard . g...
Initialize OMEMO functionality for OmemoManager omemoManager .
19,496
OmemoElement createRatchetUpdateElement ( OmemoManager . LoggedInOmemoManager managerGuard , OmemoDevice contactsDevice ) throws InterruptedException , SmackException . NoResponseException , CorruptedOmemoKeyException , SmackException . NotConnectedException , CannotEstablishOmemoSessionException , NoSuchAlgorithmExcep...
Create an empty OMEMO message which is used to forward the ratchet of the recipient . This message type is typically used to create stable sessions . Note that trust decisions are ignored for the creation of this message .
19,497
OmemoMessage . Sent createOmemoMessage ( OmemoManager . LoggedInOmemoManager managerGuard , Set < OmemoDevice > contactsDevices , String message ) throws InterruptedException , UndecidedOmemoIdentityException , CryptoFailedException , SmackException . NotConnectedException , SmackException . NoResponseException { byte ...
Create an OmemoMessage .
19,498
private static OmemoBundleElement fetchBundle ( XMPPConnection connection , OmemoDevice contactsDevice ) throws SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException , XMPPException . XMPPErrorException , PubSubException . NotALeafNodeException , PubSubException . NotAPubS...
Retrieve a users OMEMO bundle .
19,499
static void publishBundle ( XMPPConnection connection , OmemoDevice userDevice , OmemoBundleElement bundle ) throws XMPPException . XMPPErrorException , SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException { PubSubManager pm = PubSubManager . getInstanceFor ( connection ,...
Publish the given OMEMO bundle to the server using PubSub .