@Override public void LogoffUser() { if (connection == null) return; if (connection.isConnected() == true) { connection.disconnect(); } }
@Override public void SendMessage(String name, String message) { if (connection == null) return; if (connection.isConnected() == true) { Chat chat = connection .getChatManager() .createChat( name + "@" + serverName, new MessageListener() { public void processMessage(Chat chat, Message message) { System.out.println("Received message: " + message); System.out.println( "message body:" + message != null ? message.getBody() : "NULL"); } }); try { chat.sendMessage(message); this.sessionMessage.add("send to:`" + name + "` message:" + message); } catch (XMPPException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
@Override public boolean isConnected() throws RemoteException { if (connection != null) { return connection.isConnected(); } return false; }
/** * Returns the file transfer negotiator related to a particular connection. When this class is * requested on a particular connection the file transfer service is automatically enabled. * * @param connection The connection for which the transfer manager is desired * @return The IMFileTransferManager */ public static FileTransferNegotiator getInstanceFor(final Connection connection) { if (connection == null) { throw new IllegalArgumentException("Connection cannot be null"); } if (!connection.isConnected()) { return null; } if (transferObject.containsKey(connection)) { return transferObject.get(connection); } else { final FileTransferNegotiator transfer = new FileTransferNegotiator(connection); setServiceEnabled(connection, true); transferObject.put(connection, transfer); return transfer; } }
/** * Returns true if the debugger's connection with the server is up and running. * * @return true if the connection with the server is active. */ boolean isConnectionActive() { return connection.isConnected(); }
@Override public void Destroy() { if (connection.isConnected() == true) { connection.disconnect(); } }
/** * Returns true if the reconnection mechanism is enabled. * * @return true if automatic reconnections are allowed. */ private boolean isReconnectionAllowed() { return !done && !connection.isConnected() && connection.isReconnectionAllowed(); }