1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-16 00:24:49 +02: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:
Gaston Dombiak 2006-09-15 23:05:01 +00:00 committed by gato
parent 03bb3c1d0a
commit 216971659a
7 changed files with 34 additions and 29 deletions

View file

@ -35,8 +35,8 @@ public class PrivacyListManager {
// Create a new PrivacyListManager on every established connection. In the init() // Create a new PrivacyListManager on every established connection. In the init()
// method of PrivacyListManager, we'll add a listener that will delete the // method of PrivacyListManager, we'll add a listener that will delete the
// instance when the connection is closed. // instance when the connection is closed.
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() { XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionEstablished(XMPPConnection connection) { public void connectionCreated(XMPPConnection connection) {
new PrivacyListManager(connection); new PrivacyListManager(connection);
} }
}); });

View file

@ -35,8 +35,8 @@ public class ReconnectionManager implements ConnectionListener {
// Create a new PrivacyListManager on every established connection. In the init() // Create a new PrivacyListManager on every established connection. In the init()
// method of PrivacyListManager, we'll add a listener that will delete the // method of PrivacyListManager, we'll add a listener that will delete the
// instance when the connection is closed. // instance when the connection is closed.
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() { XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionEstablished(XMPPConnection connection) { public void connectionCreated(XMPPConnection connection) {
connection.addConnectionListener(new ReconnectionManager(connection)); connection.addConnectionListener(new ReconnectionManager(connection));
} }
}); });

View file

@ -89,8 +89,8 @@ public class XMPPConnection {
*/ */
public static boolean DEBUG_ENABLED = false; public static boolean DEBUG_ENABLED = false;
private final static Set<ConnectionEstablishedListener> connectionEstablishedListeners = private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
new CopyOnWriteArraySet<ConnectionEstablishedListener>(); new CopyOnWriteArraySet<ConnectionCreationListener>();
static { static {
// Use try block since we may not have permission to get a system // 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 * Adds a new listener that will be notified when new XMPPConnections are created. Note
* is established. * 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) { public static void addConnectionCreationListener(
connectionEstablishedListeners.add(connectionEstablishedListener); 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) { public static void removeConnectionCreationListener(
connectionEstablishedListeners.remove(connectionEstablishedListener); ConnectionCreationListener connectionCreationListener) {
connectionEstablishedListeners.remove(connectionCreationListener);
} }
private void connectUsingConfiguration(ConnectionConfiguration config) throws XMPPException { private void connectUsingConfiguration(ConnectionConfiguration config) throws XMPPException {
@ -922,8 +924,8 @@ public class XMPPConnection {
if (isFirstInitialization) { if (isFirstInitialization) {
// Notify listeners that a new connection has been established // Notify listeners that a new connection has been established
for (ConnectionEstablishedListener listener : connectionEstablishedListeners) { for (ConnectionCreationListener listener : connectionEstablishedListeners) {
listener.connectionEstablished(this); listener.connectionCreated(this);
} }
// Add a listener for all message packets so that we can deliver errant // Add a listener for all message packets so that we can deliver errant

View file

@ -75,8 +75,8 @@ public class LastActivityManager {
// Enable the LastActivity support on every established connection // Enable the LastActivity support on every established connection
static { static {
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() { XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionEstablished(XMPPConnection connection) { public void connectionCreated(XMPPConnection connection) {
new LastActivityManager(connection); new LastActivityManager(connection);
} }
}); });

View file

@ -59,8 +59,8 @@ public class ServiceDiscoveryManager {
// Create a new ServiceDiscoveryManager on every established connection // Create a new ServiceDiscoveryManager on every established connection
static { static {
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() { XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionEstablished(XMPPConnection connection) { public void connectionCreated(XMPPConnection connection) {
new ServiceDiscoveryManager(connection); new ServiceDiscoveryManager(connection);
} }
}); });

View file

@ -20,11 +20,14 @@
package org.jivesoftware.smackx; package org.jivesoftware.smackx;
import java.util.Iterator; import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.*; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message; 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 * 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 // Enable the XHTML support on every established connection
// The ServiceDiscoveryManager class should have been already initialized // The ServiceDiscoveryManager class should have been already initialized
static { static {
XMPPConnection.addConnectionListener(new ConnectionEstablishedListener() { XMPPConnection.addConnectionListener(new ConnectionCreationListener() {
public void connectionEstablished(XMPPConnection connection) { public void connectionCreated(XMPPConnection connection) {
XHTMLManager.setServiceEnabled(connection, true); XHTMLManager.setServiceEnabled(connection, true);
} }
}); });

View file

@ -76,8 +76,8 @@ public class MultiUserChat {
private List<PacketListener> connectionListeners = new ArrayList<PacketListener>(); private List<PacketListener> connectionListeners = new ArrayList<PacketListener>();
static { static {
XMPPConnection.addConnectionEstablishedListener(new ConnectionEstablishedListener() { XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionEstablished(final XMPPConnection connection) { public void connectionCreated(final XMPPConnection connection) {
// Set on every established connection that this client supports the Multi-User // Set on every established connection that this client supports the Multi-User
// Chat protocol. This information will be used when another client tries to // Chat protocol. This information will be used when another client tries to
// discover whether this client supports MUC or not. // discover whether this client supports MUC or not.