mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 13:11:08 +01:00
SMACK-363 Applied code cleanup patches for many generics related issues.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13325 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
6dc64671e2
commit
e08c8afe44
109 changed files with 577 additions and 605 deletions
|
|
@ -318,8 +318,8 @@ public class AgentRoster {
|
|||
}
|
||||
// Fire an event.
|
||||
synchronized (entries) {
|
||||
for (Iterator i = entries.iterator(); i.hasNext();) {
|
||||
String entry = (String)i.next();
|
||||
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
||||
String entry = i.next();
|
||||
if (entry.toLowerCase().equals(StringUtils.parseBareAddress(key).toLowerCase())) {
|
||||
fireEvent(EVENT_PRESENCE_CHANGED, packet);
|
||||
}
|
||||
|
|
@ -358,8 +358,8 @@ public class AgentRoster {
|
|||
public void processPacket(Packet packet) {
|
||||
if (packet instanceof AgentStatusRequest) {
|
||||
AgentStatusRequest statusRequest = (AgentStatusRequest)packet;
|
||||
for (Iterator i = statusRequest.getAgents().iterator(); i.hasNext();) {
|
||||
AgentStatusRequest.Item item = (AgentStatusRequest.Item)i.next();
|
||||
for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) {
|
||||
AgentStatusRequest.Item item = i.next();
|
||||
String agentJID = item.getJID();
|
||||
if ("remove".equals(item.getType())) {
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smackx.workgroup.MetaData;
|
||||
import org.jivesoftware.smackx.workgroup.QueueUser;
|
||||
import org.jivesoftware.smackx.workgroup.WorkgroupInvitation;
|
||||
import org.jivesoftware.smackx.workgroup.WorkgroupInvitationListener;
|
||||
import org.jivesoftware.smackx.workgroup.ext.history.AgentChatHistory;
|
||||
|
|
@ -60,7 +61,7 @@ public class AgentSession {
|
|||
private boolean online = false;
|
||||
private Presence.Mode presenceMode;
|
||||
private int maxChats;
|
||||
private final Map<String, String> metaData;
|
||||
private final Map<String, List<String>> metaData;
|
||||
|
||||
private Map<String, WorkgroupQueue> queues;
|
||||
|
||||
|
|
@ -96,7 +97,7 @@ public class AgentSession {
|
|||
|
||||
this.maxChats = -1;
|
||||
|
||||
this.metaData = new HashMap<String, String>();
|
||||
this.metaData = new HashMap<String, List<String>>();
|
||||
|
||||
this.queues = new HashMap<String, WorkgroupQueue>();
|
||||
|
||||
|
|
@ -199,10 +200,10 @@ public class AgentSession {
|
|||
*/
|
||||
public void setMetaData(String key, String val) throws XMPPException {
|
||||
synchronized (this.metaData) {
|
||||
String oldVal = (String)this.metaData.get(key);
|
||||
List<String> oldVals = metaData.get(key);
|
||||
|
||||
if ((oldVal == null) || (!oldVal.equals(val))) {
|
||||
metaData.put(key, val);
|
||||
if ((oldVals == null) || (!oldVals.get(0).equals(val))) {
|
||||
oldVals.set(0, val);
|
||||
|
||||
setStatus(presenceMode, maxChats);
|
||||
}
|
||||
|
|
@ -218,7 +219,7 @@ public class AgentSession {
|
|||
*/
|
||||
public void removeMetaData(String key) throws XMPPException {
|
||||
synchronized (this.metaData) {
|
||||
String oldVal = (String)metaData.remove(key);
|
||||
List<String> oldVal = metaData.remove(key);
|
||||
|
||||
if (oldVal != null) {
|
||||
setStatus(presenceMode, maxChats);
|
||||
|
|
@ -233,8 +234,8 @@ public class AgentSession {
|
|||
* @return the meta data value associated with the key or <tt>null</tt> if the meta-data
|
||||
* doesn't exist..
|
||||
*/
|
||||
public String getMetaData(String key) {
|
||||
return (String)metaData.get(key);
|
||||
public List<String> getMetaData(String key) {
|
||||
return metaData.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -642,7 +643,7 @@ public class AgentSession {
|
|||
}
|
||||
|
||||
private void fireInvitationEvent(String groupChatJID, String sessionID, String body,
|
||||
String from, Map metaData) {
|
||||
String from, Map<String, List<String>> metaData) {
|
||||
WorkgroupInvitation invitation = new WorkgroupInvitation(connection.getUser(), groupChatJID,
|
||||
workgroupJID, sessionID, body, from, metaData);
|
||||
|
||||
|
|
@ -654,7 +655,7 @@ public class AgentSession {
|
|||
}
|
||||
|
||||
private void fireQueueUsersEvent(WorkgroupQueue queue, WorkgroupQueue.Status status,
|
||||
int averageWaitTime, Date oldestEntry, Set users) {
|
||||
int averageWaitTime, Date oldestEntry, Set<QueueUser> users) {
|
||||
synchronized (queueUsersListeners) {
|
||||
for (QueueUsersListener listener : queueUsersListeners) {
|
||||
if (status != null) {
|
||||
|
|
@ -754,7 +755,7 @@ public class AgentSession {
|
|||
MUCUser.Invite invite = mucUser != null ? mucUser.getInvite() : null;
|
||||
if (invite != null && workgroupJID.equals(invite.getFrom())) {
|
||||
String sessionID = null;
|
||||
Map metaData = null;
|
||||
Map<String, List<String>> metaData = null;
|
||||
|
||||
SessionID sessionIDExt = (SessionID)message.getExtension(SessionID.ELEMENT_NAME,
|
||||
SessionID.NAMESPACE);
|
||||
|
|
@ -980,7 +981,7 @@ public class AgentSession {
|
|||
* @return Map a map of all metadata associated with the sessionID.
|
||||
* @throws XMPPException if an error occurs while getting information from the server.
|
||||
*/
|
||||
public Map getChatMetadata(String sessionID) throws XMPPException {
|
||||
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException {
|
||||
ChatMetadata request = new ChatMetadata();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +45,7 @@ public class Offer {
|
|||
private String userID;
|
||||
private String workgroupName;
|
||||
private Date expiresDate;
|
||||
private Map metaData;
|
||||
private Map<String, List<String>> metaData;
|
||||
private OfferContent content;
|
||||
|
||||
private boolean accepted = false;
|
||||
|
|
@ -66,7 +67,7 @@ public class Offer {
|
|||
*/
|
||||
Offer(Connection conn, AgentSession agentSession, String userID,
|
||||
String userJID, String workgroupName, Date expiresDate,
|
||||
String sessionID, Map metaData, OfferContent content)
|
||||
String sessionID, Map<String, List<String>> metaData, OfferContent content)
|
||||
{
|
||||
this.connection = conn;
|
||||
this.session = agentSession;
|
||||
|
|
@ -155,7 +156,7 @@ public class Offer {
|
|||
*
|
||||
* @return the offer meta-data.
|
||||
*/
|
||||
public Map getMetaData() {
|
||||
public Map<String, List<String>> getMetaData() {
|
||||
return this.metaData;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jivesoftware.smackx.workgroup.QueueUser;
|
||||
|
||||
public interface QueueUsersListener {
|
||||
|
||||
/**
|
||||
|
|
@ -54,5 +56,5 @@ public interface QueueUsersListener {
|
|||
* @param queue the workgroup queue.
|
||||
* @param users the list of users waiting in the queue.
|
||||
*/
|
||||
public void usersUpdated(WorkgroupQueue queue, Set users);
|
||||
public void usersUpdated(WorkgroupQueue queue, Set<QueueUser> users);
|
||||
}
|
||||
|
|
@ -21,6 +21,8 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import org.jivesoftware.smackx.workgroup.QueueUser;
|
||||
|
||||
/**
|
||||
* A queue in a workgroup, which is a pool of agents that are routed a specific type of
|
||||
* chat request.
|
||||
|
|
@ -32,7 +34,7 @@ public class WorkgroupQueue {
|
|||
|
||||
private int averageWaitTime = -1;
|
||||
private Date oldestEntry = null;
|
||||
private Set users = Collections.EMPTY_SET;
|
||||
private Set<QueueUser> users = Collections.emptySet();
|
||||
|
||||
private int maxChats = 0;
|
||||
private int currentChats = 0;
|
||||
|
|
@ -87,14 +89,14 @@ public class WorkgroupQueue {
|
|||
*
|
||||
* @return an Iterator for the users waiting in the queue.
|
||||
*/
|
||||
public Iterator getUsers() {
|
||||
public Iterator<QueueUser> getUsers() {
|
||||
if (users == null) {
|
||||
return Collections.EMPTY_SET.iterator();
|
||||
return new HashSet<QueueUser>().iterator();
|
||||
}
|
||||
return Collections.unmodifiableSet(users).iterator();
|
||||
}
|
||||
|
||||
void setUsers(Set users) {
|
||||
void setUsers(Set<QueueUser> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue