mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02:00
Smack 4.2.2
-----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAloZnf5fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF IFLcIQgAsTLRI3sWIZDPRuI5YaU/y6beqqzMp5cQgk/9+9DHGBoziLEU1spkvBs2 Yvlwu3NtHSJsI+ibzYLEFRnzEwuW07vXw7R5J+kRSZrsE40z1HCQRwUIXDkPgghe MuL6vT6OV+kLqKb33YLSBuT2fj2pzVE6mRmMsnFekay/weEqOGUZaY9Hd5lJ31/9 33fQC0FQfKULQ5t7PbdfX4dDDNWn0n6v+KjvjaskHI0oA+vqPWxPkj8gNXWW8b72 tVV4h5uXQ0ziK3oED79+GH+DSiET9N2PmsZ7woXiFy5H8KbcQDVe5Pazf+Iq2VQ+ Vi6Vxikr6Ak+v2Xkt+e3x9E6mZDI1w== =CVqq -----END PGP SIGNATURE----- Merge tag '4.2.2' Smack 4.2.2
This commit is contained in:
commit
76a6b9f2a1
16 changed files with 235 additions and 81 deletions
|
@ -61,7 +61,10 @@ import javax.swing.table.DefaultTableModel;
|
|||
import javax.swing.text.BadLocationException;
|
||||
|
||||
import org.jivesoftware.smack.AbstractConnectionListener;
|
||||
import org.jivesoftware.smack.AbstractXMPPConnection;
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionManager;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.debugger.SmackDebugger;
|
||||
|
@ -143,6 +146,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
|||
private JFormattedTextField statusField = null;
|
||||
|
||||
private ConnectionListener connListener = null;
|
||||
private final ReconnectionListener reconnectionListener;
|
||||
|
||||
private Writer writer;
|
||||
private Reader reader;
|
||||
|
@ -169,6 +173,36 @@ public class EnhancedDebugger extends SmackDebugger {
|
|||
public EnhancedDebugger(XMPPConnection connection) {
|
||||
super(connection);
|
||||
|
||||
reconnectionListener = new ReconnectionListener() {
|
||||
@Override
|
||||
public void reconnectingIn(final int seconds) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusField.setValue("Attempt to reconnect in " + seconds + " seconds");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectionFailed(Exception e) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusField.setValue("Reconnection failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (connection instanceof AbstractXMPPConnection) {
|
||||
AbstractXMPPConnection abstractXmppConnection = (AbstractXMPPConnection) connection;
|
||||
ReconnectionManager.getInstanceFor(abstractXmppConnection).addReconnectionListener(reconnectionListener);
|
||||
} else {
|
||||
LOGGER.info("The connection instance " + connection
|
||||
+ " is not an instance of AbstractXMPPConnection, thus we can not install the ReconnectionListener");
|
||||
}
|
||||
|
||||
// We'll arrange the UI into six tabs. The first tab contains all data, the second
|
||||
// client generated XML, the third server generated XML, the fourth allows to send
|
||||
// ad-hoc messages and the fifth contains connection information.
|
||||
|
@ -208,36 +242,6 @@ public class EnhancedDebugger extends SmackDebugger {
|
|||
});
|
||||
|
||||
}
|
||||
@Override
|
||||
public void reconnectingIn(final int seconds) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusField.setValue("Attempt to reconnect in " + seconds + " seconds");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectionSuccessful() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusField.setValue("Reconnection stablished");
|
||||
EnhancedDebuggerWindow.connectionEstablished(EnhancedDebugger.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectionFailed(Exception e) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusField.setValue("Reconnection failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
EnhancedDebuggerWindow.addDebugger(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue