1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Renamed Connection to XMPPConnection

This commit is contained in:
Florian Schmaus 2014-03-10 09:45:50 +01:00
parent f3e007bad5
commit 489816c61f
145 changed files with 639 additions and 641 deletions

View file

@ -14,7 +14,7 @@ Key Advantages :
- Extremely simple to use, yet powerful API. Sending a text message to a user can be accomplished in only a few lines of code:
```java
Connection connection = new XMPPConnection("jabber.org");
XMPPConnection connection = new TCPConnection("jabber.org");
connection.connect();
connection.login("mtucker", "password");
Chat chat = connection.getChatManager()

View file

@ -25,7 +25,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketCollector;
@ -51,10 +51,10 @@ import org.igniterealtime.jbosh.ComposableBody;
* Creates a connection to a XMPP server via HTTP binding.
* This is specified in the XEP-0206: XMPP Over BOSH.
*
* @see Connection
* @see XMPPConnection
* @author Guenther Niess
*/
public class BOSHConnection extends Connection {
public class BOSHConnection extends XMPPConnection {
/**
* The XMPP Over Bosh namespace.

View file

@ -167,7 +167,7 @@ public class MessageTest extends SmackTestCase {
// Send the first message
getConnection(0).sendPacket(msg);
// Check that the connection that sent the message is still connected
assertTrue("Connection was closed", getConnection(0).isConnected());
assertTrue("XMPPConnection was closed", getConnection(0).isConnected());
// Check that the message was received
Message rcv = (Message) collector.nextResult(1000);
assertNotNull("No Message was received", rcv);
@ -175,7 +175,7 @@ public class MessageTest extends SmackTestCase {
// Send the second message
getConnection(0).sendPacket(msg);
// Check that the connection that sent the message is still connected
assertTrue("Connection was closed", getConnection(0).isConnected());
assertTrue("XMPPConnection was closed", getConnection(0).isConnected());
// Check that the second message was received
rcv = (Message) collector.nextResult(1000);
assertNotNull("No Message was received", rcv);

View file

@ -35,8 +35,8 @@ public class PresenceTest extends SmackTestCase {
}
/**
* Connection(0) will send messages to the bareJID of Connection(1) where the user of
* Connection(1) has logged from two different places with different presence priorities.
* XMPPConnection(0) will send messages to the bareJID of XMPPConnection(1) where the user of
* XMPPConnection(1) has logged from two different places with different presence priorities.
*/
public void testMessageToHighestPriority() {
TCPConnection conn = null;

View file

@ -1,6 +1,6 @@
package org.jivesoftware.smack.util;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.XMPPException;
@ -8,7 +8,7 @@ public class ConnectionUtils {
private ConnectionUtils() {}
public static void becomeFriends(Connection con0, Connection con1) throws XMPPException {
public static void becomeFriends(XMPPConnection con0, XMPPConnection con1) throws XMPPException {
Roster r0 = con0.getRoster();
Roster r1 = con1.getRoster();
r0.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
@ -17,9 +17,9 @@ public class ConnectionUtils {
r1.createEntry(con0.getUser(), "u1", null);
}
public static void letsAllBeFriends(Connection[] connections) throws XMPPException {
for (Connection c1 : connections) {
for (Connection c2 : connections) {
public static void letsAllBeFriends(XMPPConnection[] connections) throws XMPPException {
for (XMPPConnection c1 : connections) {
for (XMPPConnection c2 : connections) {
if (c1 == c2)
continue;
becomeFriends(c1, c2);

View file

@ -31,13 +31,13 @@ import org.jivesoftware.smack.util.StringUtils;
/**
* Allows creation and management of accounts on an XMPP server.
*
* @see Connection#getAccountManager()
* @see XMPPConnection#getAccountManager()
* @author Matt Tucker
*/
public class AccountManager {
private static final Logger LOGGER = Logger.getLogger(AccountManager.class.getName());
private Connection connection;
private XMPPConnection connection;
private Registration info = null;
/**
@ -53,7 +53,7 @@ public class AccountManager {
*
* @param connection a connection to a XMPP server.
*/
public AccountManager(Connection connection) {
public AccountManager(XMPPConnection connection) {
this.connection = connection;
}

View file

@ -151,7 +151,7 @@ public class Chat {
/**
* Delivers a message directly to this chat, which will add the message
* to the collector and deliver it to all listeners registered with the
* Chat. This is used by the Connection class to deliver messages
* Chat. This is used by the XMPPConnection class to deliver messages
* without a thread ID.
*
* @param message the message.

View file

@ -108,9 +108,9 @@ public class ChatManager {
private Map<PacketInterceptor, PacketFilter> interceptors
= new WeakHashMap<PacketInterceptor, PacketFilter>();
private Connection connection;
private XMPPConnection connection;
ChatManager(Connection connection) {
ChatManager(XMPPConnection connection) {
this.connection = connection;
PacketFilter filter = new PacketFilter() {

View file

@ -63,7 +63,7 @@ public class ConnectionConfiguration implements Cloneable {
*/
private CallbackHandler callbackHandler;
private boolean debuggerEnabled = Connection.DEBUG_ENABLED;
private boolean debuggerEnabled = XMPPConnection.DEBUG_ENABLED;
// Flag that indicates if a reconnection should be attempted when abruptly disconnected
private boolean reconnectionAllowed = true;
@ -368,7 +368,7 @@ public class ConnectionConfiguration implements Cloneable {
/**
* Returns true if the new connection about to be establish is going to be debugged. By
* default the value of {@link Connection#DEBUG_ENABLED} is used.
* default the value of {@link XMPPConnection#DEBUG_ENABLED} is used.
*
* @return true if the new connection about to be establish is going to be debugged.
*/
@ -378,7 +378,7 @@ public class ConnectionConfiguration implements Cloneable {
/**
* Sets if the new connection about to be establish is going to be debugged. By
* default the value of {@link Connection#DEBUG_ENABLED} is used.
* default the value of {@link XMPPConnection#DEBUG_ENABLED} is used.
*
* @param debuggerEnabled if the new connection about to be establish is going to be debugged.
*/

View file

@ -18,9 +18,9 @@
package org.jivesoftware.smack;
/**
* Implementors of this interface will be notified when a new {@link Connection}
* Implementors of this interface will be notified when a new {@link XMPPConnection}
* has been created. The newly created connection will not be actually connected to
* the server. Use {@link Connection#addConnectionCreationListener(ConnectionCreationListener)}
* the server. Use {@link XMPPConnection#addConnectionCreationListener(ConnectionCreationListener)}
* to add new listeners.
*
* @author Gaston Dombiak
@ -33,6 +33,6 @@ public interface ConnectionCreationListener {
*
* @param connection the newly created connection.
*/
public void connectionCreated(Connection connection);
public void connectionCreated(XMPPConnection connection);
}

View file

@ -19,10 +19,10 @@ package org.jivesoftware.smack;
/**
* Interface that allows for implementing classes to listen for connection closing
* and reconnection events. Listeners are registered with Connection objects.
* and reconnection events. Listeners are registered with XMPPConnection objects.
*
* @see Connection#addConnectionListener
* @see Connection#removeConnectionListener
* @see XMPPConnection#addConnectionListener
* @see XMPPConnection#removeConnectionListener
*
* @author Matt Tucker
*/

View file

@ -20,13 +20,13 @@ import java.lang.ref.WeakReference;
public abstract class Manager {
final WeakReference<Connection> weakConnection;
final WeakReference<XMPPConnection> weakConnection;
public Manager(Connection connection) {
weakConnection = new WeakReference<Connection>(connection);
public Manager(XMPPConnection connection) {
weakConnection = new WeakReference<XMPPConnection>(connection);
}
protected final Connection connection() {
protected final XMPPConnection connection() {
return weakConnection.get();
}
}

View file

@ -35,14 +35,14 @@ import org.jivesoftware.smack.packet.XMPPError;
* older packets are automatically dropped. The default number is retrieved by
* {@link SmackConfiguration#getPacketCollectorSize()}.
*
* @see Connection#createPacketCollector(PacketFilter)
* @see XMPPConnection#createPacketCollector(PacketFilter)
* @author Matt Tucker
*/
public class PacketCollector {
private PacketFilter packetFilter;
private ArrayBlockingQueue<Packet> resultQueue;
private Connection connection;
private XMPPConnection connection;
private boolean cancelled = false;
/**
@ -52,7 +52,7 @@ public class PacketCollector {
* @param connection the connection the collector is tied to.
* @param packetFilter determines which packets will be returned by this collector.
*/
protected PacketCollector(Connection connection, PacketFilter packetFilter) {
protected PacketCollector(XMPPConnection connection, PacketFilter packetFilter) {
this(connection, packetFilter, SmackConfiguration.getPacketCollectorSize());
}
@ -64,7 +64,7 @@ public class PacketCollector {
* @param packetFilter determines which packets will be returned by this collector.
* @param maxSize the maximum number of packets that will be stored in the collector.
*/
protected PacketCollector(Connection connection, PacketFilter packetFilter, int maxSize) {
protected PacketCollector(XMPPConnection connection, PacketFilter packetFilter, int maxSize) {
this.connection = connection;
this.packetFilter = packetFilter;
this.resultQueue = new ArrayBlockingQueue<Packet>(maxSize);

View file

@ -21,14 +21,14 @@ import org.jivesoftware.smack.packet.Packet;
/**
* Provides a mechanism to intercept and modify packets that are going to be
* sent to the server. PacketInterceptors are added to the {@link Connection}
* sent to the server. PacketInterceptors are added to the {@link XMPPConnection}
* together with a {@link org.jivesoftware.smack.filter.PacketFilter} so that only
* certain packets are intercepted and processed by the interceptor.<p>
*
* This allows event-style programming -- every time a new packet is found,
* the {@link #interceptPacket(Packet)} method will be called.
*
* @see Connection#addPacketInterceptor(PacketInterceptor, org.jivesoftware.smack.filter.PacketFilter)
* @see XMPPConnection#addPacketInterceptor(PacketInterceptor, org.jivesoftware.smack.filter.PacketFilter)
* @author Gaston Dombiak
*/
public interface PacketInterceptor {

View file

@ -26,7 +26,7 @@ import org.jivesoftware.smack.packet.Packet;
* opposite approach to the functionality provided by a {@link PacketCollector}
* which lets you block while waiting for results.
*
* @see Connection#addPacketListener(PacketListener, org.jivesoftware.smack.filter.PacketFilter)
* @see XMPPConnection#addPacketListener(PacketListener, org.jivesoftware.smack.filter.PacketFilter)
* @author Matt Tucker
*/
public interface PacketListener {

View file

@ -37,7 +37,7 @@ public class ReconnectionManager implements ConnectionListener {
private static final Logger LOGGER = Logger.getLogger(ReconnectionManager.class.getName());
// Holds the connection to the server
private Connection connection;
private XMPPConnection connection;
private Thread reconnectionThread;
private int randomBase = new Random().nextInt(11) + 5; // between 5 and 15 seconds
@ -48,14 +48,14 @@ 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.
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
connection.addConnectionListener(new ReconnectionManager(connection));
}
});
}
private ReconnectionManager(Connection connection) {
private ReconnectionManager(XMPPConnection connection) {
this.connection = connection;
}
@ -117,7 +117,7 @@ public class ReconnectionManager implements ConnectionListener {
*/
public void run() {
// The process will try to reconnect until the connection is established or
// the user cancel the reconnection process {@link Connection#disconnect()}
// the user cancel the reconnection process {@link XMPPConnection#disconnect()}
while (ReconnectionManager.this.isReconnectionAllowed()) {
// Find how much time we should wait until the next reconnection
int remainingSeconds = timeDelay();
@ -173,7 +173,7 @@ public class ReconnectionManager implements ConnectionListener {
}
/**
* Fires listeners when The Connection will retry a reconnection. Expressed in seconds.
* Fires listeners when The XMPPConnection will retry a reconnection. Expressed in seconds.
*
* @param seconds the number of seconds that a reconnection will be attempted in.
*/

View file

@ -52,7 +52,7 @@ import org.jivesoftware.smack.util.StringUtils;
* </ul>
*
* @author Matt Tucker
* @see Connection#getRoster()
* @see XMPPConnection#getRoster()
*/
public class Roster {
@ -62,7 +62,7 @@ public class Roster {
*/
private static SubscriptionMode defaultSubscriptionMode = SubscriptionMode.accept_all;
private final Connection connection;
private final XMPPConnection connection;
private final RosterStore rosterStore;
private final Map<String, RosterGroup> groups;
private final Map<String,RosterEntry> entries;
@ -105,7 +105,7 @@ public class Roster {
*
* @param connection an XMPP connection.
*/
Roster(final Connection connection) {
Roster(final XMPPConnection connection) {
this.connection = connection;
rosterStore = connection.getConfiguration().getRosterStore();
groups = new ConcurrentHashMap<String, RosterGroup>();
@ -138,9 +138,9 @@ public class Roster {
// if not connected add listener after successful login
if(!this.connection.isConnected()) {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
public void connectionCreated(XMPPConnection connection) {
if(connection.equals(Roster.this.connection)) {
Roster.this.connection.addConnectionListener(connectionListener);
}

View file

@ -35,7 +35,7 @@ public class RosterEntry {
private RosterPacket.ItemType type;
private RosterPacket.ItemStatus status;
final private Roster roster;
final private Connection connection;
final private XMPPConnection connection;
/**
* Creates a new roster entry.
@ -47,7 +47,7 @@ public class RosterEntry {
* @param connection a connection to the XMPP server.
*/
RosterEntry(String user, String name, RosterPacket.ItemType type,
RosterPacket.ItemStatus status, Roster roster, Connection connection) {
RosterPacket.ItemStatus status, Roster roster, XMPPConnection connection) {
this.user = user;
this.name = name;
this.type = type;

View file

@ -36,7 +36,7 @@ import org.jivesoftware.smack.util.StringUtils;
public class RosterGroup {
private String name;
private Connection connection;
private XMPPConnection connection;
private final Set<RosterEntry> entries;
/**
@ -45,7 +45,7 @@ public class RosterGroup {
* @param name the name of the group.
* @param connection the connection the group belongs to.
*/
RosterGroup(String name, Connection connection) {
RosterGroup(String name, XMPPConnection connection) {
this.name = name;
this.connection = connection;
entries = new LinkedHashSet<RosterEntry>();

View file

@ -61,7 +61,7 @@ public class SASLAuthentication {
private static Map<String, Class<? extends SASLMechanism>> implementedMechanisms = new HashMap<String, Class<? extends SASLMechanism>>();
private static List<String> mechanismsPreferences = new ArrayList<String>();
private Connection connection;
private XMPPConnection connection;
private Collection<String> serverMechanisms = new ArrayList<String>();
private SASLMechanism currentMechanism = null;
/**
@ -170,7 +170,7 @@ public class SASLAuthentication {
return answer;
}
SASLAuthentication(Connection connection) {
SASLAuthentication(XMPPConnection connection) {
super();
this.connection = connection;
this.init();

View file

@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack;
import java.io.Reader;
@ -47,7 +46,7 @@ import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
/**
* The abstract Connection class provides an interface for connections to a
* The abstract XMPPConnection class provides an interface for connections to a
* XMPP server and implements shared methods which are used by the
* different types of connections (e.g. TCPConnection or BoshConnection).
*
@ -55,7 +54,7 @@ import org.jivesoftware.smack.packet.Presence;
* look like the following:
* <pre>
* // Create a connection to the igniterealtime.org XMPP server.
* Connection con = new TCPConnection("igniterealtime.org");
* XMPPConnection con = new TCPConnection("igniterealtime.org");
* // Connect to the server
* con.connect();
* // Most servers require you to login before performing other tasks.
@ -77,16 +76,15 @@ import org.jivesoftware.smack.packet.Presence;
* may be connected, disconnected and then connected again. Listeners of the Connection
* will be retained accross connections.<p>
* <p/>
* If a connected Connection gets disconnected abruptly then it will try to reconnect
* If a connected XMPPConnection gets disconnected abruptly then it will try to reconnect
* again. To stop the reconnection process, use {@link #disconnect()}. Once stopped
* you can use {@link #connect()} to manually connect to the server.
*
* @see TCPConnection
* @author Matt Tucker
* @author Guenther Niess
*/
public abstract class Connection {
private static final Logger LOGGER = Logger.getLogger(Connection.class.getName());
public abstract class XMPPConnection {
private static final Logger LOGGER = Logger.getLogger(XMPPConnection.class.getName());
/**
* Counter to uniquely identify connections that are created.
@ -230,11 +228,11 @@ public abstract class Connection {
private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(2);
/**
* Create a new Connection to a XMPP server.
* Create a new XMPPConnection to a XMPP server.
*
* @param configuration The configuration which is used to establish the connection.
*/
protected Connection(ConnectionConfiguration configuration) {
protected XMPPConnection(ConnectionConfiguration configuration) {
config = configuration;
}
@ -482,7 +480,7 @@ public abstract class Connection {
/**
* Closes the connection by setting presence to unavailable then closing the connection to
* the XMPP server. The Connection can still be used for connecting to the server
* the XMPP server. The XMPPConnection can still be used for connecting to the server
* again.<p>
* <p/>
* This method cleans up all resources used by the connection. Therefore, the roster,
@ -497,7 +495,7 @@ public abstract class Connection {
/**
* Closes the connection. A custom unavailable presence is sent to the server, followed
* by closing the stream. The Connection can still be used for connecting to the server
* by closing the stream. The XMPPConnection can still be used for connecting to the server
* again. A custom unavilable presence is useful for communicating offline presence
* information such as "On vacation". Typically, just the status text of the presence
* packet is set with online information, but most XMPP servers will deliver the full
@ -822,7 +820,7 @@ public abstract class Connection {
// option
try {
Constructor<?> constructor = debuggerClass
.getConstructor(Connection.class, Writer.class, Reader.class);
.getConstructor(XMPPConnection.class, Writer.class, Reader.class);
debugger = (SmackDebugger) constructor.newInstance(this, writer, reader);
reader = debugger.getReader();
writer = debugger.getWriter();
@ -842,7 +840,7 @@ public abstract class Connection {
/**
* Set the servers Entity Caps node
*
* Connection holds this information in order to avoid a dependency to
* XMPPConnection holds this information in order to avoid a dependency to
* smackx where EntityCapsManager lives from smack.
*
* @param node
@ -854,7 +852,7 @@ public abstract class Connection {
/**
* Retrieve the servers Entity Caps node
*
* Connection holds this information in order to avoid a dependency to
* XMPPConnection holds this information in order to avoid a dependency to
* smackx where EntityCapsManager lives from smack.
*
* @return

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smack.debugger;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.*;
@ -43,7 +43,7 @@ public class ConsoleDebugger implements SmackDebugger {
public static boolean printInterpreted = false;
private SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");
private Connection connection = null;
private XMPPConnection connection = null;
private PacketListener listener = null;
private ConnectionListener connListener = null;
@ -53,7 +53,7 @@ public class ConsoleDebugger implements SmackDebugger {
private ReaderListener readerListener;
private WriterListener writerListener;
public ConsoleDebugger(Connection connection, Writer writer, Reader reader) {
public ConsoleDebugger(XMPPConnection connection, Writer writer, Reader reader) {
this.connection = connection;
this.writer = writer;
this.reader = reader;
@ -111,7 +111,7 @@ public class ConsoleDebugger implements SmackDebugger {
connListener = new ConnectionListener() {
public void connectionClosed() {
System.out.println(
dateFormatter.format(new Date()) + " Connection closed (" +
dateFormatter.format(new Date()) + " XMPPConnection closed (" +
connection.hashCode() +
")");
}
@ -119,7 +119,7 @@ public class ConsoleDebugger implements SmackDebugger {
public void connectionClosedOnError(Exception e) {
System.out.println(
dateFormatter.format(new Date()) +
" Connection closed due to an exception (" +
" XMPPConnection closed due to an exception (" +
connection.hashCode() +
")");
e.printStackTrace();
@ -134,13 +134,13 @@ public class ConsoleDebugger implements SmackDebugger {
}
public void reconnectionSuccessful() {
System.out.println(
dateFormatter.format(new Date()) + " Connection reconnected (" +
dateFormatter.format(new Date()) + " XMPPConnection reconnected (" +
connection.hashCode() +
")");
}
public void reconnectingIn(int seconds) {
System.out.println(
dateFormatter.format(new Date()) + " Connection (" +
dateFormatter.format(new Date()) + " XMPPConnection (" +
connection.hashCode() +
") will reconnect in " + seconds);
}

View file

@ -39,7 +39,7 @@ public class LiteDebugger implements SmackDebugger {
private static final String NEWLINE = "\n";
private JFrame frame = null;
private Connection connection = null;
private XMPPConnection connection = null;
private PacketListener listener = null;
@ -48,7 +48,7 @@ public class LiteDebugger implements SmackDebugger {
private ReaderListener readerListener;
private WriterListener writerListener;
public LiteDebugger(Connection connection, Writer writer, Reader reader) {
public LiteDebugger(XMPPConnection connection, Writer writer, Reader reader) {
this.connection = connection;
this.writer = writer;
this.reader = reader;

View file

@ -26,7 +26,7 @@ import org.jivesoftware.smack.*;
* displays XML traffic.<p>
*
* Every implementation of this interface <b>must</b> have a public constructor with the following
* arguments: Connection, Writer, Reader.
* arguments: XMPPConnection, Writer, Reader.
*
* @author Gaston Dombiak
*/

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smack.filter;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.StringUtils;
@ -78,7 +78,7 @@ public class IQReplyFilter implements PacketFilter {
*
* @param iqPacket An IQ request. Filter for replies to this packet.
*/
public IQReplyFilter(IQ iqPacket, Connection conn) {
public IQReplyFilter(IQ iqPacket, XMPPConnection conn) {
to = iqPacket.getTo();
if (conn.getUser() == null) {
// We have not yet been assigned a username, this can happen if the connection is

View file

@ -279,7 +279,7 @@ public class Socks5ProxySocketFactory
o X'02' connection not allowed by ruleset
o X'03' Network unreachable
o X'04' Host unreachable
o X'05' Connection refused
o X'05' XMPPConnection refused
o X'06' TTL expired
o X'07' Command not supported
o X'08' Address type not supported

View file

@ -28,7 +28,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Bind;
import org.jivesoftware.smack.packet.DefaultPacketExtension;
import org.jivesoftware.smack.packet.IQ;
@ -281,7 +281,7 @@ public class PacketParserUtils {
* @return an IQ object.
* @throws Exception if an exception occurs while parsing the packet.
*/
public static IQ parseIQ(XmlPullParser parser, Connection connection) throws Exception {
public static IQ parseIQ(XmlPullParser parser, XMPPConnection connection) throws Exception {
IQ iqPacket = null;
String id = parser.getAttributeValue("", "id");

View file

@ -23,7 +23,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
@ -34,7 +34,7 @@ import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
/**
* A dummy implementation of {@link Connection}, intended to be used during
* A dummy implementation of {@link XMPPConnection}, intended to be used during
* unit tests.
*
* Instances store any packets that are delivered to be send using the
@ -49,7 +49,7 @@ import org.jivesoftware.smack.packet.Presence;
* @see Connection
* @author Guenther Niess
*/
public class DummyConnection extends Connection {
public class DummyConnection extends XMPPConnection {
private boolean authenticated = false;
private boolean anonymous = false;

View file

@ -187,7 +187,7 @@ public class PacketCollectorTest
class TestPacketCollector extends PacketCollector
{
protected TestPacketCollector(Connection conection, PacketFilter packetFilter, int size)
protected TestPacketCollector(XMPPConnection conection, PacketFilter packetFilter, int size)
{
super(conection, packetFilter, size);
}

View file

@ -53,7 +53,7 @@ public class RosterTest {
@Before
public void setUp() throws Exception {
// Uncomment this to enable debug output
//Connection.DEBUG_ENABLED = true;
//XMPPConnection.DEBUG_ENABLED = true;
connection = new DummyConnection();
connection.connect();
@ -702,7 +702,7 @@ public class RosterTest {
public synchronized void entriesAdded(Collection<String> addresses) {
addressesAdded.addAll(addresses);
if (Connection.DEBUG_ENABLED) {
if (XMPPConnection.DEBUG_ENABLED) {
for (String address : addresses) {
System.out.println("Roster entry for " + address + " added.");
}
@ -711,7 +711,7 @@ public class RosterTest {
public synchronized void entriesDeleted(Collection<String> addresses) {
addressesDeleted.addAll(addresses);
if (Connection.DEBUG_ENABLED) {
if (XMPPConnection.DEBUG_ENABLED) {
for (String address : addresses) {
System.out.println("Roster entry for " + address + " deleted.");
}
@ -720,7 +720,7 @@ public class RosterTest {
public synchronized void entriesUpdated(Collection<String> addresses) {
addressesUpdated.addAll(addresses);
if (Connection.DEBUG_ENABLED) {
if (XMPPConnection.DEBUG_ENABLED) {
for (String address : addresses) {
System.out.println("Roster entry for " + address + " updated.");
}
@ -728,7 +728,7 @@ public class RosterTest {
}
public void presenceChanged(Presence presence) {
if (Connection.DEBUG_ENABLED) {
if (XMPPConnection.DEBUG_ENABLED) {
System.out.println("Roster presence changed: " + presence.toXML());
}
}

View file

@ -57,7 +57,7 @@ public class RosterVersioningTest {
@Before
public void setUp() throws Exception {
// Uncomment this to enable debug output
//Connection.DEBUG_ENABLED = true;
//XMPPConnection.DEBUG_ENABLED = true;
DefaultRosterStore store = DefaultRosterStore.init(tmpFolder.newFolder("store"));
populateStore(store);

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.debugger;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.debugger.SmackDebugger;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message;
@ -113,7 +113,7 @@ public class EnhancedDebugger implements SmackDebugger {
private JFormattedTextField userField = null;
private JFormattedTextField statusField = null;
private Connection connection = null;
private XMPPConnection connection = null;
private PacketListener packetReaderListener = null;
private PacketListener packetWriterListener = null;
@ -141,7 +141,7 @@ public class EnhancedDebugger implements SmackDebugger {
JTabbedPane tabbedPane;
public EnhancedDebugger(Connection connection, Writer writer, Reader reader) {
public EnhancedDebugger(XMPPConnection connection, Writer writer, Reader reader) {
this.connection = connection;
this.writer = writer;
this.reader = reader;
@ -570,7 +570,7 @@ public class EnhancedDebugger implements SmackDebugger {
// Add the Host information
JPanel connPanel = new JPanel();
connPanel.setLayout(new GridBagLayout());
connPanel.setBorder(BorderFactory.createTitledBorder("Connection information"));
connPanel.setBorder(BorderFactory.createTitledBorder("XMPPConnection information"));
JLabel label = new JLabel("Host: ");
label.setMinimumSize(new java.awt.Dimension(150, 14));

View file

@ -121,7 +121,7 @@ public class EnhancedDebuggerWindow {
if (frame == null) {
createDebug();
}
debugger.tabbedPane.setName("Connection_" + tabbedPane.getComponentCount());
debugger.tabbedPane.setName("XMPPConnection_" + tabbedPane.getComponentCount());
tabbedPane.add(debugger.tabbedPane, tabbedPane.getComponentCount() - 1);
tabbedPane.setIconAt(tabbedPane.indexOfComponent(debugger.tabbedPane), connectionCreatedIcon);
frame.setTitle(
@ -168,7 +168,7 @@ public class EnhancedDebuggerWindow {
int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane);
getInstance().tabbedPane.setToolTipTextAt(
index,
"Connection closed due to the exception: " + e.getMessage());
"XMPPConnection closed due to the exception: " + e.getMessage());
getInstance().tabbedPane.setIconAt(
index,
connectionClosedOnErrorIcon);

View file

@ -1,13 +1,13 @@
<html>
<head>
<title>Smack: Connection Management - Jive Software</title>
<title>Smack: XMPPConnection Management - Jive Software</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div class="header">
Smack: Connection Management
Smack: XMPPConnection Management
</div>
<div class="nav">
@ -19,7 +19,7 @@
</p>
<p>
The <tt>org.jivesoftware.smack.Connection</tt> class manages your connection to an XMPP
The <tt>org.jivesoftware.smack.XMPPConnection</tt> class manages your connection to an XMPP
server. The default implementation is the <tt>org.jivesoftware.smack.XMPPConnection</tt>
class. Two constructors are mainly used. The first, <tt>XMPPConnection(String)</tt> takes
the server name you'd like to connect to as an argument. All default connection settings will
@ -80,7 +80,7 @@ manager will try to immediately reconnect to the server and increase the delay b
successive reconnections keep failing.</i>
<br>
In case you want to force a reconnection while the reconnetion manager is waiting for the next
reconnection, you can just use <i>Connection#connect()</i> and a new attempt will be made.
reconnection, you can just use <i>XMPPConnection#connect()</i> and a new attempt will be made.
If the manual attempt also failed then the reconnection manager will still continue the
reconnection job.
</p>

View file

@ -26,7 +26,7 @@ Debugging mode can be enabled in two different ways:
<ol>
<li>Add the following line of code <b>before</b> creating new connections:<p>
<tt>Connection.DEBUG_ENABLED = true;</tt><p>
<tt>XMPPConnection.DEBUG_ENABLED = true;</tt><p>
<li>Set the Java system property <tt>smack.debugEnabled</tt> to true. The
system property can be set on the command line such as:<p>
@ -39,7 +39,7 @@ add the following line to your application before opening new connections:
</p>
<p>
<tt>Connection.DEBUG_ENABLED = false;</tt>
<tt>XMPPConnection.DEBUG_ENABLED = false;</tt>
</p>
<p>
@ -73,7 +73,7 @@ When debugging mode is enabled, a debug window will appear containing tabs for e
The window will contain the following information:
<ul>
<li>Connection tabs -- each tab shows debugging information related to the connection.
<li>XMPPConnection tabs -- each tab shows debugging information related to the connection.
<li>Smack info tab -- shows information about Smack (e.g. Smack version, installed components, etc.).
</ul>

View file

@ -34,9 +34,9 @@ discovery request with the information that you previously configured.</p>
<b>Usage</b><p>
In order to configure the supported features by your client you should first obtain the
ServiceDiscoveryManager associated with your Connection. To get your ServiceDiscoveryManager
ServiceDiscoveryManager associated with your XMPPConnection. To get your ServiceDiscoveryManager
send <b>getInstanceFor(connection)</b> to the class <i><b>ServiceDiscoveryManager</b></i> where
connection is your Connection.<br></p>
connection is your XMPPConnection.<br></p>
<p>Once you have your ServiceDiscoveryManager you will be able to manage the supported features. To
register a new feature send <b>addFeature(feature)</b> to your <i><b>ServiceDiscoveryManager</b></i>
@ -48,7 +48,7 @@ String that represents the feature to remove.</p>
In this example we can see how to add and remove supported features: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Register that a new feature is supported by this XMPP entity</font>
@ -74,7 +74,7 @@ to configure the information providers associated to the items/nodes within the
In order to configure the associated nodes within the Smack client you will need to create a
NodeInformationProvider and register it with the <i><b>ServiceDiscoveryManager</b></i>. To get
your ServiceDiscoveryManager send <b>getInstanceFor(connection)</b> to the class <i><b>ServiceDiscoveryManager</b></i>
where connection is your Connection.<br></p>
where connection is your XMPPConnection.<br></p>
<p>Once you have your ServiceDiscoveryManager you will be able to register information providers
for the XMPP entity's nodes. To register a new node information provider send <b>setNodeInformationProvider(String node, NodeInformationProvider listener)</b>
@ -126,7 +126,7 @@ the discovered items.</p>
In this example we can see how to discover the items associated with an online catalog service: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Get the items of a given XMPP entity</font>
@ -171,7 +171,7 @@ the discovered information.</p>
In this example we can see how to discover the information of a conference room: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Get the information of a given XMPP entity</font>
@ -216,7 +216,7 @@ to publish.</p>
In this example we can see how to publish new items: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Create a DiscoverItems with the items to publish</font>

View file

@ -34,7 +34,7 @@ to enable the user to easily send a file.
<b>Usage</b><p>
In order to send a file you must first construct an instance of the <b><i>FileTransferManager</i></b>
class. This class has one constructor with one parameter which is your Connection.
class. This class has one constructor with one parameter which is your XMPPConnection.
In order to instantiate the manager you should call <i>new FileTransferManager(connection)</i>
<p>Once you have your <b><i>FileTransferManager</i></b> you will need to create an outgoing
@ -86,7 +86,7 @@ manager.</p>
<b>Usage</b><p>
In order to recieve a file you must first construct an instance of the <b><i>FileTransferManager</i></b>
class. This class has one constructor with one parameter which is your Connection.
class. This class has one constructor with one parameter which is your XMPPConnection.
In order to instantiate the manager you should call <i>new FileTransferManager(connection)</i>
<p>Once you have your <b><i>FileTransferManager</i></b> you will need to register a listener

View file

@ -75,14 +75,14 @@ You can receive notification requests for the following events: delivered, displ
The general idea is to create a new <i>DefaultMessageEventRequestListener</i> that will listen to the event notifications
requests and react with custom logic. Then you will have to add the listener to the
<i>MessageEventManager</i> that works on
the desired <i>Connection</i>.
the desired <i>XMPPConnection</i>.
<p>Note that <i>DefaultMessageEventRequestListener</i> is a default implementation of the
<i>MessageEventRequestListener</i> interface.
The class <i>DefaultMessageEventRequestListener</i> automatically sends a delivered notification to the sender of the message
if the sender has requested to be notified when the message is delivered. If you decide to create a new class that
implements the <i>MessageEventRequestListener</i> interface, please remember to send the delivered notification.</p>
<ul>
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(Connection)</b></i> constructor.
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(XMPPConnection)</b></i> constructor.
</li>
<li>To create an event notification requests listener create a subclass of <i><b>DefaultMessageEventRequestListener</b></i> or
create a class that implements the <i><b>MessageEventRequestListener</b></i> interface.
@ -178,9 +178,9 @@ will probably want to react to some or all of these events.</p>
The general idea is to create a new <i>MessageEventNotificationListener</i> that will listen to the event notifications
and react with custom logic. Then you will have to add the listener to the <i>MessageEventManager</i> that works on
the desired <i>Connection</i>.
the desired <i>XMPPConnection</i>.
<ul>
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(Connection)</b></i> constructor.
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(XMPPConnection)</b></i> constructor.
</li>
<li>To create an event notifications listener create a class that implements the <i><b>MessageEventNotificationListener</b></i>
interface.

View file

@ -51,7 +51,7 @@ the form and finally send it back to the server.</p>
In this example we can see how to create an instant room: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// Create the room</font>
@ -65,7 +65,7 @@ In this example we can see how to create an instant room: <br>
In this example we can see how to create a reserved room. The form is completed with default values: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// Create the room</font>
@ -121,7 +121,7 @@ for a response from the server.</p>
In this example we can see how to join a room with a given nickname: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc2 = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// User2 joins the new room</font>
@ -132,7 +132,7 @@ In this example we can see how to join a room with a given nickname: <br>
In this example we can see how to join a room with a given nickname and password: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc2 = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// User2 joins the new room using a password</font>
@ -144,7 +144,7 @@ In this example we can see how to join a room with a given nickname and password
In this example we can see how to join a room with a given nickname specifying the amount of history
to receive: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc2 = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// User2 joins the new room using a password and specifying</font>
@ -205,7 +205,7 @@ In this example we can see how to listen for room invitations and decline invita
<blockquote>
<pre> <font color="#3f7f5f">// User3 listens for MUC invitations</font>
MultiUserChat.addInvitationListener(conn3, new InvitationListener() {
public void invitationReceived(Connection conn, String room, String inviter, String reason, String password) {
public void invitationReceived(XMPPConnection conn, String room, String inviter, String reason, String password) {
<font color="#3f7f5f">// Reject the invitation</font>
MultiUserChat.decline(conn, room, inviter, <font color="#0000FF">"I'm busy right now"</font>);
}
@ -224,7 +224,7 @@ A user may want to discover if one of the user's contacts supports the Multi-Use
<b>Usage</b><p>
In order to discover if one of the user's contacts supports MUC just send
<b>isServiceEnabled(Connection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
<b>isServiceEnabled(XMPPConnection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
class where user is a fully qualified XMPP ID, e.g. jdoe@example.com. You will receive
a boolean indicating whether the user supports MUC or not.</p>
@ -248,7 +248,7 @@ A user may also want to query a contact regarding which rooms the contact is in.
<b>Usage</b><p>
In order to get the rooms where a user is in just send
<b>getJoinedRooms(Connection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
<b>getJoinedRooms(XMPPConnection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
class where user is a fully qualified XMPP ID, e.g. jdoe@example.com. You will get an Iterator
of Strings as an answer where each String represents a room name.</p>
@ -272,7 +272,7 @@ will provide information only for public rooms.</p>
<b>Usage</b><p>
In order to discover information about a room just send <b>getRoomInfo(Connection connection, String room)</b>
In order to discover information about a room just send <b>getRoomInfo(XMPPConnection connection, String room)</b>
to the <i><b>MultiUserChat</b></i> class where room is the XMPP ID of the room, e.g.
roomName@conference.myserver. You will get a RoomInfo object that contains the discovered room
information.</p>

View file

@ -47,7 +47,7 @@ a fully configured node.</p><p>
Create an instant node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Create the node</font>
@ -58,7 +58,7 @@ Create an instant node: <br>
Create a node with default configuration and then configure it: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Create the node</font>
@ -77,7 +77,7 @@ Create a node with default configuration and then configure it: <br>
Create and configure a node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Create the node</font>
@ -117,7 +117,7 @@ will be dependent on its configuration.
In this example we publish an item to a node that does not take payload: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -133,7 +133,7 @@ In this example we publish an item to a node that does not take payload: <br>
In this example we publish an item to a node that does take payload: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -174,7 +174,7 @@ In this example we can see how to create a listener and register it and then sub
messages. <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -212,7 +212,7 @@ In this example we can see how to create a listener, register it and then subscr
item deletion messages. <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -250,7 +250,7 @@ In this example we can see how to create a listener, register it and then subscr
node configuration messages. <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -315,7 +315,7 @@ of a <i><b>LeafNode</b></i> and call one of the retrieve methods.
In this example we can see how to retrieve the existing items from a node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -329,7 +329,7 @@ In this example we can see how to retrieve the existing items from a node: <br>
In this example we can see how to retrieve the last N existing items: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -343,7 +343,7 @@ In this example we can see how to retrieve the specified existing items: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -375,7 +375,7 @@ or <i><b>Node</b></i> classes depending on what type of information is required.
In this example we can see how to get pubsub capabilities: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the pubsub features that are supported</font>
@ -386,7 +386,7 @@ In this example we can see how to get pubsub capabilities: <br>
In this example we can see how to get pubsub subscriptions for all nodes: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get all the subscriptions in the pubsub service</font>
@ -397,7 +397,7 @@ In this example we can see how to get pubsub subscriptions for all nodes: <br>
In this example we can see how to get all affiliations for the users bare JID on the pubsub service: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the affiliations for the users bare JID</font>
@ -408,7 +408,7 @@ In this example we can see how to get all affiliations for the users bare JID on
In this example we can see how to get information about the node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
Node node = mgr.getNode(<font color="#0000FF">"testNode"</font>);
@ -420,7 +420,7 @@ In this example we can see how to get information about the node: <br>
In this example we can see how to discover the node items: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
Node node = mgr.getNode(<font color="#0000FF">"testNode"</font>);
@ -432,7 +432,7 @@ In this example we can see how to discover the node items: <br>
In this example we can see how to get node subscriptions: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
Node node = mgr.getNode(<font color="#0000FF">"testNode"</font>);

View file

@ -126,7 +126,7 @@ received.</p>
<li>Create a class that implements the <i><b>RosterExchangeListener</b></i> interface.</li>
<li>Implement the method <b>entriesReceived(String, Iterator)</b> that will be called when new entries
are received with custom logic.</li>
<li>Add the listener to the <i>RosterExchangeManager</i> that works on the desired <i>Connection</i>.</li>
<li>Add the listener to the <i>RosterExchangeManager</i> that works on the desired <i>XMPPConnection</i>.</li>
</ol></p>
<b>Example</b><p>

View file

@ -97,7 +97,7 @@ the message as you do with any other message.</p>
An XHTML message is like any regular message, therefore to send the message you can follow
the usual steps you do in order to send a message. For example, to send a message as part
of a chat just use the message <b>#send(Message)</b> of <i><b>Chat</b></i> or you can use
the message <b>#send(Packet)</b> of <i><b>Connection</b></i>.</p>
the message <b>#send(Packet)</b> of <i><b>XMPPConnection</b></i>.</p>
<b>Example</b><p>
@ -170,7 +170,7 @@ section explains how to explicitly discover for XHTML support.</p>
<b>Usage</b><p>
In order to discover if a remote user supports XHTML messages send <b>#isServiceEnabled(Connection
In order to discover if a remote user supports XHTML messages send <b>#isServiceEnabled(XMPPConnection
connection, String userID)</b> to the class <i><b>XHTMLManager</b></i> where connection is the connection
to use to perform the service discovery and userID is the user to check (A fully qualified xmpp ID,
e.g. jdoe@example.com). This message will return true if the specified user handles XHTML messages.</p>

View file

@ -94,10 +94,10 @@ conn2.connect();
<p>Note that maximum security will be used when connecting to the server by default (and when possible),
including use of TLS encryption. The ConnectionConfiguration class provides advanced control
over the connection created, such as the ability to disable or require encryption. See
<a href="connections.html">Connection Management</a> for full details.</p>
<a href="connections.html">XMPPConnection Management</a> for full details.</p>
<p>Once you've created a connection, you should login using a username and password
with the <tt>Connection.login(String username, String password)</tt> method.
with the <tt>XMPPConnection.login(String username, String password)</tt> method.
Once you've logged in, you can being chatting with other users by creating
new <tt>Chat</tt> or <tt>GroupChat</tt> objects.
@ -108,7 +108,7 @@ The roster lets you keep track of the availability (presence) of other users. Us
can be organized into groups such as "Friends" and "Co-workers", and then you
discover whether each user is online or offline.<p>
Retrieve the roster using the <tt>Connection.getRoster()</tt> method. The roster
Retrieve the roster using the <tt>XMPPConnection.getRoster()</tt> method. The roster
class allows you to find all the roster entries, the groups they belong to, and the
current presence status of each entry.
@ -130,7 +130,7 @@ and "out fishing":<p>
<font color="gray"><i>// Create a new presence. Pass in false to indicate we're unavailable.</i></font>
Presence presence = new Presence(Presence.Type.unavailable);
presence.setStatus(<font color="green">"Gone fishing"</font>);
<font color="gray"><i>// Send the packet (assume we have a Connection instance called "con").</i></font>
<font color="gray"><i>// Send the packet (assume we have a XMPPConnection instance called "con").</i></font>
con.sendPacket(presence);
</pre></div>
<p>

View file

@ -29,7 +29,7 @@ A chat creates a new thread of messages (using a thread ID) between two users. T
following code snippet demonstrates how to create a new Chat with a user and then send
them a text message:<p>
<div class="code"><pre><font color="gray"><i>// Assume we've created a Connection name "connection".</i></font>
<div class="code"><pre><font color="gray"><i>// Assume we've created a XMPPConnection name "connection".</i></font>
ChatManager chatmanager = connection.getChatManager();
Chat newChat = chatmanager.createChat(<font
color="green">"jsmith@jivesoftware.com"</font>, new MessageListener() {
@ -98,7 +98,7 @@ will create a new one that does match. To get this new chat, you have to regist
notified when it happens. You can register a message listener to receive all future messages as
part of this handler.<p>
<div class="code"><pre><font color="gray"><i>// Assume we've created a Connection name "connection".</i></font>
<div class="code"><pre><font color="gray"><i>// Assume we've created a XMPPConnection name "connection".</i></font>
ChatManager chatmanager = connection.getChatManager().addChatListener(
new ChatManagerListener() {
@Override

View file

@ -27,7 +27,7 @@ A packet listener is used for event style programming, while a packet collector
result queue of packets that you can do polling and blocking operations on. So, a packet
listener is useful when you want to take some action whenever a packet happens to come in,
while a packet collector is useful when you want to wait for a specific packet to
arrive. Packet collectors and listeners can be created using an <tt>Connection</tt> instance.<p>
arrive. Packet collectors and listeners can be created using an <tt>XMPPConnection</tt> instance.<p>
The <tt>org.jivesoftware.smack.filter.PacketFilter</tt> interface determines which
specific packets will be delivered to a <tt>PacketCollector</tt> or <tt>PacketListener</tt>.
@ -42,7 +42,7 @@ listener:<p>
<font color="gray"><i>// user. We use an AndFilter to combine two other filters.</i></font>
PacketFilter filter = new AndFilter(new PacketTypeFilter(<b>Message.class</b>),
new FromContainsFilter(<font color="green">"mary@jivesoftware.com"</font>));
<font color="gray"><i>// Assume we've created a Connection name "connection".</i></font>
<font color="gray"><i>// Assume we've created a XMPPConnection name "connection".</i></font>
<font color="gray"><i>// First, register a packet collector using the filter we created.</i></font>
PacketCollector myCollector = connection.createPacketCollector(filter);

View file

@ -21,7 +21,7 @@ A roster also allows you to organize users into groups such as "Friends" and
"Co-workers". Other IM systems refer to the roster as the buddy list, contact list,
etc.<p>
A <tt>Roster</tt> instance is obtained using the <tt>Connection.getRoster()</tt>
A <tt>Roster</tt> instance is obtained using the <tt>XMPPConnection.getRoster()</tt>
method.
<p class="subheader">Roster Entries</p>

View file

@ -20,7 +20,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
@ -44,12 +44,12 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
*/
public class CarbonManager extends Manager {
private static Map<Connection, CarbonManager> instances =
Collections.synchronizedMap(new WeakHashMap<Connection, CarbonManager>());
private static Map<XMPPConnection, CarbonManager> instances =
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, CarbonManager>());
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
@ -57,7 +57,7 @@ public class CarbonManager extends Manager {
private volatile boolean enabled_state = false;
private CarbonManager(Connection connection) {
private CarbonManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(CarbonExtension.NAMESPACE);
@ -71,7 +71,7 @@ public class CarbonManager extends Manager {
*
* @return a CarbonManager instance
*/
public static synchronized CarbonManager getInstanceFor(Connection connection) {
public static synchronized CarbonManager getInstanceFor(XMPPConnection connection) {
CarbonManager carbonManager = instances.get(connection);
if (carbonManager == null) {

View file

@ -51,7 +51,7 @@ public class CompressionTest extends SmackTestCase {
// Login with the test account
connection.login("user0", "user0");
assertTrue("Connection is not using stream compression", connection.isUsingCompression());
assertTrue("XMPPConnection is not using stream compression", connection.isUsingCompression());
// Request the version of the server
Version version = new Version();

View file

@ -60,7 +60,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
MultipleRecipientManager.send(getConnection(0), message, to, cc, bcc);
Packet message1 = collector1.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 1 never received the message", message1);
assertNotNull("XMPPConnection 1 never received the message", message1);
MultipleRecipientInfo info1 = MultipleRecipientManager.getMultipleRecipientInfo(message1);
assertNotNull("Message 1 does not contain MultipleRecipientInfo", info1);
assertFalse("Message 1 should be 'replyable'", info1.shouldNotReply());
@ -74,7 +74,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
assertEquals("Incorrect CC address", getBareJID(2), address1);
Packet message2 = collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 2 never received the message", message2);
assertNotNull("XMPPConnection 2 never received the message", message2);
MultipleRecipientInfo info2 = MultipleRecipientManager.getMultipleRecipientInfo(message2);
assertNotNull("Message 2 does not contain MultipleRecipientInfo", info2);
assertFalse("Message 2 should be 'replyable'", info2.shouldNotReply());
@ -88,7 +88,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
assertEquals("Incorrect CC address", getBareJID(2), address2);
Packet message3 = collector3.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 3 never received the message", message3);
assertNotNull("XMPPConnection 3 never received the message", message3);
MultipleRecipientInfo info3 = MultipleRecipientManager.getMultipleRecipientInfo(message3);
assertNotNull("Message 3 does not contain MultipleRecipientInfo", info3);
assertFalse("Message 3 should be 'replyable'", info3.shouldNotReply());
@ -130,7 +130,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
// Get the message and ensure it's ok
Message message1 =
(Message) collector1.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 1 never received the message", message1);
assertNotNull("XMPPConnection 1 never received the message", message1);
MultipleRecipientInfo info = MultipleRecipientManager.getMultipleRecipientInfo(message1);
assertNotNull("Message 1 does not contain MultipleRecipientInfo", info);
assertFalse("Message 1 should be 'replyable'", info.shouldNotReply());
@ -144,7 +144,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
// Get the reply and ensure it's ok
reply1 = (Message) collector0.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 0 never received the reply", reply1);
assertNotNull("XMPPConnection 0 never received the reply", reply1);
info = MultipleRecipientManager.getMultipleRecipientInfo(reply1);
assertNotNull("Replied message does not contain MultipleRecipientInfo", info);
assertFalse("Replied message should be 'replyable'", info.shouldNotReply());
@ -159,7 +159,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
// Get the reply and ensure it's ok
reply2 = (Message) collector1.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 1 never received the reply", reply2);
assertNotNull("XMPPConnection 1 never received the reply", reply2);
info = MultipleRecipientManager.getMultipleRecipientInfo(reply2);
assertNotNull("Replied message does not contain MultipleRecipientInfo", info);
assertFalse("Replied message should be 'replyable'", info.shouldNotReply());
@ -168,19 +168,19 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
// Check that connection2 recevied 3 messages
message1 = (Message) collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection2 didn't receive the 1 message", message1);
assertNotNull("XMPPConnection2 didn't receive the 1 message", message1);
message1 = (Message) collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection2 didn't receive the 2 message", message1);
assertNotNull("XMPPConnection2 didn't receive the 2 message", message1);
message1 = (Message) collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection2 didn't receive the 3 message", message1);
assertNotNull("XMPPConnection2 didn't receive the 3 message", message1);
message1 = (Message) collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNull("Connection2 received 4 messages", message1);
assertNull("XMPPConnection2 received 4 messages", message1);
// Check that connection3 recevied only 1 message (was BCC in the first message)
message1 = (Message) collector3.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection3 didn't receive the 1 message", message1);
assertNotNull("XMPPConnection3 didn't receive the 1 message", message1);
message1 = (Message) collector3.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNull("Connection2 received 2 messages", message1);
assertNull("XMPPConnection2 received 2 messages", message1);
collector0.cancel();
collector1.cancel();
@ -210,7 +210,7 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
// Get the message and ensure it's ok
Message message1 =
(Message) collector1.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection 1 never received the message", message1);
assertNotNull("XMPPConnection 1 never received the message", message1);
MultipleRecipientInfo info = MultipleRecipientManager.getMultipleRecipientInfo(message1);
assertNotNull("Message 1 does not contain MultipleRecipientInfo", info);
assertTrue("Message 1 should be not 'replyable'", info.shouldNotReply());
@ -230,15 +230,15 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
// Check that connection2 recevied 1 messages
message1 = (Message) collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection2 didn't receive the 1 message", message1);
assertNotNull("XMPPConnection2 didn't receive the 1 message", message1);
message1 = (Message) collector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNull("Connection2 received 2 messages", message1);
assertNull("XMPPConnection2 received 2 messages", message1);
// Check that connection3 recevied only 1 message (was BCC in the first message)
message1 = (Message) collector3.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNotNull("Connection3 didn't receive the 1 message", message1);
assertNotNull("XMPPConnection3 didn't receive the 1 message", message1);
message1 = (Message) collector3.nextResult(SmackConfiguration.getPacketReplyTimeout());
assertNull("Connection2 received 2 messages", message1);
assertNull("XMPPConnection2 received 2 messages", message1);
collector1.cancel();
collector2.cancel();

View file

@ -18,7 +18,7 @@ import java.io.OutputStream;
import java.util.Random;
import java.util.concurrent.SynchronousQueue;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter;
@ -53,9 +53,9 @@ public class InBandBytestreamTest extends SmackTestCase {
* @throws XMPPException should not happen
*/
public void testRespondWithErrorOnInBandBytestreamRequest() throws XMPPException {
Connection targetConnection = getConnection(0);
XMPPConnection targetConnection = getConnection(0);
Connection initiatorConnection = getConnection(1);
XMPPConnection initiatorConnection = getConnection(1);
Open open = new Open("sessionID", 1024);
open.setFrom(initiatorConnection.getUser());
@ -78,8 +78,8 @@ public class InBandBytestreamTest extends SmackTestCase {
*/
public void testInBandBytestreamWithIQStanzas() throws Exception {
Connection initiatorConnection = getConnection(0);
Connection targetConnection = getConnection(1);
XMPPConnection initiatorConnection = getConnection(0);
XMPPConnection targetConnection = getConnection(1);
// test data
Random rand = new Random();
@ -132,8 +132,8 @@ public class InBandBytestreamTest extends SmackTestCase {
*/
public void testInBandBytestreamWithMessageStanzas() throws Exception {
Connection initiatorConnection = getConnection(0);
Connection targetConnection = getConnection(1);
XMPPConnection initiatorConnection = getConnection(0);
XMPPConnection targetConnection = getConnection(1);
// test data
Random rand = new Random();
@ -188,9 +188,9 @@ public class InBandBytestreamTest extends SmackTestCase {
*/
public void testBiDirectionalInBandBytestream() throws Exception {
Connection initiatorConnection = getConnection(0);
XMPPConnection initiatorConnection = getConnection(0);
Connection targetConnection = getConnection(1);
XMPPConnection targetConnection = getConnection(1);
// test data
Random rand = new Random();

View file

@ -21,7 +21,7 @@ import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException;
@ -60,7 +60,7 @@ public class Socks5ByteStreamTest extends SmackTestCase {
* @throws XMPPException should not happen
*/
public void testInitializationSocks5FeaturesAndListenerOnStartup() throws XMPPException {
Connection connection = getConnection(0);
XMPPConnection connection = getConnection(0);
assertTrue(ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(
Socks5BytestreamManager.NAMESPACE));
@ -74,9 +74,9 @@ public class Socks5ByteStreamTest extends SmackTestCase {
* @throws XMPPException should not happen
*/
public void testRespondWithErrorOnSocks5BytestreamRequest() throws XMPPException {
Connection targetConnection = getConnection(0);
XMPPConnection targetConnection = getConnection(0);
Connection initiatorConnection = getConnection(1);
XMPPConnection initiatorConnection = getConnection(1);
Bytestream bytestreamInitiation = Socks5PacketUtils.createBytestreamInitiation(
initiatorConnection.getUser(), targetConnection.getUser(), "session_id");
@ -107,8 +107,8 @@ public class Socks5ByteStreamTest extends SmackTestCase {
assertTrue(socks5Proxy.isRunning());
Connection initiatorConnection = getConnection(0);
Connection targetConnection = getConnection(1);
XMPPConnection initiatorConnection = getConnection(0);
XMPPConnection targetConnection = getConnection(1);
// test data
final byte[] data = new byte[] { 1, 2, 3 };
@ -174,8 +174,8 @@ public class Socks5ByteStreamTest extends SmackTestCase {
assertFalse(Socks5Proxy.getSocks5Proxy().isRunning());
Connection initiatorConnection = getConnection(0);
Connection targetConnection = getConnection(1);
XMPPConnection initiatorConnection = getConnection(0);
XMPPConnection targetConnection = getConnection(1);
// test data
final byte[] data = new byte[] { 1, 2, 3 };
@ -243,7 +243,7 @@ public class Socks5ByteStreamTest extends SmackTestCase {
*/
public void testBiDirectionalSocks5BytestreamWithRemoteSocks5Proxy() throws Exception {
Connection initiatorConnection = getConnection(0);
XMPPConnection initiatorConnection = getConnection(0);
// disable local socks5 proxy
SmackConfiguration.setLocalSocks5ProxyEnabled(false);
@ -251,7 +251,7 @@ public class Socks5ByteStreamTest extends SmackTestCase {
assertFalse(Socks5Proxy.getSocks5Proxy().isRunning());
Connection targetConnection = getConnection(1);
XMPPConnection targetConnection = getConnection(1);
// test data
final byte[] data = new byte[] { 1, 2, 3 };

View file

@ -27,7 +27,7 @@ import java.util.TimeZone;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ChatManagerListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.SmackConfiguration;
@ -263,7 +263,7 @@ public class MultiUserChatTest extends SmackTestCase {
// User3 is listening to MUC invitations
MultiUserChat.addInvitationListener(getConnection(2), new InvitationListener() {
public void invitationReceived(
Connection conn,
XMPPConnection conn,
String room,
String inviter,
String reason,
@ -313,7 +313,7 @@ public class MultiUserChatTest extends SmackTestCase {
// User3 is listening to MUC invitations
MultiUserChat.addInvitationListener(getConnection(2), new InvitationListener() {
public void invitationReceived(
Connection conn,
XMPPConnection conn,
String room,
String inviter,
String reason,

View file

@ -71,7 +71,7 @@ public class MultipleRecipientInfo {
/**
* Returns true if the received packet should not be replied. Use
* {@link MultipleRecipientManager#reply(org.jivesoftware.smack.Connection, org.jivesoftware.smack.packet.Message, org.jivesoftware.smack.packet.Message)}
* {@link MultipleRecipientManager#reply(org.jivesoftware.smack.XMPPConnection, org.jivesoftware.smack.packet.Message, org.jivesoftware.smack.packet.Message)}
* to send replies.
*
* @return true if the received packet should not be replied.

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.address;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
@ -68,7 +68,7 @@ public class MultipleRecipientManager {
* @throws XMPPException if server does not support JEP-33: Extended Stanza Addressing and
* some JEP-33 specific features were requested.
*/
public static void send(Connection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc)
public static void send(XMPPConnection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc)
throws XMPPException {
send(connection, packet, to, cc, bcc, null, null, false);
}
@ -96,7 +96,7 @@ public class MultipleRecipientManager {
* @throws XMPPException if server does not support JEP-33: Extended Stanza Addressing and
* some JEP-33 specific features were requested.
*/
public static void send(Connection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc,
public static void send(XMPPConnection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc,
String replyTo, String replyRoom, boolean noReply) throws XMPPException {
String serviceAddress = getMultipleRecipienServiceAddress(connection);
if (serviceAddress != null) {
@ -128,7 +128,7 @@ public class MultipleRecipientManager {
* @throws XMPPException if the original message was not sent to multiple recipients, or the
* original message cannot be replied or reply should be sent to a room.
*/
public static void reply(Connection connection, Message original, Message reply)
public static void reply(XMPPConnection connection, Message original, Message reply)
throws XMPPException {
MultipleRecipientInfo info = getMultipleRecipientInfo(original);
if (info == null) {
@ -202,7 +202,7 @@ public class MultipleRecipientManager {
return extension == null ? null : new MultipleRecipientInfo(extension);
}
private static void sendToIndividualRecipients(Connection connection, Packet packet,
private static void sendToIndividualRecipients(XMPPConnection connection, Packet packet,
List<String> to, List<String> cc, List<String> bcc) {
if (to != null) {
for (Iterator<String> it = to.iterator(); it.hasNext();) {
@ -227,7 +227,7 @@ public class MultipleRecipientManager {
}
}
private static void sendThroughService(Connection connection, Packet packet, List<String> to,
private static void sendThroughService(XMPPConnection connection, Packet packet, List<String> to,
List<String> cc, List<String> bcc, String replyTo, String replyRoom, boolean noReply,
String serviceAddress) {
// Create multiple recipient extension
@ -281,7 +281,7 @@ public class MultipleRecipientManager {
* queried.
* @return the address of the multiple recipients service or <tt>null</tt> if none was found.
*/
private static String getMultipleRecipienServiceAddress(Connection connection) {
private static String getMultipleRecipienServiceAddress(XMPPConnection connection) {
String serviceName = connection.getServiceName();
String serviceAddress = (String) services.get(serviceName);
if (serviceAddress == null) {

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.amp;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
public class AMPDeliverCondition implements AMPExtension.Condition {
@ -27,7 +27,7 @@ public class AMPDeliverCondition implements AMPExtension.Condition {
* @param connection Smack connection instance
* @return true if deliver condition is supported.
*/
public static boolean isSupported(Connection connection) {
public static boolean isSupported(XMPPConnection connection) {
return AMPManager.isConditionSupported(connection, NAME);
}

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.amp;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.util.XmppDateTime;
import java.util.Date;
@ -31,7 +31,7 @@ public class AMPExpireAtCondition implements AMPExtension.Condition {
* @param connection Smack connection instance
* @return true if expire-at condition is supported.
*/
public static boolean isSupported(Connection connection) {
public static boolean isSupported(XMPPConnection connection) {
return AMPManager.isConditionSupported(connection, NAME);
}

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.amp;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
@ -38,8 +38,8 @@ public class AMPManager {
// Enable the AMP support on every established connection
// The ServiceDiscoveryManager class should have been already initialized
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
AMPManager.setServiceEnabled(connection, true);
}
});
@ -54,7 +54,7 @@ public class AMPManager {
* @param connection the connection where the service will be enabled or disabled
* @param enabled indicates if the service will be enabled or disabled
*/
public synchronized static void setServiceEnabled(Connection connection, boolean enabled) {
public synchronized static void setServiceEnabled(XMPPConnection connection, boolean enabled) {
if (isServiceEnabled(connection) == enabled)
return;
@ -72,7 +72,7 @@ public class AMPManager {
* @param connection the connection to look for AMP support
* @return a boolean indicating if the AMP support is enabled for the given connection
*/
public static boolean isServiceEnabled(Connection connection) {
public static boolean isServiceEnabled(XMPPConnection connection) {
connection.getServiceName();
return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(AMPExtension.NAMESPACE);
}
@ -83,7 +83,7 @@ public class AMPManager {
* @param action action to check
* @return true if this action is supported.
*/
public static boolean isActionSupported(Connection connection, AMPExtension.Action action) {
public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) {
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
return isFeatureSupportedByServer(connection, featureName, AMPExtension.NAMESPACE);
}
@ -97,12 +97,12 @@ public class AMPManager {
* @see AMPExpireAtCondition
* @see AMPMatchResourceCondition
*/
public static boolean isConditionSupported(Connection connection, String conditionName) {
public static boolean isConditionSupported(XMPPConnection connection, String conditionName) {
String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName;
return isFeatureSupportedByServer(connection, featureName, AMPExtension.NAMESPACE);
}
private static boolean isFeatureSupportedByServer(Connection connection, String featureName, String node) {
private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) {
try {
ServiceDiscoveryManager discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
DiscoverInfo info = discoveryManager.discoverInfo(connection.getServiceName(), node);

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.amp;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
public class AMPMatchResourceCondition implements AMPExtension.Condition {
@ -27,7 +27,7 @@ public class AMPMatchResourceCondition implements AMPExtension.Condition {
* @param connection Smack connection instance
* @return true if match-resource condition is supported.
*/
public static boolean isSupported(Connection connection) {
public static boolean isSupported(XMPPConnection connection) {
return AMPManager.isConditionSupported(connection, NAME);
}

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.bookmarks;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.iqprivate.PrivateDataManager;
@ -34,7 +34,7 @@ import java.util.*;
* @author Alexander Wenckus
*/
public class BookmarkManager {
private static final Map<Connection, BookmarkManager> bookmarkManagerMap = new HashMap<Connection, BookmarkManager>();
private static final Map<XMPPConnection, BookmarkManager> bookmarkManagerMap = new HashMap<XMPPConnection, BookmarkManager>();
static {
PrivateDataManager.addPrivateDataProvider("storage", "storage:bookmarks",
new Bookmarks.Provider());
@ -48,7 +48,7 @@ public class BookmarkManager {
* exist it is created.
* @throws XMPPException Thrown if the connection is null or has not yet been authenticated.
*/
public synchronized static BookmarkManager getBookmarkManager(Connection connection)
public synchronized static BookmarkManager getBookmarkManager(XMPPConnection connection)
throws XMPPException
{
BookmarkManager manager = (BookmarkManager) bookmarkManagerMap.get(connection);
@ -70,7 +70,7 @@ public class BookmarkManager {
* @param connection the connection for persisting and retrieving bookmarks.
* @throws XMPPException thrown when the connection is null or has not been authenticated.
*/
private BookmarkManager(Connection connection) throws XMPPException {
private BookmarkManager(XMPPConnection connection) throws XMPPException {
if(connection == null || !connection.isAuthenticated()) {
throw new XMPPException("Invalid connection.");
}

View file

@ -33,7 +33,7 @@ import java.util.List;
* See the following code sample for saving Bookmarks:
* <p/>
* <pre>
* Connection con = new TCPConnection("jabber.org");
* XMPPConnection con = new TCPConnection("jabber.org");
* con.login("john", "doe");
* Bookmarks bookmarks = new Bookmarks();
* <p/>

View file

@ -25,7 +25,7 @@ import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
@ -96,8 +96,8 @@ public class InBandBytestreamManager implements BytestreamManager {
* connection
*/
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(final Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(final XMPPConnection connection) {
// create the manager for this connection
InBandBytestreamManager.getByteStreamManager(connection);
@ -143,10 +143,10 @@ public class InBandBytestreamManager implements BytestreamManager {
private final static Random randomGenerator = new Random();
/* stores one InBandBytestreamManager for each XMPP connection */
private final static Map<Connection, InBandBytestreamManager> managers = new HashMap<Connection, InBandBytestreamManager>();
private final static Map<XMPPConnection, InBandBytestreamManager> managers = new HashMap<XMPPConnection, InBandBytestreamManager>();
/* XMPP connection */
private final Connection connection;
private final XMPPConnection connection;
/*
* assigns a user to a listener that is informed if an In-Band Bytestream request for this user
@ -189,12 +189,12 @@ public class InBandBytestreamManager implements BytestreamManager {
/**
* Returns the InBandBytestreamManager to handle In-Band Bytestreams for a given
* {@link Connection}.
* {@link XMPPConnection}.
*
* @param connection the XMPP connection
* @return the InBandBytestreamManager for the given XMPP connection
*/
public static synchronized InBandBytestreamManager getByteStreamManager(Connection connection) {
public static synchronized InBandBytestreamManager getByteStreamManager(XMPPConnection connection) {
if (connection == null)
return null;
InBandBytestreamManager manager = managers.get(connection);
@ -210,7 +210,7 @@ public class InBandBytestreamManager implements BytestreamManager {
*
* @param connection the XMPP connection
*/
private InBandBytestreamManager(Connection connection) {
private InBandBytestreamManager(XMPPConnection connection) {
this.connection = connection;
// register bytestream open packet listener
@ -489,7 +489,7 @@ public class InBandBytestreamManager implements BytestreamManager {
*
* @return the XMPP connection
*/
protected Connection getConnection() {
protected XMPPConnection getConnection() {
return this.connection;
}

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.bytestreams.ibb;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
@ -70,7 +70,7 @@ public class InBandBytestreamRequest implements BytestreamRequest {
* @throws XMPPException if stream is invalid.
*/
public InBandBytestreamSession accept() throws XMPPException {
Connection connection = this.manager.getConnection();
XMPPConnection connection = this.manager.getConnection();
// create In-Band Bytestream session and store it
InBandBytestreamSession ibbSession = new InBandBytestreamSession(connection,

View file

@ -24,7 +24,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
@ -58,7 +58,7 @@ import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
public class InBandBytestreamSession implements BytestreamSession {
/* XMPP connection */
private final Connection connection;
private final XMPPConnection connection;
/* the In-Band Bytestream open request for this session */
private final Open byteStreamRequest;
@ -89,7 +89,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* @param byteStreamRequest the In-Band Bytestream open request for this session
* @param remoteJID JID of the remote peer
*/
protected InBandBytestreamSession(Connection connection, Open byteStreamRequest,
protected InBandBytestreamSession(XMPPConnection connection, Open byteStreamRequest,
String remoteJID) {
this.connection = connection;
this.byteStreamRequest = byteStreamRequest;

View file

@ -30,7 +30,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
@ -89,9 +89,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* connection
*/
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(final Connection connection) {
public void connectionCreated(final XMPPConnection connection) {
// create the manager for this connection
Socks5BytestreamManager.getBytestreamManager(connection);
@ -132,10 +132,10 @@ public final class Socks5BytestreamManager implements BytestreamManager {
private final static Random randomGenerator = new Random();
/* stores one Socks5BytestreamManager for each XMPP connection */
private final static Map<Connection, Socks5BytestreamManager> managers = new HashMap<Connection, Socks5BytestreamManager>();
private final static Map<XMPPConnection, Socks5BytestreamManager> managers = new HashMap<XMPPConnection, Socks5BytestreamManager>();
/* XMPP connection */
private final Connection connection;
private final XMPPConnection connection;
/*
* assigns a user to a listener that is informed if a bytestream request for this user is
@ -175,7 +175,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
/**
* Returns the Socks5BytestreamManager to handle SOCKS5 Bytestreams for a given
* {@link Connection}.
* {@link XMPPConnection}.
* <p>
* If no manager exists a new is created and initialized.
*
@ -183,7 +183,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* <code>null</code>
* @return the Socks5BytestreamManager for the given XMPP connection
*/
public static synchronized Socks5BytestreamManager getBytestreamManager(Connection connection) {
public static synchronized Socks5BytestreamManager getBytestreamManager(XMPPConnection connection) {
if (connection == null) {
return null;
}
@ -201,7 +201,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
*
* @param connection the XMPP connection
*/
private Socks5BytestreamManager(Connection connection) {
private Socks5BytestreamManager(XMPPConnection connection) {
this.connection = connection;
this.initiationListener = new InitiationListener(this);
}
@ -284,7 +284,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* service discovery, disabling the listener for SOCKS5 Bytestream initiation requests and
* resetting its internal state, which includes removing this instance from the managers map.
* <p>
* To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(Connection)}.
* To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(XMPPConnection)}.
* Using the file transfer API will automatically re-enable the SOCKS5 Bytestream feature.
*/
public synchronized void disableService() {
@ -745,7 +745,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
*
* @return the XMPP connection
*/
protected Connection getConnection() {
protected XMPPConnection getConnection() {
return this.connection;
}

View file

@ -20,7 +20,7 @@ import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
@ -37,7 +37,7 @@ import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
class Socks5ClientForInitiator extends Socks5Client {
/* the XMPP connection used to communicate with the SOCKS5 proxy */
private Connection connection;
private XMPPConnection connection;
/* the session ID used to activate SOCKS5 stream */
private String sessionID;
@ -54,7 +54,7 @@ class Socks5ClientForInitiator extends Socks5Client {
* @param sessionID the session ID of the SOCKS5 Bytestream
* @param target the target JID of the SOCKS5 Bytestream
*/
public Socks5ClientForInitiator(StreamHost streamHost, String digest, Connection connection,
public Socks5ClientForInitiator(StreamHost streamHost, String digest, XMPPConnection connection,
String sessionID, String target) {
super(streamHost, digest);
this.connection = connection;

View file

@ -452,7 +452,7 @@ public class Socks5Proxy {
out.write(connectionRequest);
out.flush();
throw new XMPPException("Connection is not allowed");
throw new XMPPException("XMPPConnection is not allowed");
}
connectionRequest[1] = (byte) 0x00; // set return status to 0 (success)

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.caps;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager;
@ -79,8 +79,8 @@ public class EntityCapsManager extends Manager {
private static boolean autoEnableEntityCaps = true;
private static Map<Connection, EntityCapsManager> instances = Collections
.synchronizedMap(new WeakHashMap<Connection, EntityCapsManager>());
private static Map<XMPPConnection, EntityCapsManager> instances = Collections
.synchronizedMap(new WeakHashMap<XMPPConnection, EntityCapsManager>());
/**
* Map of (node + '#" + hash algorithm) to DiscoverInfo data
@ -96,8 +96,8 @@ public class EntityCapsManager extends Manager {
protected static Map<String, NodeVerHash> jidCaps = new Cache<String, NodeVerHash>(10000, -1);
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
@ -219,7 +219,7 @@ public class EntityCapsManager extends Manager {
((Cache) caps).setMaxCacheSize(maxCacheSize);
}
private EntityCapsManager(Connection connection) {
private EntityCapsManager(XMPPConnection connection) {
super(connection);
this.sdm = ServiceDiscoveryManager.getInstanceFor(connection);
instances.put(connection, this);
@ -317,7 +317,7 @@ public class EntityCapsManager extends Manager {
sdm.setEntityCapsManager(this);
}
public static synchronized EntityCapsManager getInstanceFor(Connection connection) {
public static synchronized EntityCapsManager getInstanceFor(XMPPConnection connection) {
if (SUPPORTED_HASHES.size() <= 0)
throw new IllegalStateException("No supported hashes for EntityCapsManager");
@ -413,7 +413,7 @@ public class EntityCapsManager extends Manager {
* the local users extended info
*/
public void updateLocalEntityCaps() {
Connection connection = connection();
XMPPConnection connection = connection();
DiscoverInfo discoverInfo = new DiscoverInfo();
discoverInfo.setType(IQ.Type.RESULT);

View file

@ -22,7 +22,7 @@ import java.util.WeakHashMap;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ChatManagerListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketInterceptor;
@ -38,11 +38,11 @@ import org.jivesoftware.smackx.chatstates.packet.ChatStateExtension;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
/**
* Handles chat state for all chats on a particular Connection. This class manages both the
* Handles chat state for all chats on a particular XMPPConnection. This class manages both the
* packet extensions and the disco response neccesary for compliance with
* <a href="http://www.xmpp.org/extensions/xep-0085.html">XEP-0085</a>.
*
* NOTE: {@link org.jivesoftware.smackx.chatstates.ChatStateManager#getInstance(org.jivesoftware.smack.Connection)}
* NOTE: {@link org.jivesoftware.smackx.chatstates.ChatStateManager#getInstance(org.jivesoftware.smack.XMPPConnection)}
* needs to be called in order for the listeners to be registered appropriately with the connection.
* If this does not occur you will not receive the update notifications.
*
@ -53,19 +53,19 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
public class ChatStateManager extends Manager {
public static final String NAMESPACE = "http://jabber.org/protocol/chatstates";
private static final Map<Connection, ChatStateManager> INSTANCES =
new WeakHashMap<Connection, ChatStateManager>();
private static final Map<XMPPConnection, ChatStateManager> INSTANCES =
new WeakHashMap<XMPPConnection, ChatStateManager>();
private static final PacketFilter filter = new NotFilter(new PacketExtensionFilter(NAMESPACE));
/**
* Returns the ChatStateManager related to the Connection and it will create one if it does
* Returns the ChatStateManager related to the XMPPConnection and it will create one if it does
* not yet exist.
*
* @param connection the connection to return the ChatStateManager
* @return the ChatStateManager related the the connection.
*/
public static synchronized ChatStateManager getInstance(final Connection connection) {
public static synchronized ChatStateManager getInstance(final XMPPConnection connection) {
ChatStateManager manager = INSTANCES.get(connection);
if (manager == null) {
manager = new ChatStateManager(connection);
@ -83,7 +83,7 @@ public class ChatStateManager extends Manager {
private final Map<Chat, ChatState> chatStates =
new ReferenceMap<Chat, ChatState>(ReferenceMap.WEAK, ReferenceMap.HARD);
private ChatStateManager(Connection connection) {
private ChatStateManager(XMPPConnection connection) {
super(connection);
connection.getChatManager().addOutgoingMessageInterceptor(outgoingInterceptor, filter);
connection.getChatManager().addChatListener(incomingInterceptor);

View file

@ -47,8 +47,8 @@ import java.util.concurrent.ConcurrentHashMap;
* An AdHocCommandManager is responsible for keeping the list of available
* commands offered by a service and for processing commands requests.
*
* Pass in a Connection instance to
* {@link #getAddHocCommandsManager(org.jivesoftware.smack.Connection)} in order to
* Pass in a XMPPConnection instance to
* {@link #getAddHocCommandsManager(org.jivesoftware.smack.XMPPConnection)} in order to
* get an instance of this class.
*
* @author Gabriel Guardincerri
@ -62,11 +62,11 @@ public class AdHocCommandManager extends Manager {
private static final int SESSION_TIMEOUT = 2 * 60;
/**
* Map a Connection with it AdHocCommandManager. This map have a key-value
* Map a XMPPConnection with it AdHocCommandManager. This map have a key-value
* pair for every active connection.
*/
private static Map<Connection, AdHocCommandManager> instances =
Collections.synchronizedMap(new WeakHashMap<Connection, AdHocCommandManager>());
private static Map<XMPPConnection, AdHocCommandManager> instances =
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, AdHocCommandManager>());
/**
* Register the listener for all the connection creations. When a new
@ -74,8 +74,8 @@ public class AdHocCommandManager extends Manager {
* related to that connection.
*/
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getAddHocCommandsManager(connection);
}
});
@ -88,7 +88,7 @@ public class AdHocCommandManager extends Manager {
* @param connection the XMPP connection.
* @return the AdHocCommandManager associated with the connection.
*/
public static synchronized AdHocCommandManager getAddHocCommandsManager(Connection connection) {
public static synchronized AdHocCommandManager getAddHocCommandsManager(XMPPConnection connection) {
AdHocCommandManager ahcm = instances.get(connection);
if (ahcm == null) ahcm = new AdHocCommandManager(connection);
return ahcm;
@ -116,7 +116,7 @@ public class AdHocCommandManager extends Manager {
*/
private Thread sessionsSweeper;
private AdHocCommandManager(Connection connection) {
private AdHocCommandManager(XMPPConnection connection) {
super(connection);
this.serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);

View file

@ -18,7 +18,7 @@
package org.jivesoftware.smackx.commands;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
@ -43,7 +43,7 @@ public class RemoteCommand extends AdHocCommand {
/**
* The connection that is used to execute this command
*/
private Connection connection;
private XMPPConnection connection;
/**
* The full JID of the command host
@ -71,7 +71,7 @@ public class RemoteCommand extends AdHocCommand {
* @param node the identifier of the command.
* @param jid the JID of the host.
*/
protected RemoteCommand(Connection connection, String node, String jid) {
protected RemoteCommand(XMPPConnection connection, String node, String jid) {
super();
this.connection = connection;
this.jid = jid;

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.disco;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
@ -69,8 +69,8 @@ public class ServiceDiscoveryManager extends Manager {
private EntityCapsManager capsManager;
private static Map<Connection, ServiceDiscoveryManager> instances =
Collections.synchronizedMap(new WeakHashMap<Connection, ServiceDiscoveryManager>());
private static Map<XMPPConnection, ServiceDiscoveryManager> instances =
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, ServiceDiscoveryManager>());
private final Set<String> features = new HashSet<String>();
private DataForm extendedInfo = null;
@ -79,8 +79,8 @@ public class ServiceDiscoveryManager extends Manager {
// Create a new ServiceDiscoveryManager on every established connection
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
@ -97,13 +97,13 @@ public class ServiceDiscoveryManager extends Manager {
}
/**
* Creates a new ServiceDiscoveryManager for a given Connection. This means that the
* Creates a new ServiceDiscoveryManager for a given XMPPConnection. This means that the
* service manager will respond to any service discovery request that the connection may
* receive.
*
* @param connection the connection to which a ServiceDiscoveryManager is going to be created.
*/
private ServiceDiscoveryManager(Connection connection) {
private ServiceDiscoveryManager(XMPPConnection connection) {
super(connection);
// Register the new instance and associate it with the connection
instances.put(connection, this);
@ -115,7 +115,7 @@ public class ServiceDiscoveryManager extends Manager {
PacketFilter packetFilter = new PacketTypeFilter(DiscoverItems.class);
PacketListener packetListener = new PacketListener() {
public void processPacket(Packet packet) {
Connection connection = connection();
XMPPConnection connection = connection();
if (connection == null) return;
DiscoverItems discoverItems = (DiscoverItems) packet;
// Send back the items defined in the client if the request is of type GET
@ -152,7 +152,7 @@ public class ServiceDiscoveryManager extends Manager {
packetFilter = new PacketTypeFilter(DiscoverInfo.class);
packetListener = new PacketListener() {
public void processPacket(Packet packet) {
Connection connection = connection();
XMPPConnection connection = connection();
if (connection == null) return;
DiscoverInfo discoverInfo = (DiscoverInfo) packet;
// Answer the client's supported features if the request is of the GET type
@ -281,12 +281,12 @@ public class ServiceDiscoveryManager extends Manager {
}
/**
* Returns the ServiceDiscoveryManager instance associated with a given Connection.
* Returns the ServiceDiscoveryManager instance associated with a given XMPPConnection.
*
* @param connection the connection used to look for the proper ServiceDiscoveryManager.
* @return the ServiceDiscoveryManager associated with a given Connection.
* @return the ServiceDiscoveryManager associated with a given XMPPConnection.
*/
public static synchronized ServiceDiscoveryManager getInstanceFor(Connection connection) {
public static synchronized ServiceDiscoveryManager getInstanceFor(XMPPConnection connection) {
ServiceDiscoveryManager sdm = instances.get(connection);
if (sdm == null) {
sdm = new ServiceDiscoveryManager(connection);

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.filetransfer;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.OrFilter;
import org.jivesoftware.smack.filter.PacketFilter;
@ -40,11 +40,11 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
private StreamNegotiator primaryNegotiator;
private StreamNegotiator secondaryNegotiator;
private Connection connection;
private XMPPConnection connection;
private PacketFilter primaryFilter;
private PacketFilter secondaryFilter;
public FaultTolerantNegotiator(Connection connection, StreamNegotiator primary,
public FaultTolerantNegotiator(XMPPConnection connection, StreamNegotiator primary,
StreamNegotiator secondary) {
this.primaryNegotiator = primary;
this.secondaryNegotiator = secondary;
@ -64,7 +64,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
"stream method.");
}
final Packet initiateIncomingStream(Connection connection, StreamInitiation initiation) {
final Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) {
throw new UnsupportedOperationException("Initiation handled by createIncomingStream " +
"method");
}

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.filetransfer;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.IQTypeFilter;
import org.jivesoftware.smack.filter.PacketTypeFilter;
@ -48,15 +48,15 @@ public class FileTransferManager {
private List<FileTransferListener> listeners;
private Connection connection;
private XMPPConnection connection;
/**
* Creates a file transfer manager to initiate and receive file transfers.
*
* @param connection
* The Connection that the file transfers will use.
* The XMPPConnection that the file transfers will use.
*/
public FileTransferManager(Connection connection) {
public FileTransferManager(XMPPConnection connection) {
this.connection = connection;
this.fileTransferNegotiator = FileTransferNegotiator
.getInstanceFor(connection);

View file

@ -27,7 +27,7 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.XMPPException;
@ -58,8 +58,8 @@ public class FileTransferNegotiator {
"http://jabber.org/protocol/si/profile/file-transfer",
"http://jabber.org/protocol/si"};
private static final Map<Connection, FileTransferNegotiator> transferObject =
new ConcurrentHashMap<Connection, FileTransferNegotiator>();
private static final Map<XMPPConnection, FileTransferNegotiator> transferObject =
new ConcurrentHashMap<XMPPConnection, FileTransferNegotiator>();
private static final String STREAM_INIT_PREFIX = "jsi_";
@ -83,9 +83,9 @@ public class FileTransferNegotiator {
* @return The IMFileTransferManager
*/
public static FileTransferNegotiator getInstanceFor(
final Connection connection) {
final XMPPConnection connection) {
if (connection == null) {
throw new IllegalArgumentException("Connection cannot be null");
throw new IllegalArgumentException("XMPPConnection cannot be null");
}
if (!connection.isConnected()) {
return null;
@ -110,7 +110,7 @@ public class FileTransferNegotiator {
* @param connection The connection on which to enable or disable the services.
* @param isEnabled True to enable, false to disable.
*/
public static void setServiceEnabled(final Connection connection,
public static void setServiceEnabled(final XMPPConnection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
@ -141,7 +141,7 @@ public class FileTransferNegotiator {
* @param connection The connection to check
* @return True if all related services are enabled, false if they are not.
*/
public static boolean isServiceEnabled(final Connection connection) {
public static boolean isServiceEnabled(final XMPPConnection connection) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
@ -200,13 +200,13 @@ public class FileTransferNegotiator {
// non-static
private final Connection connection;
private final XMPPConnection connection;
private final StreamNegotiator byteStreamTransferManager;
private final StreamNegotiator inbandTransferManager;
private FileTransferNegotiator(final Connection connection) {
private FileTransferNegotiator(final XMPPConnection connection) {
configureConnection(connection);
this.connection = connection;
@ -214,7 +214,7 @@ public class FileTransferNegotiator {
inbandTransferManager = new IBBTransferNegotiator(connection);
}
private void configureConnection(final Connection connection) {
private void configureConnection(final XMPPConnection connection) {
connection.addConnectionListener(new ConnectionListener() {
public void connectionClosed() {
cleanup(connection);
@ -238,7 +238,7 @@ public class FileTransferNegotiator {
});
}
private void cleanup(final Connection connection) {
private void cleanup(final XMPPConnection connection) {
if (transferObject.remove(connection) != null) {
inbandTransferManager.cleanup();
}

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.filetransfer;
import java.io.InputStream;
import java.io.OutputStream;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.FromMatchesFilter;
@ -45,7 +45,7 @@ import org.jivesoftware.smackx.si.packet.StreamInitiation;
*/
public class IBBTransferNegotiator extends StreamNegotiator {
private Connection connection;
private XMPPConnection connection;
private InBandBytestreamManager manager;
@ -54,7 +54,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
*
* @param connection The connection which this negotiator works on.
*/
protected IBBTransferNegotiator(Connection connection) {
protected IBBTransferNegotiator(XMPPConnection connection) {
this.connection = connection;
this.manager = InBandBytestreamManager.getByteStreamManager(connection);
}

View file

@ -21,7 +21,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PushbackInputStream;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.FromMatchesFilter;
@ -44,11 +44,11 @@ import org.jivesoftware.smackx.si.packet.StreamInitiation;
*/
public class Socks5TransferNegotiator extends StreamNegotiator {
private Connection connection;
private XMPPConnection connection;
private Socks5BytestreamManager manager;
Socks5TransferNegotiator(Connection connection) {
Socks5TransferNegotiator(XMPPConnection connection) {
this.connection = connection;
this.manager = Socks5BytestreamManager.getBytestreamManager(this.connection);
}

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.filetransfer;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.IQ;
@ -77,7 +77,7 @@ public abstract class StreamNegotiator {
return iq;
}
Packet initiateIncomingStream(Connection connection, StreamInitiation initiation) throws XMPPException {
Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws XMPPException {
StreamInitiation response = createInitiationAccept(initiation,
getNamespaces());

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.iqlast;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPException;
@ -54,7 +54,7 @@ import org.jivesoftware.smackx.iqlast.packet.LastActivity;
* <p>
*
* <pre>
* Connection con = new TCPConnection(&quot;jabber.org&quot;);
* XMPPConnection con = new TCPConnection(&quot;jabber.org&quot;);
* con.login(&quot;john&quot;, &quot;doe&quot;);
* LastActivity activity = LastActivity.getLastActivity(con, &quot;xray@jabber.org/Smack&quot;);
* </pre>
@ -83,12 +83,12 @@ public class LastActivityManager {
private long lastMessageSent;
private Connection connection;
private XMPPConnection connection;
// Enable the LastActivity support on every established connection
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
new LastActivityManager(connection);
}
});
@ -98,9 +98,9 @@ public class LastActivityManager {
* Creates a last activity manager to response last activity requests.
*
* @param connection
* The Connection that the last activity requests will use.
* The XMPPConnection that the last activity requests will use.
*/
private LastActivityManager(Connection connection) {
private LastActivityManager(XMPPConnection connection) {
this.connection = connection;
// Listen to all the sent messages to reset the idle time on each one
@ -185,14 +185,14 @@ public class LastActivityManager {
* 'host') the last activity is the uptime.
*
* @param con
* the current Connection.
* the current XMPPConnection.
* @param jid
* the JID of the user.
* @return the LastActivity packet of the jid.
* @throws XMPPException
* thrown if a server error has occured.
*/
public static LastActivity getLastActivity(Connection con, String jid) throws XMPPException {
public static LastActivity getLastActivity(XMPPConnection con, String jid) throws XMPPException {
LastActivity activity = new LastActivity();
activity.setTo(jid);
@ -207,7 +207,7 @@ public class LastActivityManager {
* @param jid a JID to be tested for Last Activity support
* @return true if Last Activity is supported, otherwise false
*/
public static boolean isLastActivitySupported(Connection connection, String jid) {
public static boolean isLastActivitySupported(XMPPConnection connection, String jid) {
try {
DiscoverInfo result =
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(jid);

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.iqlast.packet;
import java.io.IOException;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
@ -128,14 +128,14 @@ public class LastActivity extends IQ {
/**
* Retrieve the last activity of a particular jid.
* @param con the current Connection.
* @param con the current XMPPConnection.
* @param jid the JID of the user.
* @return the LastActivity packet of the jid.
* @throws XMPPException thrown if a server error has occured.
* @deprecated This method only retreives the lapsed time since the last logout of a particular jid.
* Replaced by {@link org.jivesoftware.smackx.iqlast.LastActivityManager#getLastActivity(Connection, String) getLastActivity}
* Replaced by {@link org.jivesoftware.smackx.iqlast.LastActivityManager#getLastActivity(XMPPConnection, String) getLastActivity}
*/
public static LastActivity getLastActivity(Connection con, String jid) throws XMPPException {
public static LastActivity getLastActivity(XMPPConnection con, String jid) throws XMPPException {
LastActivity activity = new LastActivity();
jid = StringUtils.parseBareAddress(jid);
activity.setTo(jid);

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.iqprivate;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
@ -112,7 +112,7 @@ public class PrivateDataManager {
}
private Connection connection;
private XMPPConnection connection;
/**
* The user to get and set private data for. In most cases, this value should
@ -129,7 +129,7 @@ public class PrivateDataManager {
* @param connection an XMPP connection which must have already undergone a
* successful login.
*/
public PrivateDataManager(Connection connection) {
public PrivateDataManager(XMPPConnection connection) {
if (!connection.isAuthenticated()) {
throw new IllegalStateException("Must be logged in to XMPP server.");
}
@ -148,7 +148,7 @@ public class PrivateDataManager {
* successful login.
* @param user the XMPP address of the user to get and set private data for.
*/
public PrivateDataManager(Connection connection, String user) {
public PrivateDataManager(XMPPConnection connection, String user) {
if (!connection.isAuthenticated()) {
throw new IllegalStateException("Must be logged in to XMPP server.");
}

View file

@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.filter.AndFilter;
@ -49,12 +49,12 @@ import org.jivesoftware.smackx.iqversion.packet.Version;
* @author Georg Lukas
*/
public class VersionManager extends Manager {
private static final Map<Connection, VersionManager> instances =
Collections.synchronizedMap(new WeakHashMap<Connection, VersionManager>());
private static final Map<XMPPConnection, VersionManager> instances =
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, VersionManager>());
private Version own_version;
private VersionManager(final Connection connection) {
private VersionManager(final XMPPConnection connection) {
super(connection);
instances.put(connection, this);
@ -78,7 +78,7 @@ public class VersionManager extends Manager {
, new AndFilter(new PacketTypeFilter(Version.class), new IQTypeFilter(Type.GET)));
}
public static synchronized VersionManager getInstanceFor(Connection connection) {
public static synchronized VersionManager getInstanceFor(XMPPConnection connection) {
VersionManager versionManager = instances.get(connection);
if (versionManager == null) {

View file

@ -25,7 +25,7 @@ import org.jivesoftware.smack.packet.Packet;
/**
* A variant of the {@link org.jivesoftware.smack.PacketCollector} class
* that does not force attachment to a <code>Connection</code>
* that does not force attachment to a <code>XMPPConnection</code>
* on creation and no filter is required. Used to collect message
* packets targeted to a group chat room.
*

View file

@ -22,9 +22,9 @@ import org.jivesoftware.smackx.disco.packet.DiscoverItems;
* Hosted rooms by a chat service may be discovered if they are configured to appear in the room
* directory . The information that may be discovered is the XMPP address of the room and the room
* name. The address of the room may be used for obtaining more detailed information
* {@link org.jivesoftware.smackx.muc.MultiUserChat#getRoomInfo(org.jivesoftware.smack.Connection, String)}
* {@link org.jivesoftware.smackx.muc.MultiUserChat#getRoomInfo(org.jivesoftware.smack.XMPPConnection, String)}
* or could be used for joining the room
* {@link org.jivesoftware.smackx.muc.MultiUserChat#MultiUserChat(org.jivesoftware.smack.Connection, String)}
* {@link org.jivesoftware.smackx.muc.MultiUserChat#MultiUserChat(org.jivesoftware.smack.XMPPConnection, String)}
* and {@link org.jivesoftware.smackx.muc.MultiUserChat#join(String)}.
*
* @author Gaston Dombiak

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Message;
/**
@ -33,14 +33,14 @@ public interface InvitationListener {
* If the room is password-protected, the invitee will receive a password to use to join
* the room. If the room is members-only, the the invitee may be added to the member list.
*
* @param conn the Connection that received the invitation.
* @param conn the XMPPConnection that received the invitation.
* @param room the room that invitation refers to.
* @param inviter the inviter that sent the invitation. (e.g. crone1@shakespeare.lit).
* @param reason the reason why the inviter sent the invitation.
* @param password the password to use when joining the room.
* @param message the message used by the inviter to send the invitation.
*/
public abstract void invitationReceived(Connection conn, String room, String inviter, String reason,
public abstract void invitationReceived(XMPPConnection conn, String room, String inviter, String reason,
String password, Message message);
}

View file

@ -40,7 +40,7 @@ import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.PacketInterceptor;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.FromMatchesFilter;
@ -80,10 +80,10 @@ public class MultiUserChat {
private final static String discoNamespace = "http://jabber.org/protocol/muc";
private final static String discoNode = "http://jabber.org/protocol/muc#rooms";
private static Map<Connection, List<String>> joinedRooms =
new WeakHashMap<Connection, List<String>>();
private static Map<XMPPConnection, List<String>> joinedRooms =
new WeakHashMap<XMPPConnection, List<String>>();
private Connection connection;
private XMPPConnection connection;
private String room;
private String subject;
private String nickname = null;
@ -107,8 +107,8 @@ public class MultiUserChat {
private List<PacketListener> connectionListeners = new ArrayList<PacketListener>();
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(final Connection 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.
@ -116,12 +116,12 @@ public class MultiUserChat {
// Set the NodeInformationProvider that will provide information about the
// joined rooms whenever a disco request is received
final WeakReference<Connection> weakRefConnection = new WeakReference<Connection>(connection);
final WeakReference<XMPPConnection> weakRefConnection = new WeakReference<XMPPConnection>(connection);
ServiceDiscoveryManager.getInstanceFor(connection).setNodeInformationProvider(
discoNode,
new NodeInformationProvider() {
public List<DiscoverItems.Item> getNodeItems() {
Connection connection = weakRefConnection.get();
XMPPConnection connection = weakRefConnection.get();
if (connection == null) return new LinkedList<DiscoverItems.Item>();
List<DiscoverItems.Item> answer = new ArrayList<DiscoverItems.Item>();
Iterator<String> rooms=MultiUserChat.getJoinedRooms(connection);
@ -163,7 +163,7 @@ public class MultiUserChat {
* "service" is the hostname at which the multi-user chat
* service is running. Make sure to provide a valid JID.
*/
public MultiUserChat(Connection connection, String room) {
public MultiUserChat(XMPPConnection connection, String room) {
this.connection = connection;
this.room = room.toLowerCase();
init();
@ -176,7 +176,7 @@ public class MultiUserChat {
* @param user the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.
* @return a boolean indicating whether the specified user supports the MUC protocol.
*/
public static boolean isServiceEnabled(Connection connection, String user) {
public static boolean isServiceEnabled(XMPPConnection connection, String user) {
try {
DiscoverInfo result =
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(user);
@ -196,7 +196,7 @@ public class MultiUserChat {
* @param connection the connection used to join the rooms.
* @return an Iterator on the rooms where the user has joined using a given connection.
*/
private static Iterator<String> getJoinedRooms(Connection connection) {
private static Iterator<String> getJoinedRooms(XMPPConnection connection) {
List<String> rooms = joinedRooms.get(connection);
if (rooms != null) {
return rooms.iterator();
@ -213,7 +213,7 @@ public class MultiUserChat {
* @param user the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.
* @return an Iterator on the rooms where the requested user has joined.
*/
public static Iterator<String> getJoinedRooms(Connection connection, String user) {
public static Iterator<String> getJoinedRooms(XMPPConnection connection, String user) {
try {
ArrayList<String> answer = new ArrayList<String>();
// Send the disco packet to the user
@ -242,7 +242,7 @@ public class MultiUserChat {
* @return the discovered information of a given room without actually having to join the room.
* @throws XMPPException if an error occured while trying to discover information of a room.
*/
public static RoomInfo getRoomInfo(Connection connection, String room)
public static RoomInfo getRoomInfo(XMPPConnection connection, String room)
throws XMPPException {
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(room);
return new RoomInfo(info);
@ -255,7 +255,7 @@ public class MultiUserChat {
* @return a collection with the XMPP addresses of the Multi-User Chat services.
* @throws XMPPException if an error occured while trying to discover MUC services.
*/
public static Collection<String> getServiceNames(Connection connection) throws XMPPException {
public static Collection<String> getServiceNames(XMPPConnection connection) throws XMPPException {
final List<String> answer = new ArrayList<String>();
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
DiscoverItems items = discoManager.discoverItems(connection.getServiceName());
@ -285,7 +285,7 @@ public class MultiUserChat {
* @return a collection of HostedRooms.
* @throws XMPPException if an error occured while trying to discover the information.
*/
public static Collection<HostedRoom> getHostedRooms(Connection connection, String serviceName)
public static Collection<HostedRoom> getHostedRooms(XMPPConnection connection, String serviceName)
throws XMPPException {
List<HostedRoom> answer = new ArrayList<HostedRoom>();
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
@ -689,7 +689,7 @@ public class MultiUserChat {
* @param inviter the inviter of the declined invitation.
* @param reason the reason why the invitee is declining the invitation.
*/
public static void decline(Connection conn, String room, String inviter, String reason) {
public static void decline(XMPPConnection conn, String room, String inviter, String reason) {
Message message = new Message(room);
// Create the MUCUser packet that will include the rejection
@ -711,7 +711,7 @@ public class MultiUserChat {
* @param conn the connection where the listener will be applied.
* @param listener an invitation listener.
*/
public static void addInvitationListener(Connection conn, InvitationListener listener) {
public static void addInvitationListener(XMPPConnection conn, InvitationListener listener) {
InvitationsMonitor.getInvitationsMonitor(conn).addInvitationListener(listener);
}
@ -722,7 +722,7 @@ public class MultiUserChat {
* @param conn the connection where the listener was applied.
* @param listener an invitation listener.
*/
public static void removeInvitationListener(Connection conn, InvitationListener listener) {
public static void removeInvitationListener(XMPPConnection conn, InvitationListener listener) {
InvitationsMonitor.getInvitationsMonitor(conn).removeInvitationListener(listener);
}
@ -1661,7 +1661,7 @@ public class MultiUserChat {
* group chat. Only "group chat" messages addressed to this group chat will
* be delivered to the listener. If you wish to listen for other packets
* that may be associated with this group chat, you should register a
* PacketListener directly with the Connection with the appropriate
* PacketListener directly with the XMPPConnection with the appropriate
* PacketListener.
*
* @param listener a packet listener.
@ -2310,17 +2310,17 @@ public class MultiUserChat {
// We use a WeakHashMap so that the GC can collect the monitor when the
// connection is no longer referenced by any object.
// Note that when the InvitationsMonitor is used, i.e. when there are InvitationListeners, it will add a
// PacketListener to the Connection and therefore a strong reference from the Connection to the
// PacketListener to the XMPPConnection and therefore a strong reference from the XMPPConnection to the
// InvitationsMonior will exists, preventing it from beeing gc'ed. After the last InvitationListener is gone,
// the PacketListener will get removed (cancel()) allowing the garbage collection of the InvitationsMonitor
// instance.
private final static Map<Connection, WeakReference<InvitationsMonitor>> monitors =
new WeakHashMap<Connection, WeakReference<InvitationsMonitor>>();
private final static Map<XMPPConnection, WeakReference<InvitationsMonitor>> monitors =
new WeakHashMap<XMPPConnection, WeakReference<InvitationsMonitor>>();
// We don't use a synchronized List here because it would break the semantic of (add|remove)InvitationListener
private final List<InvitationListener> invitationsListeners =
new ArrayList<InvitationListener>();
private Connection connection;
private XMPPConnection connection;
private PacketFilter invitationFilter;
private PacketListener invitationPacketListener;
@ -2330,7 +2330,7 @@ public class MultiUserChat {
* @param conn the connection to monitor for room invitations.
* @return a new or existing InvitationsMonitor for a given connection.
*/
public static InvitationsMonitor getInvitationsMonitor(Connection conn) {
public static InvitationsMonitor getInvitationsMonitor(XMPPConnection conn) {
synchronized (monitors) {
if (!monitors.containsKey(conn) || monitors.get(conn).get() == null) {
// We need to use a WeakReference because the monitor references the
@ -2351,7 +2351,7 @@ public class MultiUserChat {
*
* @param connection the connection to monitor for possible room invitations
*/
private InvitationsMonitor(Connection connection) {
private InvitationsMonitor(XMPPConnection connection) {
this.connection = connection;
}

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.StringUtils;
@ -31,9 +31,9 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* A <code>RoomListenerMultiplexor</code> multiplexes incoming packets on
* a <code>Connection</code> using a single listener/filter pair.
* a <code>XMPPConnection</code> using a single listener/filter pair.
* A single <code>RoomListenerMultiplexor</code> is created for each
* {@link org.jivesoftware.smack.Connection} that has joined MUC rooms
* {@link org.jivesoftware.smack.XMPPConnection} that has joined MUC rooms
* within its session.
*
* @author Larry Kirschner
@ -42,10 +42,10 @@ class RoomListenerMultiplexor implements ConnectionListener {
// We use a WeakHashMap so that the GC can collect the monitor when the
// connection is no longer referenced by any object.
private static final Map<Connection, WeakReference<RoomListenerMultiplexor>> monitors =
new WeakHashMap<Connection, WeakReference<RoomListenerMultiplexor>>();
private static final Map<XMPPConnection, WeakReference<RoomListenerMultiplexor>> monitors =
new WeakHashMap<XMPPConnection, WeakReference<RoomListenerMultiplexor>>();
private Connection connection;
private XMPPConnection connection;
private RoomMultiplexFilter filter;
private RoomMultiplexListener listener;
@ -55,7 +55,7 @@ class RoomListenerMultiplexor implements ConnectionListener {
* @param conn the connection to monitor for room invitations.
* @return a new or existing RoomListenerMultiplexor for a given connection.
*/
public static RoomListenerMultiplexor getRoomMultiplexor(Connection conn) {
public static RoomListenerMultiplexor getRoomMultiplexor(XMPPConnection conn) {
synchronized (monitors) {
if (!monitors.containsKey(conn) || monitors.get(conn).get() == null) {
RoomListenerMultiplexor rm = new RoomListenerMultiplexor(conn, new RoomMultiplexFilter(),
@ -75,12 +75,12 @@ class RoomListenerMultiplexor implements ConnectionListener {
/**
* All access should be through
* the static method {@link #getRoomMultiplexor(Connection)}.
* the static method {@link #getRoomMultiplexor(XMPPConnection)}.
*/
private RoomListenerMultiplexor(Connection connection, RoomMultiplexFilter filter,
private RoomListenerMultiplexor(XMPPConnection connection, RoomMultiplexFilter filter,
RoomMultiplexListener listener) {
if (connection == null) {
throw new IllegalArgumentException("Connection is null");
throw new IllegalArgumentException("XMPPConnection is null");
}
if (filter == null) {
throw new IllegalArgumentException("Filter is null");
@ -143,11 +143,11 @@ class RoomListenerMultiplexor implements ConnectionListener {
}
/**
* The single <code>Connection</code>-level <code>PacketFilter</code> used by a {@link RoomListenerMultiplexor}
* for all muc chat rooms on an <code>Connection</code>.
* The single <code>XMPPConnection</code>-level <code>PacketFilter</code> used by a {@link RoomListenerMultiplexor}
* for all muc chat rooms on an <code>XMPPConnection</code>.
* Each time a muc chat room is added to/removed from an
* <code>Connection</code> the address for that chat room
* is added to/removed from that <code>Connection</code>'s
* <code>XMPPConnection</code> the address for that chat room
* is added to/removed from that <code>XMPPConnection</code>'s
* <code>RoomMultiplexFilter</code>.
*/
private static class RoomMultiplexFilter implements PacketFilter {
@ -178,12 +178,12 @@ class RoomListenerMultiplexor implements ConnectionListener {
}
/**
* The single <code>Connection</code>-level <code>PacketListener</code>
* The single <code>XMPPConnection</code>-level <code>PacketListener</code>
* used by a {@link RoomListenerMultiplexor}
* for all muc chat rooms on an <code>Connection</code>.
* for all muc chat rooms on an <code>XMPPConnection</code>.
* Each time a muc chat room is added to/removed from an
* <code>Connection</code> the address and listener for that chat room
* are added to/removed from that <code>Connection</code>'s
* <code>XMPPConnection</code> the address and listener for that chat room
* are added to/removed from that <code>XMPPConnection</code>'s
* <code>RoomMultiplexListener</code>.
*
* @author Larry Kirschner

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.offline;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.PacketExtensionFilter;
@ -58,11 +58,11 @@ public class OfflineMessageManager {
private final static String namespace = "http://jabber.org/protocol/offline";
private Connection connection;
private XMPPConnection connection;
private PacketFilter packetFilter;
public OfflineMessageManager(Connection connection) {
public OfflineMessageManager(XMPPConnection connection) {
this.connection = connection;
packetFilter =
new AndFilter(new PacketExtensionFilter("offline", namespace),

View file

@ -21,7 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.PacketExtensionFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Message;
@ -62,7 +62,7 @@ public class PEPManager {
private List<PEPListener> pepListeners = new ArrayList<PEPListener>();
private Connection connection;
private XMPPConnection connection;
private PacketFilter packetFilter = new PacketExtensionFilter("event", "http://jabber.org/protocol/pubsub#event");
private PacketListener packetListener;
@ -70,9 +70,9 @@ public class PEPManager {
/**
* Creates a new PEP exchange manager.
*
* @param connection a Connection which is used to send and receive messages.
* @param connection a XMPPConnection which is used to send and receive messages.
*/
public PEPManager(Connection connection) {
public PEPManager(XMPPConnection connection) {
this.connection = connection;
init();
}

View file

@ -25,7 +25,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager;
@ -56,29 +56,29 @@ public class PingManager extends Manager {
private static final Logger LOGGER = Logger.getLogger(PingManager.class.getName());
private static final Map<Connection, PingManager> INSTANCES = Collections
.synchronizedMap(new WeakHashMap<Connection, PingManager>());
private static final Map<XMPPConnection, PingManager> INSTANCES = Collections
.synchronizedMap(new WeakHashMap<XMPPConnection, PingManager>());
private static final PacketFilter PING_PACKET_FILTER = new AndFilter(
new PacketTypeFilter(Ping.class), new IQTypeFilter(Type.GET));
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
}
/**
* Retrieves a {@link PingManager} for the specified {@link Connection}, creating one if it doesn't already
* Retrieves a {@link PingManager} for the specified {@link XMPPConnection}, creating one if it doesn't already
* exist.
*
* @param connection
* The connection the manager is attached to.
* @return The new or existing manager.
*/
public synchronized static PingManager getInstanceFor(Connection connection) {
public synchronized static PingManager getInstanceFor(XMPPConnection connection) {
PingManager pingManager = INSTANCES.get(connection);
if (pingManager == null) {
pingManager = new PingManager(connection);
@ -117,7 +117,7 @@ public class PingManager extends Manager {
*/
private long lastSuccessfulManualPing = -1;
private PingManager(Connection connection) {
private PingManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(PingManager.NAMESPACE);
@ -308,7 +308,7 @@ public class PingManager extends Manager {
public void run() {
LOGGER.fine("ServerPingTask run()");
Connection connection = connection();
XMPPConnection connection = connection();
if (connection == null) {
// connection has been collected by GC
// which means we can stop the thread by breaking the loop
@ -344,7 +344,7 @@ public class PingManager extends Manager {
maybeSchedulePingServerTask();
}
} else {
LOGGER.warning("ServerPingTask: Connection was not authenticated");
LOGGER.warning("ServerPingTask: XMPPConnection was not authenticated");
}
}
};

View file

@ -23,7 +23,7 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
@ -50,8 +50,8 @@ import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
public class PrivacyListManager extends Manager {
// Keep the list of instances of this class.
private static Map<Connection, PrivacyListManager> instances = Collections
.synchronizedMap(new WeakHashMap<Connection, PrivacyListManager>());
private static Map<XMPPConnection, PrivacyListManager> instances = Collections
.synchronizedMap(new WeakHashMap<XMPPConnection, PrivacyListManager>());
private final List<PrivacyListListener> listeners = new ArrayList<PrivacyListListener>();
PacketFilter packetFilter = new AndFilter(new IQTypeFilter(IQ.Type.SET),
@ -61,8 +61,8 @@ public class PrivacyListManager extends Manager {
// 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.
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
@ -74,7 +74,7 @@ public class PrivacyListManager extends Manager {
*
* @param connection the XMPP connection.
*/
private PrivacyListManager(final Connection connection) {
private PrivacyListManager(final XMPPConnection connection) {
super(connection);
// Register the new instance and associate it with the connection
instances.put(connection, this);
@ -129,12 +129,12 @@ public class PrivacyListManager extends Manager {
}
/**
* Returns the PrivacyListManager instance associated with a given Connection.
* Returns the PrivacyListManager instance associated with a given XMPPConnection.
*
* @param connection the connection used to look for the proper PrivacyListManager.
* @return the PrivacyListManager associated with a given Connection.
* @return the PrivacyListManager associated with a given XMPPConnection.
*/
public static synchronized PrivacyListManager getInstanceFor(Connection connection) {
public static synchronized PrivacyListManager getInstanceFor(XMPPConnection connection) {
PrivacyListManager plm = instances.get(connection);
if (plm == null) plm = new PrivacyListManager(connection);
return plm;

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.pubsub;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.PacketExtension;
/**
@ -25,7 +25,7 @@ import org.jivesoftware.smack.packet.PacketExtension;
*
* Affiliations are retrieved from the {@link PubSubManager#getAffiliations()} method, which
* gets affiliations for the calling user, based on the identity that is associated with
* the {@link Connection}.
* the {@link XMPPConnection}.
*
* @author Robin Collier
*/

View file

@ -16,11 +16,11 @@
*/
package org.jivesoftware.smackx.pubsub;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
public class CollectionNode extends Node
{
CollectionNode(Connection connection, String nodeId)
CollectionNode(XMPPConnection connection, String nodeId)
{
super(connection, nodeId);
}

View file

@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
@ -36,7 +36,7 @@ import org.jivesoftware.smackx.pubsub.packet.PubSub;
*/
public class LeafNode extends Node
{
LeafNode(Connection connection, String nodeName)
LeafNode(XMPPConnection connection, String nodeName)
{
super(connection, nodeName);
}

View file

@ -23,7 +23,7 @@ import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.OrFilter;
import org.jivesoftware.smack.filter.PacketFilter;
@ -45,7 +45,7 @@ import org.jivesoftware.smackx.xdata.Form;
abstract public class Node
{
protected Connection con;
protected XMPPConnection con;
protected String id;
protected String to;
@ -60,7 +60,7 @@ abstract public class Node
* @param connection The connection the node is associated with
* @param nodeName The node id
*/
Node(Connection connection, String nodeName)
Node(XMPPConnection connection, String nodeName)
{
con = connection;
id = nodeName;

View file

@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Packet;
@ -45,7 +45,7 @@ import org.jivesoftware.smackx.xdata.FormField;
*/
final public class PubSubManager
{
private Connection con;
private XMPPConnection con;
private String to;
private Map<String, Node> nodeMap = new ConcurrentHashMap<String, Node>();
@ -55,7 +55,7 @@ final public class PubSubManager
*
* @param connection The XMPP connection
*/
public PubSubManager(Connection connection)
public PubSubManager(XMPPConnection connection)
{
con = connection;
to = "pubsub." + connection.getServiceName();
@ -68,7 +68,7 @@ final public class PubSubManager
* @param connection The XMPP connection
* @param toAddress The pubsub specific to address (required for some servers)
*/
public PubSubManager(Connection connection, String toAddress)
public PubSubManager(XMPPConnection connection, String toAddress)
{
con = connection;
to = toAddress;
@ -305,25 +305,25 @@ final public class PubSubManager
return request;
}
static Packet sendPubsubPacket(Connection con, String to, Type type, PacketExtension ext)
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PacketExtension ext)
throws XMPPException
{
return sendPubsubPacket(con, to, type, ext, null);
}
static Packet sendPubsubPacket(Connection con, String to, Type type, PacketExtension ext, PubSubNamespace ns)
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PacketExtension ext, PubSubNamespace ns)
throws XMPPException
{
return con.createPacketCollectorAndSend(createPubsubPacket(to, type, ext, ns)).nextResultOrThrow();
}
static Packet sendPubsubPacket(Connection con, String to, Type type, PubSub packet)
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PubSub packet)
throws XMPPException
{
return sendPubsubPacket(con, to, type, packet, null);
}
static Packet sendPubsubPacket(Connection con, String to, Type type, PubSub packet, PubSubNamespace ns)
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PubSub packet, PubSubNamespace ns)
throws XMPPException
{
return con.createPacketCollectorAndSend(packet).nextResultOrThrow();

View file

@ -22,7 +22,7 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
@ -41,12 +41,12 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
*/
public class DeliveryReceiptManager extends Manager implements PacketListener {
private static Map<Connection, DeliveryReceiptManager> instances =
Collections.synchronizedMap(new WeakHashMap<Connection, DeliveryReceiptManager>());
private static Map<XMPPConnection, DeliveryReceiptManager> instances =
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, DeliveryReceiptManager>());
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
@ -56,7 +56,7 @@ public class DeliveryReceiptManager extends Manager implements PacketListener {
private Set<ReceiptReceivedListener> receiptReceivedListeners = Collections
.synchronizedSet(new HashSet<ReceiptReceivedListener>());
private DeliveryReceiptManager(Connection connection) {
private DeliveryReceiptManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(DeliveryReceipt.NAMESPACE);
@ -73,7 +73,7 @@ public class DeliveryReceiptManager extends Manager implements PacketListener {
*
* @return the DeliveryReceiptManager instance for the given connection
*/
public static synchronized DeliveryReceiptManager getInstanceFor(Connection connection) {
public static synchronized DeliveryReceiptManager getInstanceFor(XMPPConnection connection) {
DeliveryReceiptManager receiptManager = instances.get(connection);
if (receiptManager == null) {
@ -117,7 +117,7 @@ public class DeliveryReceiptManager extends Manager implements PacketListener {
DeliveryReceiptRequest drr = (DeliveryReceiptRequest)packet.getExtension(
DeliveryReceiptRequest.ELEMENT, DeliveryReceipt.NAMESPACE);
if (drr != null) {
Connection connection = connection();
XMPPConnection connection = connection();
Message ack = new Message(packet.getFrom(), Message.Type.normal);
ack.addExtension(new DeliveryReceipt(packet.getPacketID()));
connection.sendPacket(ack);

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.search;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
@ -55,13 +55,13 @@ public class UserSearch extends IQ {
/**
* Returns the form for all search fields supported by the search service.
*
* @param con the current Connection.
* @param con the current XMPPConnection.
* @param searchService the search service to use. (ex. search.jivesoftware.com)
* @return the search form received by the server.
* @throws org.jivesoftware.smack.XMPPException
* thrown if a server error has occurred.
*/
public Form getSearchForm(Connection con, String searchService) throws XMPPException {
public Form getSearchForm(XMPPConnection con, String searchService) throws XMPPException {
UserSearch search = new UserSearch();
search.setType(IQ.Type.GET);
search.setTo(searchService);
@ -73,14 +73,14 @@ public class UserSearch extends IQ {
/**
* Sends the filled out answer form to be sent and queried by the search service.
*
* @param con the current Connection.
* @param con the current XMPPConnection.
* @param searchForm the <code>Form</code> to send for querying.
* @param searchService the search service to use. (ex. search.jivesoftware.com)
* @return ReportedData the data found from the query.
* @throws org.jivesoftware.smack.XMPPException
* thrown if a server error has occurred.
*/
public ReportedData sendSearchForm(Connection con, Form searchForm, String searchService) throws XMPPException {
public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws XMPPException {
UserSearch search = new UserSearch();
search.setType(IQ.Type.SET);
search.setTo(searchService);
@ -93,14 +93,14 @@ public class UserSearch extends IQ {
/**
* Sends the filled out answer form to be sent and queried by the search service.
*
* @param con the current Connection.
* @param con the current XMPPConnection.
* @param searchForm the <code>Form</code> to send for querying.
* @param searchService the search service to use. (ex. search.jivesoftware.com)
* @return ReportedData the data found from the query.
* @throws org.jivesoftware.smack.XMPPException
* thrown if a server error has occurred.
*/
public ReportedData sendSimpleSearchForm(Connection con, Form searchForm, String searchService) throws XMPPException {
public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws XMPPException {
SimpleUserSearch search = new SimpleUserSearch();
search.setForm(searchForm);
search.setType(IQ.Type.SET);

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.search;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
@ -34,7 +34,7 @@ import java.util.List;
* searching (DataForms or No DataForms), but allows the user to simply use the DataForm model for both
* types of support.
* <pre>
* Connection con = new TCPConnection("jabber.org");
* XMPPConnection con = new TCPConnection("jabber.org");
* con.login("john", "doe");
* UserSearchManager search = new UserSearchManager(con, "users.jabber.org");
* Form searchForm = search.getSearchForm();
@ -48,15 +48,15 @@ import java.util.List;
*/
public class UserSearchManager {
private Connection con;
private XMPPConnection con;
private UserSearch userSearch;
/**
* Creates a new UserSearchManager.
*
* @param con the Connection to use.
* @param con the XMPPConnection to use.
*/
public UserSearchManager(Connection con) {
public UserSearchManager(XMPPConnection con) {
this.con = con;
userSearch = new UserSearch();
}

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.sharedgroups;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.sharedgroups.packet.SharedGroupsInfo;
@ -40,7 +40,7 @@ public class SharedGroupManager {
* @param connection connection to use to get the user's shared groups.
* @return collection with the shared groups' name of the logged user.
*/
public static List<String> getSharedGroups(Connection connection) throws XMPPException {
public static List<String> getSharedGroups(XMPPConnection connection) throws XMPPException {
// Discover the shared groups of the logged user
SharedGroupsInfo info = new SharedGroupsInfo();
info.setType(IQ.Type.GET);

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.time;
import java.util.Map;
import java.util.WeakHashMap;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.time.packet.Time;
public class EntityTimeManager extends Manager {
private static final Map<Connection, EntityTimeManager> INSTANCES = new WeakHashMap<Connection, EntityTimeManager>();
private static final Map<XMPPConnection, EntityTimeManager> INSTANCES = new WeakHashMap<XMPPConnection, EntityTimeManager>();
private static final PacketFilter TIME_PACKET_FILTER = new AndFilter(new PacketTypeFilter(
Time.class), new IQTypeFilter(Type.GET));
@ -43,8 +43,8 @@ public class EntityTimeManager extends Manager {
private static boolean autoEnable = true;
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
getInstanceFor(connection);
}
});
@ -54,7 +54,7 @@ public class EntityTimeManager extends Manager {
EntityTimeManager.autoEnable = autoEnable;
}
public synchronized static EntityTimeManager getInstanceFor(Connection connection) {
public synchronized static EntityTimeManager getInstanceFor(XMPPConnection connection) {
EntityTimeManager entityTimeManager = INSTANCES.get(connection);
if (entityTimeManager == null) {
entityTimeManager = new EntityTimeManager(connection);
@ -64,7 +64,7 @@ public class EntityTimeManager extends Manager {
private boolean enabled = false;
private EntityTimeManager(Connection connection) {
private EntityTimeManager(XMPPConnection connection) {
super(connection);
INSTANCES.put(connection, this);
if (autoEnable)

Some files were not shown because too many files have changed in this diff Show more