mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-30 02:02:06 +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
|
||||
|
|
|
@ -75,8 +75,8 @@ public class LastActivityManager {
|
|||
|
||||
// Enable the LastActivity support on every established connection
|
||||
static {
|
||||
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() {
|
||||
public void connectionEstablished(XMPPConnection connection) {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
new LastActivityManager(connection);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -59,8 +59,8 @@ public class ServiceDiscoveryManager {
|
|||
|
||||
// Create a new ServiceDiscoveryManager on every established connection
|
||||
static {
|
||||
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() {
|
||||
public void connectionEstablished(XMPPConnection connection) {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
new ServiceDiscoveryManager(connection);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,11 +20,14 @@
|
|||
|
||||
package org.jivesoftware.smackx;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.jivesoftware.smack.*;
|
||||
import org.jivesoftware.smack.ConnectionCreationListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smackx.packet.*;
|
||||
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.packet.XHTMLExtension;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Manages XHTML formatted texts within messages. A XHTMLManager provides a high level access to
|
||||
|
@ -40,8 +43,8 @@ public class XHTMLManager {
|
|||
// Enable the XHTML support on every established connection
|
||||
// The ServiceDiscoveryManager class should have been already initialized
|
||||
static {
|
||||
XMPPConnection.addConnectionListener(new ConnectionEstablishedListener() {
|
||||
public void connectionEstablished(XMPPConnection connection) {
|
||||
XMPPConnection.addConnectionListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
XHTMLManager.setServiceEnabled(connection, true);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -76,8 +76,8 @@ public class MultiUserChat {
|
|||
private List<PacketListener> connectionListeners = new ArrayList<PacketListener>();
|
||||
|
||||
static {
|
||||
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() {
|
||||
public void connectionEstablished(final XMPPConnection connection) {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(final XMPPConnection connection) {
|
||||
// Set on every established connection that this client supports the Multi-User
|
||||
// Chat protocol. This information will be used when another client tries to
|
||||
// discover whether this client supports MUC or not.
|
||||
|
|
Loading…
Reference in a new issue