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 . getSid ( ) == null ) { jout . setSid ( getSid ( ) ) ; } Jid me = getConnection ( ) . getUser ( ) ; Jid other = getResponder ( ) . equals ( me ) ? getInitiator ( ) : getResponder ( ) ; if ( jout . getTo ( ) == null ) { if ( iq != null ) { jout . setTo ( iq . getFrom ( ) ) ; } else { jout . setTo ( other ) ; } } if ( jout . getFrom ( ) == null ) { if ( iq != null ) { jout . setFrom ( iq . getTo ( ) ) ; } else { jout . setFrom ( me ) ; } } // The the packet. // CHECKSTYLE:OFF if ( ( getConnection ( ) != null ) && getConnection ( ) . isConnected ( ) ) getConnection ( ) . sendStanza ( jout ) ; // CHECKSTYLE:ON } return jout ; }
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 .