mirror of
https://github.com/igniterealtime/Spark.git
synced 2026-03-01 04:59:51 +00:00
Rewire reconnection listener logic
that got lost in the Smack 4.3 update.
This commit is contained in:
@ -71,7 +71,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
|
||||
public class ContactList extends JPanel implements ActionListener,
|
||||
ContactGroupListener, Plugin, RosterListener, ConnectionListener {
|
||||
ContactGroupListener, Plugin, RosterListener, ConnectionListener, ReconnectionListener {
|
||||
|
||||
private static final long serialVersionUID = -4391111935248627078L;
|
||||
private JPanel mainPanel = new JPanel();
|
||||
@ -241,7 +241,7 @@ public class ContactList extends JPanel implements ActionListener,
|
||||
});
|
||||
|
||||
SparkManager.getConnection().addConnectionListener(this);
|
||||
|
||||
ReconnectionManager.getInstanceFor(SparkManager.getConnection()).addReconnectionListener(this);
|
||||
// Get command panel and add View Online/Offline, Add Contact
|
||||
// StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
||||
|
||||
@ -2509,6 +2509,7 @@ moveToOffline(moveToOfflineContactItem);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectingIn(int i) {
|
||||
|
||||
switch (localPreferences.getReconnectPanelType()) {
|
||||
@ -2545,6 +2546,7 @@ moveToOffline(moveToOfflineContactItem);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectionFailed(Exception exception) {
|
||||
|
||||
switch (localPreferences.getReconnectPanelType()) {
|
||||
|
||||
@ -19,6 +19,8 @@ import org.jivesoftware.fastpath.resources.FastpathRes;
|
||||
import org.jivesoftware.fastpath.workspace.Workpane;
|
||||
import org.jivesoftware.fastpath.workspace.panes.BackgroundPane;
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionManager;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
@ -251,21 +253,6 @@ public class FastpathPlugin implements Plugin, ConnectionListener {
|
||||
@Override
|
||||
public void authenticated( XMPPConnection xmppConnection, boolean b )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void connectionClosed() {
|
||||
lostConnection();
|
||||
}
|
||||
|
||||
public void connectionClosedOnError(Exception e) {
|
||||
lostConnection();
|
||||
}
|
||||
|
||||
public void reconnectingIn(int seconds) {
|
||||
}
|
||||
|
||||
public void reconnectionSuccessful() {
|
||||
// Rejoin the workgroup after 15 seconds.
|
||||
final TimerTask rejoinTask = new SwingTimerTask() {
|
||||
public void doRun() {
|
||||
@ -278,7 +265,12 @@ public class FastpathPlugin implements Plugin, ConnectionListener {
|
||||
TaskEngine.getInstance().schedule(rejoinTask, 15000);
|
||||
}
|
||||
|
||||
public void reconnectionFailed(Exception e) {
|
||||
public void connectionClosed() {
|
||||
lostConnection();
|
||||
}
|
||||
|
||||
public void connectionClosedOnError(Exception e) {
|
||||
lostConnection();
|
||||
}
|
||||
|
||||
private void lostConnection() {
|
||||
|
||||
@ -362,18 +362,4 @@ public class JinglePlugin implements Plugin, Phone, ConnectionListener {
|
||||
public void connectionClosedOnError(Exception e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectingIn(int seconds) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectionSuccessful() {
|
||||
// Add Jingle to discovered items list.
|
||||
SparkManager.addFeature(JINGLE_NAMESPACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnectionFailed(Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ import net.java.sipmack.softphone.listeners.RegisterEvent;
|
||||
import net.java.sipmack.softphone.listeners.SoftPhoneListener;
|
||||
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionManager;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.roster.Roster;
|
||||
import org.jivesoftware.smack.roster.RosterEntry;
|
||||
@ -131,13 +133,22 @@ public class SoftPhonePlugin implements Plugin, SoftPhoneListener {
|
||||
TaskEngine.getInstance().schedule(registerTask, 15000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosed() {
|
||||
//softPhone.handleUnregisterRequest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosedOnError(Exception exception) {
|
||||
softPhone.handleUnregisterRequest();
|
||||
}
|
||||
});
|
||||
|
||||
ReconnectionManager.getInstanceFor(SparkManager.getConnection()).addReconnectionListener(new ReconnectionListener() {
|
||||
|
||||
@Override
|
||||
public void reconnectionFailed(Exception e) {
|
||||
}
|
||||
|
||||
public void reconnectingIn(int i) {
|
||||
// Wait a bit before registering
|
||||
@ -149,15 +160,7 @@ public class SoftPhonePlugin implements Plugin, SoftPhoneListener {
|
||||
|
||||
TaskEngine.getInstance().schedule(registerTask, 15000);
|
||||
}
|
||||
|
||||
public void reconnectionSuccessful() {
|
||||
}
|
||||
|
||||
public void reconnectionFailed(Exception exception) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,4 +278,4 @@ public class SoftPhonePlugin implements Plugin, SoftPhoneListener {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user