@Override public final String toString() { EntityFullJid localEndpoint = getUser(); String localEndpointString = (localEndpoint == null ? "not-authenticated" : localEndpoint.toString()); return getClass().getSimpleName() + '[' + localEndpointString + "] (" + getConnectionCounter() + ')'; }
@Override public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException { Objects.requireNonNull(stanza, "Stanza must not be null"); assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ); throwNotConnectedExceptionIfAppropriate(); switch (fromMode) { case OMITTED: stanza.setFrom((Jid) null); break; case USER: stanza.setFrom(getUser()); break; case UNCHANGED: default: break; } // Invoke interceptors for the new stanza that is about to be sent. Interceptors may modify // the content of the stanza. firePacketInterceptors(stanza); sendStanzaInternal(stanza); }
/** * Returns our JID if we're connected or <tt>null</tt> otherwise. * * @return our JID if we're connected or <tt>null</tt> otherwise */ public EntityFullJid getOurJid() { return connection != null ? connection.getUser() : null; }
@Override public final String toString() { EntityFullJid localEndpoint = getUser(); String localEndpointString = (localEndpoint == null ? "not-authenticated" : localEndpoint.toString()); return getClass().getSimpleName() + '[' + localEndpointString + "] (" + getConnectionCounter() + ')'; }
/** * Initializes session. * * @param connection the XMPPConnection used in this session. * @param username the agents username. * @param password the agents password. */ public void initializeSession( AbstractXMPPConnection connection, String username, String password) { this.connection = connection; this.username = username; this.password = password; this.userBareAddress = connection.getUser().asEntityBareJid(); // create workgroup session personalDataManager = PrivateDataManager.getInstanceFor( getConnection() ); // Discover items discoverItems(); ProviderManager.addExtensionProvider("event", "http://jabber.org/protocol/disco#info", new Features.Provider()); }
@Override public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException { Objects.requireNonNull(stanza, "Stanza must not be null"); assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ); throwNotConnectedExceptionIfAppropriate(); switch (fromMode) { case OMITTED: stanza.setFrom((Jid) null); break; case USER: stanza.setFrom(getUser()); break; case UNCHANGED: default: break; } // Invoke interceptors for the new stanza that is about to be sent. Interceptors may modify // the content of the stanza. firePacketInterceptors(stanza); sendStanzaInternal(stanza); }
sessionManager.setServerAddress( connection.getXMPPServiceDomain() ); sessionManager.initializeSession( connection, getLoginUsername(), getLoginPassword() ); sessionManager.setJID( connection.getUser() );
" connected (JID: " + connection.getUser() + ")");