mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Improving reconnection logic.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7697 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -261,6 +261,11 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
* @param presence the user to update.
|
||||
*/
|
||||
private void updateUserPresence(Presence presence) throws Exception {
|
||||
if(presence.getError() != null){
|
||||
// We ignore this.
|
||||
return;
|
||||
}
|
||||
|
||||
final Roster roster = SparkManager.getConnection().getRoster();
|
||||
|
||||
final String bareJID = StringUtils.parseBareAddress(presence.getFrom());
|
||||
@ -272,6 +277,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
// If online, check to see if they are in the offline group.
|
||||
// If so, remove from offline group and add to all groups they
|
||||
// belong to.
|
||||
|
||||
if (presence.getType() == Presence.Type.available && offlineGroup.getContactItemByJID(bareJID) != null || (presence.getFrom().indexOf("workgroup.") != -1)) {
|
||||
changeOfflineToOnline(bareJID, entry, presence);
|
||||
}
|
||||
|
||||
@ -41,6 +41,8 @@ public class RetryPanel extends JPanel {
|
||||
private RolloverButton retryButton;
|
||||
private boolean closedOnError = false;
|
||||
|
||||
private boolean connecting;
|
||||
|
||||
/**
|
||||
* Construct the RetryPanel.
|
||||
*/
|
||||
@ -70,6 +72,7 @@ public class RetryPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void attemptReconnection() {
|
||||
connecting = true;
|
||||
retryButton.setText("Attempting...");
|
||||
retryButton.setEnabled(false);
|
||||
|
||||
@ -83,6 +86,7 @@ public class RetryPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void reconnect() {
|
||||
|
||||
try {
|
||||
if (closedOnError) {
|
||||
SparkManager.getConnection().connect();
|
||||
@ -95,6 +99,8 @@ public class RetryPanel extends JPanel {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
connecting = false;
|
||||
|
||||
retryButton.setEnabled(true);
|
||||
retryButton.setText("Reconnect....");
|
||||
}
|
||||
@ -133,6 +139,9 @@ public class RetryPanel extends JPanel {
|
||||
* @param text the text to display on the reconnect button.
|
||||
*/
|
||||
protected void setReconnectText(String text) {
|
||||
if (connecting) {
|
||||
return;
|
||||
}
|
||||
retryButton.setVisible(true);
|
||||
retryButton.setText(text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user