mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 05:01:12 +01:00
SMACK-279: The XMPPConnection extends the new abstract Connection class
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11613 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
11a41e79ca
commit
127319a821
102 changed files with 1420 additions and 1194 deletions
|
|
@ -34,11 +34,11 @@ import java.util.Map;
|
|||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* Handles chat state for all chats on a particular XMPPConnection. This class manages both the
|
||||
* Handles chat state for all chats on a particular Connection. 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.ChatStateManager#getInstance(org.jivesoftware.smack.XMPPConnection)}
|
||||
* NOTE: {@link org.jivesoftware.smackx.ChatStateManager#getInstance(org.jivesoftware.smack.Connection)}
|
||||
* 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.
|
||||
*
|
||||
|
|
@ -48,20 +48,20 @@ import java.util.WeakHashMap;
|
|||
*/
|
||||
public class ChatStateManager {
|
||||
|
||||
private static final Map<XMPPConnection, ChatStateManager> managers =
|
||||
new WeakHashMap<XMPPConnection, ChatStateManager>();
|
||||
private static final Map<Connection, ChatStateManager> managers =
|
||||
new WeakHashMap<Connection, ChatStateManager>();
|
||||
|
||||
private static final PacketFilter filter = new NotFilter(
|
||||
new PacketExtensionFilter("http://jabber.org/protocol/chatstates"));
|
||||
|
||||
/**
|
||||
* Returns the ChatStateManager related to the XMPPConnection and it will create one if it does
|
||||
* Returns the ChatStateManager related to the Connection 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 ChatStateManager getInstance(final XMPPConnection connection) {
|
||||
public static ChatStateManager getInstance(final Connection connection) {
|
||||
if(connection == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ public class ChatStateManager {
|
|||
}
|
||||
}
|
||||
|
||||
private final XMPPConnection connection;
|
||||
private final Connection connection;
|
||||
|
||||
private final OutgoingMessageInterceptor outgoingInterceptor = new OutgoingMessageInterceptor();
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ public class ChatStateManager {
|
|||
private final Map<Chat, ChatState> chatStates =
|
||||
new ReferenceMap<Chat, ChatState>(ReferenceMap.WEAK, ReferenceMap.HARD);
|
||||
|
||||
private ChatStateManager(XMPPConnection connection) {
|
||||
private ChatStateManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import org.jivesoftware.smackx.packet.LastActivity;
|
|||
/**
|
||||
* A last activity manager for handling information about the last activity associated
|
||||
* with a Jabber ID. A manager handles incoming LastActivity requests of existing
|
||||
* XMPPConnections. It also allows to request last activity information of other users.<p>
|
||||
* Connections. It also allows to request last activity information of other users.<p>
|
||||
*
|
||||
* LastActivity (JEP-012) based on the sending JID's type allows for retrieval of:
|
||||
* <ol>
|
||||
|
|
@ -46,7 +46,7 @@ import org.jivesoftware.smackx.packet.LastActivity;
|
|||
* LastActivity packet to them, as in the following code:<p>
|
||||
*
|
||||
* <pre>
|
||||
* XMPPConnection con = new XMPPConnection("jabber.org");
|
||||
* Connection con = new XMPPConnection("jabber.org");
|
||||
* con.login("john", "doe");
|
||||
* LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");
|
||||
* </pre>
|
||||
|
|
@ -71,12 +71,12 @@ public class LastActivityManager {
|
|||
|
||||
private long lastMessageSent;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
// Enable the LastActivity support on every established connection
|
||||
static {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(Connection connection) {
|
||||
new LastActivityManager(connection);
|
||||
}
|
||||
});
|
||||
|
|
@ -85,13 +85,13 @@ public class LastActivityManager {
|
|||
/**
|
||||
* Creates a last activity manager to response last activity requests.
|
||||
*
|
||||
* @param connection The XMPPConnection that the last activity requests will use.
|
||||
* @param connection The Connection that the last activity requests will use.
|
||||
*/
|
||||
private LastActivityManager(XMPPConnection connection) {
|
||||
private LastActivityManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
|
||||
// Listen to all the sent messages to reset the idle time on each one
|
||||
connection.addPacketWriterListener(new PacketListener() {
|
||||
connection.addPacketSendingListener(new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
resetIdleTime();
|
||||
}
|
||||
|
|
@ -141,12 +141,12 @@ public class LastActivityManager {
|
|||
* when the jid is a server or component (e.g., a JID of the form 'host') the
|
||||
* last activity is the uptime.
|
||||
*
|
||||
* @param con the current XMPPConnection.
|
||||
* @param con the current Connection.
|
||||
* @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(XMPPConnection con, String jid)
|
||||
public static LastActivity getLastActivity(Connection con, String jid)
|
||||
throws XMPPException {
|
||||
LastActivity activity = new LastActivity();
|
||||
activity.setTo(jid);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
|
@ -46,7 +46,7 @@ public class MessageEventManager {
|
|||
private List<MessageEventNotificationListener> messageEventNotificationListeners = new ArrayList<MessageEventNotificationListener>();
|
||||
private List<MessageEventRequestListener> messageEventRequestListeners = new ArrayList<MessageEventRequestListener>();
|
||||
|
||||
private XMPPConnection con;
|
||||
private Connection con;
|
||||
|
||||
private PacketFilter packetFilter = new PacketExtensionFilter("x", "jabber:x:event");
|
||||
private PacketListener packetListener;
|
||||
|
|
@ -54,9 +54,9 @@ public class MessageEventManager {
|
|||
/**
|
||||
* Creates a new message event manager.
|
||||
*
|
||||
* @param con an XMPPConnection.
|
||||
* @param con a Connection to a XMPP server.
|
||||
*/
|
||||
public MessageEventManager(XMPPConnection con) {
|
||||
public MessageEventManager(Connection con) {
|
||||
this.con = con;
|
||||
init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class MultipleRecipientInfo {
|
|||
|
||||
/**
|
||||
* Returns true if the received packet should not be replied. Use
|
||||
* {@link MultipleRecipientManager#reply(org.jivesoftware.smack.XMPPConnection, org.jivesoftware.smack.packet.Message, org.jivesoftware.smack.packet.Message)}
|
||||
* {@link MultipleRecipientManager#reply(org.jivesoftware.smack.Connection, org.jivesoftware.smack.packet.Message, org.jivesoftware.smack.packet.Message)}
|
||||
* to send replies.
|
||||
*
|
||||
* @return true if the received packet should not be replied.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
package org.jivesoftware.smackx;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
|
@ -67,7 +67,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(XMPPConnection connection, Packet packet, List to, List cc, List bcc)
|
||||
public static void send(Connection connection, Packet packet, List to, List cc, List bcc)
|
||||
throws XMPPException {
|
||||
send(connection, packet, to, cc, bcc, null, null, false);
|
||||
}
|
||||
|
|
@ -95,7 +95,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(XMPPConnection connection, Packet packet, List to, List cc, List bcc,
|
||||
public static void send(Connection connection, Packet packet, List to, List cc, List bcc,
|
||||
String replyTo, String replyRoom, boolean noReply) throws XMPPException {
|
||||
String serviceAddress = getMultipleRecipienServiceAddress(connection);
|
||||
if (serviceAddress != null) {
|
||||
|
|
@ -127,7 +127,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(XMPPConnection connection, Message original, Message reply)
|
||||
public static void reply(Connection connection, Message original, Message reply)
|
||||
throws XMPPException {
|
||||
MultipleRecipientInfo info = getMultipleRecipientInfo(original);
|
||||
if (info == null) {
|
||||
|
|
@ -201,7 +201,7 @@ public class MultipleRecipientManager {
|
|||
return extension == null ? null : new MultipleRecipientInfo(extension);
|
||||
}
|
||||
|
||||
private static void sendToIndividualRecipients(XMPPConnection connection, Packet packet,
|
||||
private static void sendToIndividualRecipients(Connection connection, Packet packet,
|
||||
List to, List cc, List bcc) {
|
||||
if (to != null) {
|
||||
for (Iterator it = to.iterator(); it.hasNext();) {
|
||||
|
|
@ -226,7 +226,7 @@ public class MultipleRecipientManager {
|
|||
}
|
||||
}
|
||||
|
||||
private static void sendThroughService(XMPPConnection connection, Packet packet, List to,
|
||||
private static void sendThroughService(Connection connection, Packet packet, List to,
|
||||
List cc, List bcc, String replyTo, String replyRoom, boolean noReply,
|
||||
String serviceAddress) {
|
||||
// Create multiple recipient extension
|
||||
|
|
@ -280,7 +280,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(XMPPConnection connection) {
|
||||
private static String getMultipleRecipienServiceAddress(Connection connection) {
|
||||
String serviceName = connection.getServiceName();
|
||||
String serviceAddress = (String) services.get(serviceName);
|
||||
if (serviceAddress == null) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.*;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -57,11 +57,11 @@ public class OfflineMessageManager {
|
|||
|
||||
private final static String namespace = "http://jabber.org/protocol/offline";
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
private PacketFilter packetFilter;
|
||||
|
||||
public OfflineMessageManager(XMPPConnection connection) {
|
||||
public OfflineMessageManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
packetFilter =
|
||||
new AndFilter(new PacketExtensionFilter("offline", namespace),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
|
@ -64,7 +64,7 @@ public class PEPManager {
|
|||
|
||||
private List<PEPListener> pepListeners = new ArrayList<PEPListener>();
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
private PacketFilter packetFilter = new PacketExtensionFilter("event", "http://jabber.org/protocol/pubsub#event");
|
||||
private PacketListener packetListener;
|
||||
|
|
@ -72,9 +72,9 @@ public class PEPManager {
|
|||
/**
|
||||
* Creates a new PEP exchange manager.
|
||||
*
|
||||
* @param connection an XMPPConnection.
|
||||
* @param connection a Connection which is used to send and receive messages.
|
||||
*/
|
||||
public PEPManager(XMPPConnection connection) {
|
||||
public PEPManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -118,7 +118,7 @@ public class PrivateDataManager {
|
|||
}
|
||||
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* The user to get and set private data for. In most cases, this value should
|
||||
|
|
@ -135,7 +135,7 @@ public class PrivateDataManager {
|
|||
* @param connection an XMPP connection which must have already undergone a
|
||||
* successful login.
|
||||
*/
|
||||
public PrivateDataManager(XMPPConnection connection) {
|
||||
public PrivateDataManager(Connection connection) {
|
||||
if (!connection.isAuthenticated()) {
|
||||
throw new IllegalStateException("Must be logged in to XMPP server.");
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ public class PrivateDataManager {
|
|||
* successful login.
|
||||
* @param user the XMPP address of the user to get and set private data for.
|
||||
*/
|
||||
public PrivateDataManager(XMPPConnection connection, String user) {
|
||||
public PrivateDataManager(Connection connection, String user) {
|
||||
if (!connection.isAuthenticated()) {
|
||||
throw new IllegalStateException("Must be logged in to XMPP server.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smack.PacketListener;
|
|||
import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.RosterEntry;
|
||||
import org.jivesoftware.smack.RosterGroup;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
|
@ -48,7 +48,7 @@ public class RosterExchangeManager {
|
|||
|
||||
private List<RosterExchangeListener> rosterExchangeListeners = new ArrayList<RosterExchangeListener>();
|
||||
|
||||
private XMPPConnection con;
|
||||
private Connection con;
|
||||
|
||||
private PacketFilter packetFilter = new PacketExtensionFilter("x", "jabber:x:roster");
|
||||
private PacketListener packetListener;
|
||||
|
|
@ -56,9 +56,9 @@ public class RosterExchangeManager {
|
|||
/**
|
||||
* Creates a new roster exchange manager.
|
||||
*
|
||||
* @param con an XMPPConnection.
|
||||
* @param con a Connection which is used to send and receive messages.
|
||||
*/
|
||||
public RosterExchangeManager(XMPPConnection con) {
|
||||
public RosterExchangeManager(Connection con) {
|
||||
this.con = con;
|
||||
init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ public class ServiceDiscoveryManager {
|
|||
private static String identityName = "Smack";
|
||||
private static String identityType = "pc";
|
||||
|
||||
private static Map<XMPPConnection, ServiceDiscoveryManager> instances =
|
||||
new ConcurrentHashMap<XMPPConnection, ServiceDiscoveryManager>();
|
||||
private static Map<Connection, ServiceDiscoveryManager> instances =
|
||||
new ConcurrentHashMap<Connection, ServiceDiscoveryManager>();
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private final List<String> features = new ArrayList<String>();
|
||||
private DataForm extendedInfo = null;
|
||||
private Map<String, NodeInformationProvider> nodeInformationProviders =
|
||||
|
|
@ -61,32 +61,32 @@ public class ServiceDiscoveryManager {
|
|||
|
||||
// Create a new ServiceDiscoveryManager on every established connection
|
||||
static {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(Connection connection) {
|
||||
new ServiceDiscoveryManager(connection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ServiceDiscoveryManager for a given XMPPConnection. This means that the
|
||||
* Creates a new ServiceDiscoveryManager for a given Connection. 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.
|
||||
*/
|
||||
public ServiceDiscoveryManager(XMPPConnection connection) {
|
||||
public ServiceDiscoveryManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ServiceDiscoveryManager instance associated with a given XMPPConnection.
|
||||
* Returns the ServiceDiscoveryManager instance associated with a given Connection.
|
||||
*
|
||||
* @param connection the connection used to look for the proper ServiceDiscoveryManager.
|
||||
* @return the ServiceDiscoveryManager associated with a given XMPPConnection.
|
||||
* @return the ServiceDiscoveryManager associated with a given Connection.
|
||||
*/
|
||||
public static ServiceDiscoveryManager getInstanceFor(XMPPConnection connection) {
|
||||
public static ServiceDiscoveryManager getInstanceFor(Connection connection) {
|
||||
return instances.get(connection);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package org.jivesoftware.smackx;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
|
@ -27,7 +27,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 getSharedGroups(XMPPConnection connection) throws XMPPException {
|
||||
public static List getSharedGroups(Connection connection) throws XMPPException {
|
||||
// Discover the shared groups of the logged user
|
||||
SharedGroupsInfo info = new SharedGroupsInfo();
|
||||
info.setType(IQ.Type.GET);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
package org.jivesoftware.smackx;
|
||||
|
||||
import org.jivesoftware.smack.ConnectionCreationListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
||||
|
|
@ -43,8 +43,8 @@ public class XHTMLManager {
|
|||
// Enable the XHTML support on every established connection
|
||||
// The ServiceDiscoveryManager class should have been already initialized
|
||||
static {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(Connection connection) {
|
||||
XHTMLManager.setServiceEnabled(connection, true);
|
||||
}
|
||||
});
|
||||
|
|
@ -101,7 +101,7 @@ public class XHTMLManager {
|
|||
* @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(XMPPConnection connection, boolean enabled) {
|
||||
public synchronized static void setServiceEnabled(Connection connection, boolean enabled) {
|
||||
if (isServiceEnabled(connection) == enabled)
|
||||
return;
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ public class XHTMLManager {
|
|||
* @param connection the connection to look for XHTML support
|
||||
* @return a boolean indicating if the XHTML support is enabled for the given connection
|
||||
*/
|
||||
public static boolean isServiceEnabled(XMPPConnection connection) {
|
||||
public static boolean isServiceEnabled(Connection connection) {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(namespace);
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ public class XHTMLManager {
|
|||
* @param userID the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com
|
||||
* @return a boolean indicating whether the specified user handles XHTML messages
|
||||
*/
|
||||
public static boolean isServiceEnabled(XMPPConnection connection, String userID) {
|
||||
public static boolean isServiceEnabled(Connection connection, String userID) {
|
||||
try {
|
||||
DiscoverInfo result =
|
||||
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(userID);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.bookmark;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.PrivateDataManager;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ import java.util.*;
|
|||
* @author Alexander Wenckus
|
||||
*/
|
||||
public class BookmarkManager {
|
||||
private static final Map<XMPPConnection, BookmarkManager> bookmarkManagerMap = new HashMap<XMPPConnection, BookmarkManager>();
|
||||
private static final Map<Connection, BookmarkManager> bookmarkManagerMap = new HashMap<Connection, BookmarkManager>();
|
||||
static {
|
||||
PrivateDataManager.addPrivateDataProvider("storage", "storage:bookmarks",
|
||||
new Bookmarks.Provider());
|
||||
|
|
@ -50,7 +50,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(XMPPConnection connection)
|
||||
public synchronized static BookmarkManager getBookmarkManager(Connection connection)
|
||||
throws XMPPException
|
||||
{
|
||||
BookmarkManager manager = (BookmarkManager) bookmarkManagerMap.get(connection);
|
||||
|
|
@ -72,7 +72,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(XMPPConnection connection) throws XMPPException {
|
||||
private BookmarkManager(Connection connection) throws XMPPException {
|
||||
if(connection == null || !connection.isAuthenticated()) {
|
||||
throw new XMPPException("Invalid connection.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import java.util.List;
|
|||
* See the following code sample for saving Bookmarks:
|
||||
* <p/>
|
||||
* <pre>
|
||||
* XMPPConnection con = new XMPPConnection("jabber.org");
|
||||
* Connection con = new XMPPConnection("jabber.org");
|
||||
* con.login("john", "doe");
|
||||
* Bookmarks bookmarks = new Bookmarks();
|
||||
* <p/>
|
||||
|
|
|
|||
|
|
@ -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 an XMPPConnection isntance to
|
||||
* {@link #getAddHocCommandsManager(org.jivesoftware.smack.XMPPConnection)} in order to
|
||||
* Pass in a Connection instance to
|
||||
* {@link #getAddHocCommandsManager(org.jivesoftware.smack.Connection)} in order to
|
||||
* get an instance of this class.
|
||||
*
|
||||
* @author Gabriel Guardincerri
|
||||
|
|
@ -65,11 +65,11 @@ public class AdHocCommandManager {
|
|||
private static final int SESSION_TIMEOUT = 2 * 60;
|
||||
|
||||
/**
|
||||
* Map a XMPPConnection with it AdHocCommandManager. This map have a key-value
|
||||
* Map a Connection with it AdHocCommandManager. This map have a key-value
|
||||
* pair for every active connection.
|
||||
*/
|
||||
private static Map<XMPPConnection, AdHocCommandManager> instances =
|
||||
new ConcurrentHashMap<XMPPConnection, AdHocCommandManager>();
|
||||
private static Map<Connection, AdHocCommandManager> instances =
|
||||
new ConcurrentHashMap<Connection, AdHocCommandManager>();
|
||||
|
||||
/**
|
||||
* Register the listener for all the connection creations. When a new
|
||||
|
|
@ -77,8 +77,8 @@ public class AdHocCommandManager {
|
|||
* related to that connection.
|
||||
*/
|
||||
static {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(Connection connection) {
|
||||
new AdHocCommandManager(connection);
|
||||
}
|
||||
});
|
||||
|
|
@ -91,7 +91,7 @@ public class AdHocCommandManager {
|
|||
* @param connection the XMPP connection.
|
||||
* @return the AdHocCommandManager associated with the connection.
|
||||
*/
|
||||
public static AdHocCommandManager getAddHocCommandsManager(XMPPConnection connection) {
|
||||
public static AdHocCommandManager getAddHocCommandsManager(Connection connection) {
|
||||
return instances.get(connection);
|
||||
}
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ public class AdHocCommandManager {
|
|||
private Thread sessionsSweeper;
|
||||
|
||||
/**
|
||||
* The XMPPConnection that this instances of AdHocCommandManager manages
|
||||
* The Connection that this instances of AdHocCommandManager manages
|
||||
*/
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* Map a command node with its AdHocCommandInfo. Note: Key=command node,
|
||||
|
|
@ -120,7 +120,7 @@ public class AdHocCommandManager {
|
|||
*/
|
||||
private Map<String, LocalCommand> executingCommands = new ConcurrentHashMap<String, LocalCommand>();
|
||||
|
||||
private AdHocCommandManager(XMPPConnection connection) {
|
||||
private AdHocCommandManager(Connection connection) {
|
||||
super();
|
||||
this.connection = connection;
|
||||
init();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.commands;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -49,7 +49,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
/**
|
||||
* The connection that is used to execute this command
|
||||
*/
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* The full JID of the command host
|
||||
|
|
@ -77,7 +77,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
* @param node the identifier of the command.
|
||||
* @param jid the JID of the host.
|
||||
*/
|
||||
protected RemoteCommand(XMPPConnection connection, String node, String jid) {
|
||||
protected RemoteCommand(Connection connection, String node, String jid) {
|
||||
super();
|
||||
this.connection = connection;
|
||||
this.jid = jid;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.debugger;
|
|||
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.debugger.SmackDebugger;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
|
@ -112,7 +112,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
private JFormattedTextField userField = null;
|
||||
private JFormattedTextField statusField = null;
|
||||
|
||||
private XMPPConnection connection = null;
|
||||
private Connection connection = null;
|
||||
|
||||
private PacketListener packetReaderListener = null;
|
||||
private PacketListener packetWriterListener = null;
|
||||
|
|
@ -140,7 +140,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
|
||||
JTabbedPane tabbedPane;
|
||||
|
||||
public EnhancedDebugger(XMPPConnection connection, Writer writer, Reader reader) {
|
||||
public EnhancedDebugger(Connection connection, Writer writer, Reader reader) {
|
||||
this.connection = connection;
|
||||
this.writer = writer;
|
||||
this.reader = reader;
|
||||
|
|
@ -919,7 +919,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
void cancel() {
|
||||
connection.removeConnectionListener(connListener);
|
||||
connection.removePacketListener(packetReaderListener);
|
||||
connection.removePacketWriterListener(packetWriterListener);
|
||||
connection.removePacketSendingListener(packetWriterListener);
|
||||
((ObservableReader) reader).removeReaderListener(readerListener);
|
||||
((ObservableWriter) writer).removeWriterListener(writerListener);
|
||||
messagesTable = null;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.OrFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
|
|
@ -44,11 +44,11 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
|
||||
private StreamNegotiator primaryNegotiator;
|
||||
private StreamNegotiator secondaryNegotiator;
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private PacketFilter primaryFilter;
|
||||
private PacketFilter secondaryFilter;
|
||||
|
||||
public FaultTolerantNegotiator(XMPPConnection connection, StreamNegotiator primary,
|
||||
public FaultTolerantNegotiator(Connection connection, StreamNegotiator primary,
|
||||
StreamNegotiator secondary) {
|
||||
this.primaryNegotiator = primary;
|
||||
this.secondaryNegotiator = secondary;
|
||||
|
|
@ -68,7 +68,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
"stream method.");
|
||||
}
|
||||
|
||||
final Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) {
|
||||
final Packet initiateIncomingStream(Connection connection, StreamInitiation initiation) {
|
||||
throw new UnsupportedOperationException("Initiation handled by createIncomingStream " +
|
||||
"method");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
package org.jivesoftware.smackx.filetransfer;
|
||||
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.IQTypeFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
|
|
@ -50,15 +50,15 @@ public class FileTransferManager {
|
|||
|
||||
private List<FileTransferListener> listeners;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* Creates a file transfer manager to initiate and receive file transfers.
|
||||
*
|
||||
* @param connection
|
||||
* The XMPPConnection that the file transfers will use.
|
||||
* The Connection that the file transfers will use.
|
||||
*/
|
||||
public FileTransferManager(XMPPConnection connection) {
|
||||
public FileTransferManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
this.fileTransferNegotiator = FileTransferNegotiator
|
||||
.getInstanceFor(connection);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -65,8 +65,8 @@ public class FileTransferNegotiator {
|
|||
|
||||
private static final String[] PROTOCOLS = {BYTE_STREAM, INBAND_BYTE_STREAM};
|
||||
|
||||
private static final Map<XMPPConnection, FileTransferNegotiator> transferObject =
|
||||
new ConcurrentHashMap<XMPPConnection, FileTransferNegotiator>();
|
||||
private static final Map<Connection, FileTransferNegotiator> transferObject =
|
||||
new ConcurrentHashMap<Connection, FileTransferNegotiator>();
|
||||
|
||||
private static final String STREAM_INIT_PREFIX = "jsi_";
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public class FileTransferNegotiator {
|
|||
* @return The IMFileTransferManager
|
||||
*/
|
||||
public static FileTransferNegotiator getInstanceFor(
|
||||
final XMPPConnection connection) {
|
||||
final Connection connection) {
|
||||
if (connection == null) {
|
||||
throw new IllegalArgumentException("Connection cannot be null");
|
||||
}
|
||||
|
|
@ -117,7 +117,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 XMPPConnection connection,
|
||||
public static void setServiceEnabled(final Connection connection,
|
||||
final boolean isEnabled) {
|
||||
ServiceDiscoveryManager manager = ServiceDiscoveryManager
|
||||
.getInstanceFor(connection);
|
||||
|
|
@ -138,7 +138,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 XMPPConnection connection) {
|
||||
public static boolean isServiceEnabled(final Connection connection) {
|
||||
for (String ns : NAMESPACE) {
|
||||
if (!ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(ns))
|
||||
return false;
|
||||
|
|
@ -181,13 +181,13 @@ public class FileTransferNegotiator {
|
|||
|
||||
// non-static
|
||||
|
||||
private final XMPPConnection connection;
|
||||
private final Connection connection;
|
||||
|
||||
private final Socks5TransferNegotiatorManager byteStreamTransferManager;
|
||||
|
||||
private final StreamNegotiator inbandTransferManager;
|
||||
|
||||
private FileTransferNegotiator(final XMPPConnection connection) {
|
||||
private FileTransferNegotiator(final Connection connection) {
|
||||
configureConnection(connection);
|
||||
|
||||
this.connection = connection;
|
||||
|
|
@ -195,7 +195,7 @@ public class FileTransferNegotiator {
|
|||
inbandTransferManager = new IBBTransferNegotiator(connection);
|
||||
}
|
||||
|
||||
private void configureConnection(final XMPPConnection connection) {
|
||||
private void configureConnection(final Connection connection) {
|
||||
connection.addConnectionListener(new ConnectionListener() {
|
||||
public void connectionClosed() {
|
||||
cleanup(connection);
|
||||
|
|
@ -219,7 +219,7 @@ public class FileTransferNegotiator {
|
|||
});
|
||||
}
|
||||
|
||||
private void cleanup(final XMPPConnection connection) {
|
||||
private void cleanup(final Connection connection) {
|
||||
if (transferObject.remove(connection) != null) {
|
||||
byteStreamTransferManager.cleanup();
|
||||
inbandTransferManager.cleanup();
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
|
||||
public static final int DEFAULT_BLOCK_SIZE = 4096;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* The default constructor for the In-Band Bystream Negotiator.
|
||||
*
|
||||
* @param connection The connection which this negotiator works on.
|
||||
*/
|
||||
protected IBBTransferNegotiator(XMPPConnection connection) {
|
||||
protected IBBTransferNegotiator(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.FromMatchesFilter;
|
||||
|
|
@ -79,12 +79,12 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
|||
|
||||
public static boolean isAllowLocalProxyHost = true;
|
||||
|
||||
private final XMPPConnection connection;
|
||||
private final Connection connection;
|
||||
|
||||
private Socks5TransferNegotiatorManager transferNegotiatorManager;
|
||||
|
||||
public Socks5TransferNegotiator(Socks5TransferNegotiatorManager transferNegotiatorManager,
|
||||
final XMPPConnection connection)
|
||||
final Connection connection)
|
||||
{
|
||||
this.connection = connection;
|
||||
this.transferNegotiatorManager = transferNegotiatorManager;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.util.Cache;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.ServiceDiscoveryManager;
|
||||
|
|
@ -54,13 +54,13 @@ public class Socks5TransferNegotiatorManager implements FileTransferNegotiatorMa
|
|||
private final Cache<String, Integer> addressBlacklist
|
||||
= new Cache<String, Integer>(100, BLACKLIST_LIFETIME);
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
private List<String> proxies;
|
||||
|
||||
private List<Bytestream.StreamHost> streamHosts;
|
||||
|
||||
public Socks5TransferNegotiatorManager(XMPPConnection connection) {
|
||||
public Socks5TransferNegotiatorManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -81,7 +81,7 @@ public abstract class StreamNegotiator {
|
|||
return iq;
|
||||
}
|
||||
|
||||
Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws XMPPException {
|
||||
Packet initiateIncomingStream(Connection connection, StreamInitiation initiation) throws XMPPException {
|
||||
StreamInitiation response = createInitiationAccept(initiation,
|
||||
getNamespaces());
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.util.LinkedList;
|
|||
|
||||
/**
|
||||
* A variant of the {@link org.jivesoftware.smack.PacketCollector} class
|
||||
* that does not force attachment to an <code>XMPPConnection</code>
|
||||
* that does not force attachment to a <code>Connection</code>
|
||||
* on creation and no filter is required. Used to collect message
|
||||
* packets targeted to a group chat room.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import org.jivesoftware.smackx.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.XMPPConnection, String)}
|
||||
* {@link org.jivesoftware.smackx.muc.MultiUserChat#getRoomInfo(org.jivesoftware.smack.Connection, String)}
|
||||
* or could be used for joining the room
|
||||
* {@link org.jivesoftware.smackx.muc.MultiUserChat#MultiUserChat(org.jivesoftware.smack.XMPPConnection, String)}
|
||||
* {@link org.jivesoftware.smackx.muc.MultiUserChat#MultiUserChat(org.jivesoftware.smack.Connection, String)}
|
||||
* and {@link org.jivesoftware.smackx.muc.MultiUserChat#join(String)}.
|
||||
*
|
||||
* @author Gaston Dombiak
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.muc;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
||||
/**
|
||||
|
|
@ -36,14 +36,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 XMPPConnection that received the invitation.
|
||||
* @param conn the Connection 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(XMPPConnection conn, String room, String inviter, String reason,
|
||||
public abstract void invitationReceived(Connection conn, String room, String inviter, String reason,
|
||||
String password, Message message);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.FromMatchesFilter;
|
||||
|
|
@ -79,10 +79,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<XMPPConnection, List<String>> joinedRooms =
|
||||
new WeakHashMap<XMPPConnection, List<String>>();
|
||||
private static Map<Connection, List<String>> joinedRooms =
|
||||
new WeakHashMap<Connection, List<String>>();
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private String room;
|
||||
private String subject;
|
||||
private String nickname = null;
|
||||
|
|
@ -106,8 +106,8 @@ public class MultiUserChat {
|
|||
private List<PacketListener> connectionListeners = new ArrayList<PacketListener>();
|
||||
|
||||
static {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(final XMPPConnection connection) {
|
||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(final Connection 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.
|
||||
|
|
@ -153,7 +153,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(XMPPConnection connection, String room) {
|
||||
public MultiUserChat(Connection connection, String room) {
|
||||
this.connection = connection;
|
||||
this.room = room.toLowerCase();
|
||||
init();
|
||||
|
|
@ -166,7 +166,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(XMPPConnection connection, String user) {
|
||||
public static boolean isServiceEnabled(Connection connection, String user) {
|
||||
try {
|
||||
DiscoverInfo result =
|
||||
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(user);
|
||||
|
|
@ -186,7 +186,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(XMPPConnection connection) {
|
||||
private static Iterator<String> getJoinedRooms(Connection connection) {
|
||||
List<String> rooms = joinedRooms.get(connection);
|
||||
if (rooms != null) {
|
||||
return rooms.iterator();
|
||||
|
|
@ -203,7 +203,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(XMPPConnection connection, String user) {
|
||||
public static Iterator<String> getJoinedRooms(Connection connection, String user) {
|
||||
try {
|
||||
ArrayList<String> answer = new ArrayList<String>();
|
||||
// Send the disco packet to the user
|
||||
|
|
@ -232,7 +232,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(XMPPConnection connection, String room)
|
||||
public static RoomInfo getRoomInfo(Connection connection, String room)
|
||||
throws XMPPException {
|
||||
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(room);
|
||||
return new RoomInfo(info);
|
||||
|
|
@ -245,7 +245,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(XMPPConnection connection) throws XMPPException {
|
||||
public static Collection<String> getServiceNames(Connection connection) throws XMPPException {
|
||||
final List<String> answer = new ArrayList<String>();
|
||||
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
DiscoverItems items = discoManager.discoverItems(connection.getServiceName());
|
||||
|
|
@ -275,7 +275,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(XMPPConnection connection, String serviceName)
|
||||
public static Collection<HostedRoom> getHostedRooms(Connection connection, String serviceName)
|
||||
throws XMPPException {
|
||||
List<HostedRoom> answer = new ArrayList<HostedRoom>();
|
||||
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
|
|
@ -768,7 +768,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(XMPPConnection conn, String room, String inviter, String reason) {
|
||||
public static void decline(Connection conn, String room, String inviter, String reason) {
|
||||
Message message = new Message(room);
|
||||
|
||||
// Create the MUCUser packet that will include the rejection
|
||||
|
|
@ -790,7 +790,7 @@ public class MultiUserChat {
|
|||
* @param conn the connection where the listener will be applied.
|
||||
* @param listener an invitation listener.
|
||||
*/
|
||||
public static void addInvitationListener(XMPPConnection conn, InvitationListener listener) {
|
||||
public static void addInvitationListener(Connection conn, InvitationListener listener) {
|
||||
InvitationsMonitor.getInvitationsMonitor(conn).addInvitationListener(listener);
|
||||
}
|
||||
|
||||
|
|
@ -801,7 +801,7 @@ public class MultiUserChat {
|
|||
* @param conn the connection where the listener was applied.
|
||||
* @param listener an invitation listener.
|
||||
*/
|
||||
public static void removeInvitationListener(XMPPConnection conn, InvitationListener listener) {
|
||||
public static void removeInvitationListener(Connection conn, InvitationListener listener) {
|
||||
InvitationsMonitor.getInvitationsMonitor(conn).removeInvitationListener(listener);
|
||||
}
|
||||
|
||||
|
|
@ -1901,7 +1901,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 XMPPConnection with the appropriate
|
||||
* PacketListener directly with the Connection with the appropriate
|
||||
* PacketListener.
|
||||
*
|
||||
* @param listener a packet listener.
|
||||
|
|
@ -2555,12 +2555,12 @@ public class MultiUserChat {
|
|||
private static class InvitationsMonitor 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 final static Map<XMPPConnection, WeakReference<InvitationsMonitor>> monitors =
|
||||
new WeakHashMap<XMPPConnection, WeakReference<InvitationsMonitor>>();
|
||||
private final static Map<Connection, WeakReference<InvitationsMonitor>> monitors =
|
||||
new WeakHashMap<Connection, WeakReference<InvitationsMonitor>>();
|
||||
|
||||
private final List<InvitationListener> invitationsListeners =
|
||||
new ArrayList<InvitationListener>();
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private PacketFilter invitationFilter;
|
||||
private PacketListener invitationPacketListener;
|
||||
|
||||
|
|
@ -2570,7 +2570,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(XMPPConnection conn) {
|
||||
public static InvitationsMonitor getInvitationsMonitor(Connection conn) {
|
||||
synchronized (monitors) {
|
||||
if (!monitors.containsKey(conn)) {
|
||||
// We need to use a WeakReference because the monitor references the
|
||||
|
|
@ -2589,7 +2589,7 @@ public class MultiUserChat {
|
|||
*
|
||||
* @param connection the connection to monitor for possible room invitations
|
||||
*/
|
||||
private InvitationsMonitor(XMPPConnection connection) {
|
||||
private InvitationsMonitor(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.muc;
|
|||
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
|
@ -34,9 +34,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
/**
|
||||
* A <code>RoomListenerMultiplexor</code> multiplexes incoming packets on
|
||||
* an <code>XMPPConnection</code> using a single listener/filter pair.
|
||||
* a <code>Connection</code> using a single listener/filter pair.
|
||||
* A single <code>RoomListenerMultiplexor</code> is created for each
|
||||
* {@link org.jivesoftware.smack.XMPPConnection} that has joined MUC rooms
|
||||
* {@link org.jivesoftware.smack.Connection} that has joined MUC rooms
|
||||
* within its session.
|
||||
*
|
||||
* @author Larry Kirschner
|
||||
|
|
@ -45,10 +45,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<XMPPConnection, WeakReference<RoomListenerMultiplexor>> monitors =
|
||||
new WeakHashMap<XMPPConnection, WeakReference<RoomListenerMultiplexor>>();
|
||||
private static final Map<Connection, WeakReference<RoomListenerMultiplexor>> monitors =
|
||||
new WeakHashMap<Connection, WeakReference<RoomListenerMultiplexor>>();
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private RoomMultiplexFilter filter;
|
||||
private RoomMultiplexListener listener;
|
||||
|
||||
|
|
@ -58,7 +58,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(XMPPConnection conn) {
|
||||
public static RoomListenerMultiplexor getRoomMultiplexor(Connection conn) {
|
||||
synchronized (monitors) {
|
||||
if (!monitors.containsKey(conn)) {
|
||||
RoomListenerMultiplexor rm = new RoomListenerMultiplexor(conn, new RoomMultiplexFilter(),
|
||||
|
|
@ -78,9 +78,9 @@ class RoomListenerMultiplexor implements ConnectionListener {
|
|||
|
||||
/**
|
||||
* All access should be through
|
||||
* the static method {@link #getRoomMultiplexor(XMPPConnection)}.
|
||||
* the static method {@link #getRoomMultiplexor(Connection)}.
|
||||
*/
|
||||
private RoomListenerMultiplexor(XMPPConnection connection, RoomMultiplexFilter filter,
|
||||
private RoomListenerMultiplexor(Connection connection, RoomMultiplexFilter filter,
|
||||
RoomMultiplexListener listener) {
|
||||
if (connection == null) {
|
||||
throw new IllegalArgumentException("Connection is null");
|
||||
|
|
@ -146,11 +146,11 @@ class RoomListenerMultiplexor implements ConnectionListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* The single <code>XMPPConnection</code>-level <code>PacketFilter</code> used by a {@link RoomListenerMultiplexor}
|
||||
* for all muc chat rooms on an <code>XMPPConnection</code>.
|
||||
* The single <code>Connection</code>-level <code>PacketFilter</code> used by a {@link RoomListenerMultiplexor}
|
||||
* for all muc chat rooms on an <code>Connection</code>.
|
||||
* Each time a muc chat room is added to/removed from an
|
||||
* <code>XMPPConnection</code> the address for that chat room
|
||||
* is added to/removed from that <code>XMPPConnection</code>'s
|
||||
* <code>Connection</code> the address for that chat room
|
||||
* is added to/removed from that <code>Connection</code>'s
|
||||
* <code>RoomMultiplexFilter</code>.
|
||||
*/
|
||||
private static class RoomMultiplexFilter implements PacketFilter {
|
||||
|
|
@ -181,12 +181,12 @@ class RoomListenerMultiplexor implements ConnectionListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* The single <code>XMPPConnection</code>-level <code>PacketListener</code>
|
||||
* The single <code>Connection</code>-level <code>PacketListener</code>
|
||||
* used by a {@link RoomListenerMultiplexor}
|
||||
* for all muc chat rooms on an <code>XMPPConnection</code>.
|
||||
* for all muc chat rooms on an <code>Connection</code>.
|
||||
* Each time a muc chat room is added to/removed from an
|
||||
* <code>XMPPConnection</code> the address and listener for that chat room
|
||||
* are added to/removed from that <code>XMPPConnection</code>'s
|
||||
* <code>Connection</code> the address and listener for that chat room
|
||||
* are added to/removed from that <code>Connection</code>'s
|
||||
* <code>RoomMultiplexListener</code>.
|
||||
*
|
||||
* @author Larry Kirschner
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.packet;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -127,14 +127,14 @@ public class LastActivity extends IQ {
|
|||
|
||||
/**
|
||||
* Retrieve the last activity of a particular jid.
|
||||
* @param con the current XMPPConnection.
|
||||
* @param con the current Connection.
|
||||
* @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.LastActivityManager#getLastActivity(XMPPConnection, String) getLastActivity}
|
||||
* Replaced by {@link org.jivesoftware.smackx.LastActivityManager#getLastActivity(Connection, String) getLastActivity}
|
||||
*/
|
||||
public static LastActivity getLastActivity(XMPPConnection con, String jid) throws XMPPException {
|
||||
public static LastActivity getLastActivity(Connection con, String jid) throws XMPPException {
|
||||
LastActivity activity = new LastActivity();
|
||||
jid = StringUtils.parseBareAddress(jid);
|
||||
activity.setTo(jid);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ public class Nick implements PacketExtension {
|
|||
*
|
||||
* @see org.jivesoftware.smack.packet.PacketExtension#getElementName()
|
||||
*/
|
||||
@Override
|
||||
public String getElementName() {
|
||||
return ELEMENT_NAME;
|
||||
}
|
||||
|
|
@ -74,7 +73,6 @@ public class Nick implements PacketExtension {
|
|||
*
|
||||
* @see org.jivesoftware.smack.packet.PacketExtension#getNamespace()
|
||||
*/
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
return NAMESPACE;
|
||||
}
|
||||
|
|
@ -84,7 +82,6 @@ public class Nick implements PacketExtension {
|
|||
*
|
||||
* @see org.jivesoftware.smack.packet.PacketExtension#toXML()
|
||||
*/
|
||||
@Override
|
||||
public String toXML() {
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ package org.jivesoftware.smackx.packet;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
|
|
@ -32,7 +32,7 @@ final public class SyncPacketSend
|
|||
private SyncPacketSend()
|
||||
{ }
|
||||
|
||||
static public Packet getReply(XMPPConnection connection, Packet packet, long timeout)
|
||||
static public Packet getReply(Connection connection, Packet packet, long timeout)
|
||||
throws XMPPException
|
||||
{
|
||||
PacketFilter responseFilter = new PacketIDFilter(packet.getPacketID());
|
||||
|
|
@ -55,7 +55,7 @@ final public class SyncPacketSend
|
|||
return result;
|
||||
}
|
||||
|
||||
static public Packet getReply(XMPPConnection connection, Packet packet)
|
||||
static public Packet getReply(Connection connection, Packet packet)
|
||||
throws XMPPException
|
||||
{
|
||||
return getReply(connection, packet, SmackConfiguration.getPacketReplyTimeout());
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.packet;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -493,10 +493,10 @@ public class VCard extends IQ {
|
|||
* <p/>
|
||||
* NOTE: the method is asynchronous and does not wait for the returned value.
|
||||
*
|
||||
* @param connection the XMPPConnection to use.
|
||||
* @param connection the Connection to use.
|
||||
* @throws XMPPException thrown if there was an issue setting the VCard in the server.
|
||||
*/
|
||||
public void save(XMPPConnection connection) throws XMPPException {
|
||||
public void save(Connection connection) throws XMPPException {
|
||||
checkAuthenticated(connection, true);
|
||||
|
||||
setType(IQ.Type.SET);
|
||||
|
|
@ -520,7 +520,7 @@ public class VCard extends IQ {
|
|||
* Load VCard information for a connected user. Connection should be authenticated
|
||||
* and not anonymous.
|
||||
*/
|
||||
public void load(XMPPConnection connection) throws XMPPException {
|
||||
public void load(Connection connection) throws XMPPException {
|
||||
checkAuthenticated(connection, true);
|
||||
|
||||
setFrom(connection.getUser());
|
||||
|
|
@ -530,14 +530,14 @@ public class VCard extends IQ {
|
|||
/**
|
||||
* Load VCard information for a given user. Connection should be authenticated and not anonymous.
|
||||
*/
|
||||
public void load(XMPPConnection connection, String user) throws XMPPException {
|
||||
public void load(Connection connection, String user) throws XMPPException {
|
||||
checkAuthenticated(connection, false);
|
||||
|
||||
setTo(user);
|
||||
doLoad(connection, user);
|
||||
}
|
||||
|
||||
private void doLoad(XMPPConnection connection, String user) throws XMPPException {
|
||||
private void doLoad(Connection connection, String user) throws XMPPException {
|
||||
setType(Type.GET);
|
||||
PacketCollector collector = connection.createPacketCollector(
|
||||
new PacketIDFilter(getPacketID()));
|
||||
|
|
@ -587,7 +587,7 @@ public class VCard extends IQ {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkAuthenticated(XMPPConnection connection, boolean checkForAnonymous) {
|
||||
private void checkAuthenticated(Connection connection, boolean checkForAnonymous) {
|
||||
if (connection == null) {
|
||||
throw new IllegalArgumentException("No connection was provided");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
|
||||
/**
|
||||
|
|
@ -22,7 +22,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 XMPPConnection}.
|
||||
* the {@link Connection}.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
|
||||
public class CollectionNode extends Node
|
||||
{
|
||||
CollectionNode(XMPPConnection connection, String nodeId)
|
||||
CollectionNode(Connection connection, String nodeId)
|
||||
{
|
||||
super(connection, nodeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smackx.packet.DiscoverItems;
|
||||
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smackx.pubsub.packet.SyncPacketSend;
|
|||
*/
|
||||
public class LeafNode extends Node
|
||||
{
|
||||
LeafNode(XMPPConnection connection, String nodeName)
|
||||
LeafNode(Connection connection, String nodeName)
|
||||
{
|
||||
super(connection, nodeName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.OrFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smackx.pubsub.util.NodeUtils;
|
|||
|
||||
abstract public class Node
|
||||
{
|
||||
protected XMPPConnection con;
|
||||
protected Connection con;
|
||||
protected String id;
|
||||
protected String to;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ abstract public class Node
|
|||
* @param connection The connection the node is associated with
|
||||
* @param nodeName The node id
|
||||
*/
|
||||
Node(XMPPConnection connection, String nodeName)
|
||||
Node(Connection connection, String nodeName)
|
||||
{
|
||||
con = connection;
|
||||
id = nodeName;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
|
|
@ -43,7 +43,7 @@ import org.jivesoftware.smackx.pubsub.util.NodeUtils;
|
|||
*/
|
||||
final public class PubSubManager
|
||||
{
|
||||
private XMPPConnection con;
|
||||
private Connection con;
|
||||
private String to;
|
||||
private Map<String, Node> nodeMap = new ConcurrentHashMap<String, Node>();
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ final public class PubSubManager
|
|||
*
|
||||
* @param connection The XMPP connection
|
||||
*/
|
||||
public PubSubManager(XMPPConnection connection)
|
||||
public PubSubManager(Connection connection)
|
||||
{
|
||||
con = connection;
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ final public class PubSubManager
|
|||
* @param connection The XMPP connection
|
||||
* @param toAddress The pubsub specific to address (required for some servers)
|
||||
*/
|
||||
public PubSubManager(XMPPConnection connection, String toAddress)
|
||||
public PubSubManager(Connection connection, String toAddress)
|
||||
{
|
||||
con = connection;
|
||||
to = toAddress;
|
||||
|
|
@ -300,25 +300,25 @@ final public class PubSubManager
|
|||
return request;
|
||||
}
|
||||
|
||||
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PacketExtension ext)
|
||||
static Packet sendPubsubPacket(Connection con, String to, Type type, PacketExtension ext)
|
||||
throws XMPPException
|
||||
{
|
||||
return sendPubsubPacket(con, to, type, ext, null);
|
||||
}
|
||||
|
||||
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PacketExtension ext, PubSubNamespace ns)
|
||||
static Packet sendPubsubPacket(Connection con, String to, Type type, PacketExtension ext, PubSubNamespace ns)
|
||||
throws XMPPException
|
||||
{
|
||||
return SyncPacketSend.getReply(con, createPubsubPacket(to, type, ext, ns));
|
||||
}
|
||||
|
||||
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PubSub packet)
|
||||
static Packet sendPubsubPacket(Connection con, String to, Type type, PubSub packet)
|
||||
throws XMPPException
|
||||
{
|
||||
return sendPubsubPacket(con, to, type, packet, null);
|
||||
}
|
||||
|
||||
static Packet sendPubsubPacket(XMPPConnection con, String to, Type type, PubSub packet, PubSubNamespace ns)
|
||||
static Packet sendPubsubPacket(Connection con, String to, Type type, PubSub packet, PubSubNamespace ns)
|
||||
throws XMPPException
|
||||
{
|
||||
return SyncPacketSend.getReply(con, packet);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ package org.jivesoftware.smackx.pubsub.packet;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
|
|
@ -32,7 +32,7 @@ final public class SyncPacketSend
|
|||
private SyncPacketSend()
|
||||
{ }
|
||||
|
||||
static public Packet getReply(XMPPConnection connection, Packet packet, long timeout)
|
||||
static public Packet getReply(Connection connection, Packet packet, long timeout)
|
||||
throws XMPPException
|
||||
{
|
||||
PacketFilter responseFilter = new PacketIDFilter(packet.getPacketID());
|
||||
|
|
@ -55,7 +55,7 @@ final public class SyncPacketSend
|
|||
return result;
|
||||
}
|
||||
|
||||
static public Packet getReply(XMPPConnection connection, Packet packet)
|
||||
static public Packet getReply(Connection connection, Packet packet)
|
||||
throws XMPPException
|
||||
{
|
||||
return getReply(connection, packet, SmackConfiguration.getPacketReplyTimeout());
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.search;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -59,13 +59,13 @@ public class UserSearch extends IQ {
|
|||
/**
|
||||
* Returns the form for all search fields supported by the search service.
|
||||
*
|
||||
* @param con the current XMPPConnection.
|
||||
* @param con the current Connection.
|
||||
* @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(XMPPConnection con, String searchService) throws XMPPException {
|
||||
public Form getSearchForm(Connection con, String searchService) throws XMPPException {
|
||||
UserSearch search = new UserSearch();
|
||||
search.setType(IQ.Type.GET);
|
||||
search.setTo(searchService);
|
||||
|
|
@ -89,14 +89,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 XMPPConnection.
|
||||
* @param con the current Connection.
|
||||
* @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(XMPPConnection con, Form searchForm, String searchService) throws XMPPException {
|
||||
public ReportedData sendSearchForm(Connection con, Form searchForm, String searchService) throws XMPPException {
|
||||
UserSearch search = new UserSearch();
|
||||
search.setType(IQ.Type.SET);
|
||||
search.setTo(searchService);
|
||||
|
|
@ -124,14 +124,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 XMPPConnection.
|
||||
* @param con the current Connection.
|
||||
* @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(XMPPConnection con, Form searchForm, String searchService) throws XMPPException {
|
||||
public ReportedData sendSimpleSearchForm(Connection con, Form searchForm, String searchService) throws XMPPException {
|
||||
SimpleUserSearch search = new SimpleUserSearch();
|
||||
search.setForm(searchForm);
|
||||
search.setType(IQ.Type.SET);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.search;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.Form;
|
||||
import org.jivesoftware.smackx.ReportedData;
|
||||
|
|
@ -35,7 +35,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>
|
||||
* XMPPConnection con = new XMPPConnection("jabber.org");
|
||||
* Connection con = new XMPPConnection("jabber.org");
|
||||
* con.login("john", "doe");
|
||||
* UserSearchManager search = new UserSearchManager(con, "users.jabber.org");
|
||||
* Form searchForm = search.getSearchForm();
|
||||
|
|
@ -49,15 +49,15 @@ import java.util.List;
|
|||
*/
|
||||
public class UserSearchManager {
|
||||
|
||||
private XMPPConnection con;
|
||||
private Connection con;
|
||||
private UserSearch userSearch;
|
||||
|
||||
/**
|
||||
* Creates a new UserSearchManager.
|
||||
*
|
||||
* @param con the XMPPConnection to use.
|
||||
* @param con the Connection to use.
|
||||
*/
|
||||
public UserSearchManager(XMPPConnection con) {
|
||||
public UserSearchManager(Connection con) {
|
||||
this.con = con;
|
||||
userSearch = new UserSearch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.jivesoftware.smackx.workgroup.packet.AgentInfo;
|
|||
import org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -36,10 +36,10 @@ import java.util.Collection;
|
|||
* @author Derek DeMoro
|
||||
*/
|
||||
public class Agent {
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private String workgroupJID;
|
||||
|
||||
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws XMPPException {
|
||||
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, Connection connection) throws XMPPException {
|
||||
AgentWorkgroups request = new AgentWorkgroups(agentJID);
|
||||
request.setTo(serviceJID);
|
||||
PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
|
||||
|
|
@ -62,7 +62,7 @@ public class Agent {
|
|||
/**
|
||||
* Constructs an Agent.
|
||||
*/
|
||||
Agent(XMPPConnection connection, String workgroupJID) {
|
||||
Agent(Connection connection, String workgroupJID) {
|
||||
this.connection = connection;
|
||||
this.workgroupJID = workgroupJID;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
import org.jivesoftware.smackx.workgroup.packet.AgentStatus;
|
||||
import org.jivesoftware.smackx.workgroup.packet.AgentStatusRequest;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
|
@ -50,7 +50,7 @@ public class AgentRoster {
|
|||
private static final int EVENT_AGENT_REMOVED = 1;
|
||||
private static final int EVENT_PRESENCE_CHANGED = 2;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private String workgroupJID;
|
||||
private List<String> entries;
|
||||
private List<AgentRosterListener> listeners;
|
||||
|
|
@ -64,7 +64,7 @@ public class AgentRoster {
|
|||
*
|
||||
* @param connection an XMPP connection.
|
||||
*/
|
||||
AgentRoster(XMPPConnection connection, String workgroupJID) {
|
||||
AgentRoster(Connection connection, String workgroupJID) {
|
||||
this.connection = connection;
|
||||
this.workgroupJID = workgroupJID;
|
||||
entries = new ArrayList<String>();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import java.util.*;
|
|||
*/
|
||||
public class AgentSession {
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
private String workgroupJID;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ public class AgentSession {
|
|||
* authentication.
|
||||
* @param workgroupJID the fully qualified JID of the workgroup.
|
||||
*/
|
||||
public AgentSession(String workgroupJID, XMPPConnection connection) {
|
||||
public AgentSession(String workgroupJID, Connection connection) {
|
||||
// Login must have been done before passing in connection.
|
||||
if (!connection.isAuthenticated()) {
|
||||
throw new IllegalStateException("Must login to server before creating workgroup.");
|
||||
|
|
@ -1112,12 +1112,12 @@ public class AgentSession {
|
|||
/**
|
||||
* Returns the generic metadata of the workgroup the agent belongs to.
|
||||
*
|
||||
* @param con the XMPPConnection to use.
|
||||
* @param con the Connection to use.
|
||||
* @param query an optional query object used to tell the server what metadata to retrieve. This can be null.
|
||||
* @throws XMPPException if an error occurs while sending the request to the server.
|
||||
* @return the settings for the workgroup.
|
||||
*/
|
||||
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws XMPPException {
|
||||
public GenericSettings getGenericSettings(Connection con, String query) throws XMPPException {
|
||||
GenericSettings setting = new GenericSettings();
|
||||
setting.setType(IQ.Type.GET);
|
||||
setting.setTo(workgroupJID);
|
||||
|
|
@ -1138,7 +1138,7 @@ public class AgentSession {
|
|||
return response;
|
||||
}
|
||||
|
||||
public boolean hasMonitorPrivileges(XMPPConnection con) throws XMPPException {
|
||||
public boolean hasMonitorPrivileges(Connection con) throws XMPPException {
|
||||
MonitorPacket request = new MonitorPacket();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
|
@ -1160,7 +1160,7 @@ public class AgentSession {
|
|||
|
||||
}
|
||||
|
||||
public void makeRoomOwner(XMPPConnection con, String sessionID) throws XMPPException {
|
||||
public void makeRoomOwner(Connection con, String sessionID) throws XMPPException {
|
||||
MonitorPacket request = new MonitorPacket();
|
||||
request.setType(IQ.Type.SET);
|
||||
request.setTo(workgroupJID);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ import java.util.Map;
|
|||
*/
|
||||
public class Offer {
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private AgentSession session;
|
||||
|
||||
private String sessionID;
|
||||
|
|
@ -64,7 +64,7 @@ public class Offer {
|
|||
* @param content content of the offer. The content explains the reason for the offer
|
||||
* (e.g. user request, transfer)
|
||||
*/
|
||||
Offer(XMPPConnection conn, AgentSession agentSession, String userID,
|
||||
Offer(Connection conn, AgentSession agentSession, String userID,
|
||||
String userJID, String workgroupName, Date expiresDate,
|
||||
String sessionID, Map metaData, OfferContent content)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
|
@ -46,7 +46,7 @@ public class OfferConfirmation extends IQ {
|
|||
}
|
||||
|
||||
|
||||
public void notifyService(XMPPConnection con, String workgroup, String createdRoomName) {
|
||||
public void notifyService(Connection con, String workgroup, String createdRoomName) {
|
||||
NotifyServicePacket packet = new NotifyServicePacket(workgroup, createdRoomName);
|
||||
con.sendPacket(packet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.jivesoftware.smackx.workgroup.packet.Transcript;
|
|||
import org.jivesoftware.smackx.workgroup.packet.Transcripts;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
|
||||
|
|
@ -35,9 +35,9 @@ import org.jivesoftware.smack.filter.PacketIDFilter;
|
|||
* @author Gaston Dombiak
|
||||
*/
|
||||
public class TranscriptManager {
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
public TranscriptManager(XMPPConnection connection) {
|
||||
public TranscriptManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
import org.jivesoftware.smackx.workgroup.packet.TranscriptSearch;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
|
@ -37,9 +37,9 @@ import org.jivesoftware.smackx.ReportedData;
|
|||
* @author Gaston Dombiak
|
||||
*/
|
||||
public class TranscriptSearchManager {
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
public TranscriptSearchManager(XMPPConnection connection) {
|
||||
public TranscriptSearchManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import java.util.Map;
|
|||
public class Workgroup {
|
||||
|
||||
private String workgroupJID;
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private boolean inQueue;
|
||||
private List invitationListeners;
|
||||
private List queueListeners;
|
||||
|
|
@ -75,7 +75,7 @@ public class Workgroup {
|
|||
* @param connection an XMPP connection which must have already undergone a
|
||||
* successful login.
|
||||
*/
|
||||
public Workgroup(String workgroupJID, XMPPConnection connection) {
|
||||
public Workgroup(String workgroupJID, Connection connection) {
|
||||
// Login must have been done before passing in connection.
|
||||
if (!connection.isAuthenticated()) {
|
||||
throw new IllegalStateException("Must login to server before creating workgroup.");
|
||||
|
|
@ -114,7 +114,7 @@ public class Workgroup {
|
|||
*/
|
||||
MultiUserChat.addInvitationListener(connection,
|
||||
new org.jivesoftware.smackx.muc.InvitationListener() {
|
||||
public void invitationReceived(XMPPConnection conn, String room, String inviter,
|
||||
public void invitationReceived(Connection conn, String room, String inviter,
|
||||
String reason, String password, Message message) {
|
||||
inQueue = false;
|
||||
queuePosition = -1;
|
||||
|
|
@ -854,7 +854,7 @@ public class Workgroup {
|
|||
|
||||
/*
|
||||
public static void main(String args[]) throws Exception {
|
||||
XMPPConnection con = new XMPPConnection("anteros");
|
||||
Connection con = new XMPPConnection("anteros");
|
||||
con.connect();
|
||||
con.loginAnonymously();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue