mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 05:01:12 +01:00
Renamed ConnectionEstablishedListener to ConnectionCreationListener. SMACK-173
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@5388 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
03bb3c1d0a
commit
216971659a
7 changed files with 34 additions and 29 deletions
|
|
@ -35,8 +35,8 @@ public class PrivacyListManager {
|
|||
// Create a new PrivacyListManager on every established connection. In the init()
|
||||
// method of PrivacyListManager, we'll add a listener that will delete the
|
||||
// instance when the connection is closed.
|
||||
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() {
|
||||
public void connectionEstablished(XMPPConnection connection) {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
new PrivacyListManager(connection);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ public class ReconnectionManager implements ConnectionListener {
|
|||
// Create a new PrivacyListManager on every established connection. In the init()
|
||||
// method of PrivacyListManager, we'll add a listener that will delete the
|
||||
// instance when the connection is closed.
|
||||
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() {
|
||||
public void connectionEstablished(XMPPConnection connection) {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
connection.addConnectionListener(new ReconnectionManager(connection));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ public class XMPPConnection {
|
|||
*/
|
||||
public static boolean DEBUG_ENABLED = false;
|
||||
|
||||
private final static Set<ConnectionEstablishedListener> connectionEstablishedListeners =
|
||||
new CopyOnWriteArraySet<ConnectionEstablishedListener>();
|
||||
private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
|
||||
new CopyOnWriteArraySet<ConnectionCreationListener>();
|
||||
|
||||
static {
|
||||
// Use try block since we may not have permission to get a system
|
||||
|
|
@ -812,22 +812,24 @@ public class XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a connection established listener that will be notified when a new connection
|
||||
* is established.
|
||||
* Adds a new listener that will be notified when new XMPPConnections are created. Note
|
||||
* that newly created connections will not be actually connected to the server.
|
||||
*
|
||||
* @param connectionEstablishedListener a listener interested on connection established events.
|
||||
* @param connectionCreationListener a listener interested on new connections.
|
||||
*/
|
||||
public static void addConnectionEstablishedListener(ConnectionEstablishedListener connectionEstablishedListener) {
|
||||
connectionEstablishedListeners.add(connectionEstablishedListener);
|
||||
public static void addConnectionCreationListener(
|
||||
ConnectionCreationListener connectionCreationListener) {
|
||||
connectionEstablishedListeners.add(connectionCreationListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a listener on new established connections.
|
||||
* Removes a listener that was interested in connection creation events.
|
||||
*
|
||||
* @param connectionEstablishedListener a listener interested on connection established events.
|
||||
* @param connectionCreationListener a listener interested on new connections.
|
||||
*/
|
||||
public static void removeConnectionEstablishedListener(ConnectionEstablishedListener connectionEstablishedListener) {
|
||||
connectionEstablishedListeners.remove(connectionEstablishedListener);
|
||||
public static void removeConnectionCreationListener(
|
||||
ConnectionCreationListener connectionCreationListener) {
|
||||
connectionEstablishedListeners.remove(connectionCreationListener);
|
||||
}
|
||||
|
||||
private void connectUsingConfiguration(ConnectionConfiguration config) throws XMPPException {
|
||||
|
|
@ -922,8 +924,8 @@ public class XMPPConnection {
|
|||
|
||||
if (isFirstInitialization) {
|
||||
// Notify listeners that a new connection has been established
|
||||
for (ConnectionEstablishedListener listener : connectionEstablishedListeners) {
|
||||
listener.connectionEstablished(this);
|
||||
for (ConnectionCreationListener listener : connectionEstablishedListeners) {
|
||||
listener.connectionCreated(this);
|
||||
}
|
||||
|
||||
// Add a listener for all message packets so that we can deliver errant
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue