mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Renamed Connection to XMPPConnection
This commit is contained in:
parent
f3e007bad5
commit
489816c61f
145 changed files with 639 additions and 641 deletions
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
|
||||
import org.jivesoftware.smackx.workgroup.packet.AgentInfo;
|
||||
import org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
|
@ -31,10 +31,10 @@ import java.util.Collection;
|
|||
* @author Derek DeMoro
|
||||
*/
|
||||
public class Agent {
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
private String workgroupJID;
|
||||
|
||||
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, Connection connection) throws XMPPException {
|
||||
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws XMPPException {
|
||||
AgentWorkgroups request = new AgentWorkgroups(agentJID);
|
||||
request.setTo(serviceJID);
|
||||
AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
|
@ -44,7 +44,7 @@ public class Agent {
|
|||
/**
|
||||
* Constructs an Agent.
|
||||
*/
|
||||
Agent(Connection connection, String workgroupJID) {
|
||||
Agent(XMPPConnection connection, String workgroupJID) {
|
||||
this.connection = connection;
|
||||
this.workgroupJID = workgroupJID;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,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.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
@ -49,7 +49,7 @@ public class AgentRoster {
|
|||
private static final int EVENT_AGENT_REMOVED = 1;
|
||||
private static final int EVENT_PRESENCE_CHANGED = 2;
|
||||
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
private String workgroupJID;
|
||||
private List<String> entries;
|
||||
private List<AgentRosterListener> listeners;
|
||||
|
@ -63,7 +63,7 @@ public class AgentRoster {
|
|||
*
|
||||
* @param connection an XMPP connection.
|
||||
*/
|
||||
AgentRoster(Connection connection, String workgroupJID) {
|
||||
AgentRoster(XMPPConnection connection, String workgroupJID) {
|
||||
this.connection = connection;
|
||||
this.workgroupJID = workgroupJID;
|
||||
entries = new ArrayList<String>();
|
||||
|
|
|
@ -55,7 +55,7 @@ import java.util.logging.Logger;
|
|||
public class AgentSession {
|
||||
private static final Logger LOGGER = Logger.getLogger(AgentSession.class.getName());
|
||||
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
|
||||
private String workgroupJID;
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class AgentSession {
|
|||
* authentication.
|
||||
* @param workgroupJID the fully qualified JID of the workgroup.
|
||||
*/
|
||||
public AgentSession(String workgroupJID, Connection connection) {
|
||||
public AgentSession(String workgroupJID, XMPPConnection connection) {
|
||||
// Login must have been done before passing in connection.
|
||||
if (!connection.isAuthenticated()) {
|
||||
throw new IllegalStateException("Must login to server before creating workgroup.");
|
||||
|
@ -966,12 +966,12 @@ public class AgentSession {
|
|||
/**
|
||||
* Returns the generic metadata of the workgroup the agent belongs to.
|
||||
*
|
||||
* @param con the Connection to use.
|
||||
* @param con the XMPPConnection 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(Connection con, String query) throws XMPPException {
|
||||
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws XMPPException {
|
||||
GenericSettings setting = new GenericSettings();
|
||||
setting.setType(IQ.Type.GET);
|
||||
setting.setTo(workgroupJID);
|
||||
|
@ -981,7 +981,7 @@ public class AgentSession {
|
|||
return response;
|
||||
}
|
||||
|
||||
public boolean hasMonitorPrivileges(Connection con) throws XMPPException {
|
||||
public boolean hasMonitorPrivileges(XMPPConnection con) throws XMPPException {
|
||||
MonitorPacket request = new MonitorPacket();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -990,7 +990,7 @@ public class AgentSession {
|
|||
return response.isMonitor();
|
||||
}
|
||||
|
||||
public void makeRoomOwner(Connection con, String sessionID) throws XMPPException {
|
||||
public void makeRoomOwner(XMPPConnection con, String sessionID) throws XMPPException {
|
||||
MonitorPacket request = new MonitorPacket();
|
||||
request.setType(IQ.Type.SET);
|
||||
request.setTo(workgroupJID);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
||||
|
@ -35,7 +35,7 @@ import java.util.Map;
|
|||
*/
|
||||
public class Offer {
|
||||
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
private AgentSession session;
|
||||
|
||||
private String sessionID;
|
||||
|
@ -62,7 +62,7 @@ public class Offer {
|
|||
* @param content content of the offer. The content explains the reason for the offer
|
||||
* (e.g. user request, transfer)
|
||||
*/
|
||||
Offer(Connection conn, AgentSession agentSession, String userID,
|
||||
Offer(XMPPConnection conn, AgentSession agentSession, String userID,
|
||||
String userJID, String workgroupName, Date expiresDate,
|
||||
String sessionID, Map<String, List<String>> metaData, OfferContent content)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
@ -44,7 +44,7 @@ public class OfferConfirmation extends IQ {
|
|||
}
|
||||
|
||||
|
||||
public void notifyService(Connection con, String workgroup, String createdRoomName) {
|
||||
public void notifyService(XMPPConnection con, String workgroup, String createdRoomName) {
|
||||
NotifyServicePacket packet = new NotifyServicePacket(workgroup, createdRoomName);
|
||||
con.sendPacket(packet);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
|
||||
import org.jivesoftware.smackx.workgroup.packet.Transcript;
|
||||
import org.jivesoftware.smackx.workgroup.packet.Transcripts;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
/**
|
||||
|
@ -30,9 +30,9 @@ import org.jivesoftware.smack.XMPPException;
|
|||
* @author Gaston Dombiak
|
||||
*/
|
||||
public class TranscriptManager {
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
|
||||
public TranscriptManager(Connection connection) {
|
||||
public TranscriptManager(XMPPConnection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
import org.jivesoftware.smackx.search.ReportedData;
|
||||
import org.jivesoftware.smackx.workgroup.packet.TranscriptSearch;
|
||||
import org.jivesoftware.smackx.xdata.Form;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
|
@ -32,9 +32,9 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
* @author Gaston Dombiak
|
||||
*/
|
||||
public class TranscriptSearchManager {
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
|
||||
public TranscriptSearchManager(Connection connection) {
|
||||
public TranscriptSearchManager(XMPPConnection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import java.util.Map;
|
|||
public class Workgroup {
|
||||
|
||||
private String workgroupJID;
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
private boolean inQueue;
|
||||
private List<WorkgroupInvitationListener> invitationListeners;
|
||||
private List<QueueListener> queueListeners;
|
||||
|
@ -74,7 +74,7 @@ public class Workgroup {
|
|||
* @param connection an XMPP connection which must have already undergone a
|
||||
* successful login.
|
||||
*/
|
||||
public Workgroup(String workgroupJID, Connection connection) {
|
||||
public Workgroup(String workgroupJID, XMPPConnection connection) {
|
||||
// Login must have been done before passing in connection.
|
||||
if (!connection.isAuthenticated()) {
|
||||
throw new IllegalStateException("Must login to server before creating workgroup.");
|
||||
|
@ -112,7 +112,7 @@ public class Workgroup {
|
|||
*/
|
||||
MultiUserChat.addInvitationListener(connection,
|
||||
new org.jivesoftware.smackx.muc.InvitationListener() {
|
||||
public void invitationReceived(Connection conn, String room, String inviter,
|
||||
public void invitationReceived(XMPPConnection conn, String room, String inviter,
|
||||
String reason, String password, Message message) {
|
||||
inQueue = false;
|
||||
queuePosition = -1;
|
||||
|
|
|
@ -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.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
@ -49,17 +49,17 @@ public class RosterExchangeManager {
|
|||
public final static String NAMESPACE = "jabber:x:roster";
|
||||
public final static String ELEMENT = "x";
|
||||
|
||||
private final static Map<Connection, RosterExchangeManager> INSTANCES =
|
||||
Collections.synchronizedMap(new WeakHashMap<Connection, RosterExchangeManager>());
|
||||
private final static Map<XMPPConnection, RosterExchangeManager> INSTANCES =
|
||||
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, RosterExchangeManager>());
|
||||
|
||||
private final static PacketFilter PACKET_FILTER = new PacketExtensionFilter(ELEMENT, NAMESPACE);
|
||||
|
||||
private final Set<RosterExchangeListener> rosterExchangeListeners = Collections.synchronizedSet(new HashSet<RosterExchangeListener>());
|
||||
|
||||
private final WeakReference<Connection> weakRefConnection;
|
||||
private final WeakReference<XMPPConnection> weakRefConnection;
|
||||
private final PacketListener packetListener;
|
||||
|
||||
public synchronized static RosterExchangeManager getInstanceFor(Connection connection) {
|
||||
public synchronized static RosterExchangeManager getInstanceFor(XMPPConnection connection) {
|
||||
RosterExchangeManager rosterExchangeManager = INSTANCES.get(connection);
|
||||
if (rosterExchangeManager == null) {
|
||||
rosterExchangeManager = new RosterExchangeManager(connection);
|
||||
|
@ -70,10 +70,10 @@ public class RosterExchangeManager {
|
|||
/**
|
||||
* Creates a new roster exchange manager.
|
||||
*
|
||||
* @param con a Connection which is used to send and receive messages.
|
||||
* @param con a XMPPConnection which is used to send and receive messages.
|
||||
*/
|
||||
public RosterExchangeManager(Connection connection) {
|
||||
weakRefConnection = new WeakReference<Connection>(connection);
|
||||
public RosterExchangeManager(XMPPConnection connection) {
|
||||
weakRefConnection = new WeakReference<XMPPConnection>(connection);
|
||||
// Listens for all roster exchange packets and fire the roster exchange listeners.
|
||||
packetListener = new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
|
@ -122,7 +122,7 @@ public class RosterExchangeManager {
|
|||
RosterExchange rosterExchange = new RosterExchange(roster);
|
||||
msg.addExtension(rosterExchange);
|
||||
|
||||
Connection connection = weakRefConnection.get();
|
||||
XMPPConnection connection = weakRefConnection.get();
|
||||
// Send the message that contains the roster
|
||||
connection.sendPacket(msg);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class RosterExchangeManager {
|
|||
rosterExchange.addRosterEntry(rosterEntry);
|
||||
msg.addExtension(rosterExchange);
|
||||
|
||||
Connection connection = weakRefConnection.get();
|
||||
XMPPConnection connection = weakRefConnection.get();
|
||||
// Send the message that contains the roster
|
||||
connection.sendPacket(msg);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class RosterExchangeManager {
|
|||
}
|
||||
msg.addExtension(rosterExchange);
|
||||
|
||||
Connection connection = weakRefConnection.get();
|
||||
XMPPConnection connection = weakRefConnection.get();
|
||||
// Send the message that contains the roster
|
||||
connection.sendPacket(msg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue