/** * Adds an invitation listener. * * @param invitationListener the invitation listener. */ public void addInvitationListener(WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { if (!invitationListeners.contains(invitationListener)) { invitationListeners.add(invitationListener); } } }
private void fireInvitationEvent(String groupChatJID, String sessionID, String body, String from, Map<String, List<String>> metaData) { WorkgroupInvitation invitation = new WorkgroupInvitation(connection.getUser(), groupChatJID, workgroupJID, sessionID, body, from, metaData); synchronized (invitationListeners) { for (WorkgroupInvitationListener listener : invitationListeners) { listener.invitationReceived(invitation); } } }
private void fireInvitationEvent(String groupChatJID, String sessionID, String body, String from, Map metaData) { WorkgroupInvitation invitation = new WorkgroupInvitation(connection.getUser(), groupChatJID, workgroupJID, sessionID, body, from, metaData); synchronized (invitationListeners) { for (WorkgroupInvitationListener listener : invitationListeners) { listener.invitationReceived(invitation); } } }
/** * Adds an invitation listener that will be notified of groupchat invitations * from the workgroup for the the user that created this Workgroup instance. * * @param invitationListener the invitation listener. */ public void addInvitationListener(WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { if (!invitationListeners.contains(invitationListener)) { invitationListeners.add(invitationListener); } } }
private void fireInvitationEvent(WorkgroupInvitation invitation) { synchronized (invitationListeners) { for (Iterator i = invitationListeners.iterator(); i.hasNext();) { WorkgroupInvitationListener listener = (WorkgroupInvitationListener)i.next(); listener.invitationReceived(invitation); } } }
private void fireInvitationEvent(WorkgroupInvitation invitation) { synchronized (invitationListeners) { for (Iterator<WorkgroupInvitationListener> i = invitationListeners.iterator(); i.hasNext();) { WorkgroupInvitationListener listener = i.next(); listener.invitationReceived(invitation); } } }
/** * Adds an invitation listener. * * @param invitationListener * the invitation listener. */ public void addInvitationListener( WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { if (!invitationListeners.contains(invitationListener)) { invitationListeners.add(invitationListener); } } }
/** * Removes an invitation listener. * * @param invitationListener * the invitation listener. */ public void removeInvitationListener( WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { invitationListeners.remove(invitationListener); } }
private void fireInvitationEvent(String groupChatJID, String sessionID, String body, String from, Map metaData) { WorkgroupInvitation invitation = new WorkgroupInvitation( connection.getUser(), groupChatJID, workgroupJID, sessionID, body, from, metaData); synchronized (invitationListeners) { for (WorkgroupInvitationListener listener : invitationListeners) { listener.invitationReceived(invitation); } } }
/** * Adds an invitation listener that will be notified of groupchat * invitations from the workgroup for the the user that created this * Workgroup instance. * * @param invitationListener * the invitation listener. */ public void addInvitationListener( WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { if (!invitationListeners.contains(invitationListener)) { invitationListeners.add(invitationListener); } } }
/** * Removes an invitation listener. * * @param invitationListener * the invitation listener. */ public void removeQueueListener( WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { invitationListeners.remove(invitationListener); } }
private void fireInvitationEvent(WorkgroupInvitation invitation) { synchronized (invitationListeners) { for (Iterator i = invitationListeners.iterator(); i.hasNext();) { WorkgroupInvitationListener listener = (WorkgroupInvitationListener) i .next(); listener.invitationReceived(invitation); } } }
/** * Joins a queue of the specified workgroup with the associated metadata. * * @param workgroupName the name of the workgroup to join. * @param metaData the metadata associated with this request. * @throws XMPPException if an error occurs. */ public void joinQueue(String workgroupName, Map metaData) throws XMPPException { // Never have null values in metadata if (metaData.containsValue(null)) { WebLog.logError("You cannot have null values in the Metadata."); return; } workgroup = new Workgroup(workgroupName, connection); workgroup.addInvitationListener(new WorkgroupInvitationListener() { public void invitationReceived(WorkgroupInvitation workgroupInvitation) { String room = workgroupInvitation.getGroupChatName(); joinRoom(room); } }); if (workgroup != null) { try { workgroup.joinQueue(metaData, userid); } catch (XMPPException e) { WebLog.logError("Unable to join chat queue.", e); } } // If metadata about the users name is present, use it to set the name. if (metaData.containsKey("username")) { name = (String)metaData.get("username"); } if (name == null) { name = "Visitor"; } metadataMap = metaData; }
/** * Removes an invitation listener. * * @param invitationListener the invitation listener. */ public void removeInvitationListener(WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { invitationListeners.remove(invitationListener); } }
private void fireInvitationEvent(WorkgroupInvitation invitation) { for (WorkgroupInvitationListener listener : invitationListeners ){ listener.invitationReceived(invitation); } }
/** * Constructs a new agent session instance. Note, the {@link #setOnline(boolean)} * method must be called with an argument of <tt>true</tt> to mark the agent * as available to accept chat requests. * * @param connection a connection instance which must have already gone through * authentication. * @param workgroupJID the fully qualified JID of the workgroup. */ 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."); } this.workgroupJID = workgroupJID; this.connection = connection; this.transcriptManager = new TranscriptManager(connection); this.transcriptSearchManager = new TranscriptSearchManager(connection); this.maxChats = -1; this.metaData = new HashMap<String, String>(); this.queues = new HashMap<String, WorkgroupQueue>(); offerListeners = new ArrayList<OfferListener>(); invitationListeners = new ArrayList<WorkgroupInvitationListener>(); queueUsersListeners = new ArrayList<QueueUsersListener>(); // Create a filter to listen for packets we're interested in. OrFilter filter = new OrFilter(); filter.addFilter(new PacketTypeFilter(OfferRequestProvider.OfferRequestPacket.class)); filter.addFilter(new PacketTypeFilter(OfferRevokeProvider.OfferRevokePacket.class)); filter.addFilter(new PacketTypeFilter(Presence.class)); filter.addFilter(new PacketTypeFilter(Message.class)); packetListener = new PacketListener() { public void processPacket(Packet packet) { try { handlePacket(packet); } catch (Exception e) { e.printStackTrace(); } } }; connection.addPacketListener(packetListener, filter); // Create the agent associated to this session agent = new Agent(connection, workgroupJID); }
/** * Removes an invitation listener. * * @param invitationListener the invitation listener. */ public void removeQueueListener(WorkgroupInvitationListener invitationListener) { synchronized (invitationListeners) { invitationListeners.remove(invitationListener); } }
/** * Constructs a new agent session instance. Note, the {@link #setOnline(boolean)} * method must be called with an argument of <tt>true</tt> to mark the agent * as available to accept chat requests. * * @param connection a connection instance which must have already gone through * authentication. * @param workgroupJID the fully qualified JID of the workgroup. */ 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."); } this.workgroupJID = workgroupJID; this.connection = connection; this.transcriptManager = new TranscriptManager(connection); this.transcriptSearchManager = new TranscriptSearchManager(connection); this.maxChats = -1; this.metaData = new HashMap<String, List<String>>(); this.queues = new HashMap<String, WorkgroupQueue>(); offerListeners = new ArrayList<OfferListener>(); invitationListeners = new ArrayList<WorkgroupInvitationListener>(); queueUsersListeners = new ArrayList<QueueUsersListener>(); // Create a filter to listen for packets we're interested in. OrFilter filter = new OrFilter(); filter.addFilter(new PacketTypeFilter(OfferRequestProvider.OfferRequestPacket.class)); filter.addFilter(new PacketTypeFilter(OfferRevokeProvider.OfferRevokePacket.class)); filter.addFilter(new PacketTypeFilter(Presence.class)); filter.addFilter(new PacketTypeFilter(Message.class)); packetListener = new PacketListener() { public void processPacket(Packet packet) { try { handlePacket(packet); } catch (Exception e) { e.printStackTrace(); } } }; connection.addPacketListener(packetListener, filter); // Create the agent associated to this session agent = new Agent(connection, workgroupJID); }
/** * Constructs a new agent session instance. Note, the * {@link #setOnline(boolean)} method must be called with an argument of * <tt>true</tt> to mark the agent as available to accept chat requests. * * @param connection * a connection instance which must have already gone through * authentication. * @param workgroupJID * the fully qualified JID of the workgroup. */ 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."); } this.workgroupJID = workgroupJID; this.connection = connection; this.transcriptManager = new TranscriptManager(connection); this.transcriptSearchManager = new TranscriptSearchManager(connection); this.maxChats = -1; this.metaData = new HashMap<String, String>(); this.queues = new HashMap<String, WorkgroupQueue>(); offerListeners = new ArrayList<OfferListener>(); invitationListeners = new ArrayList<WorkgroupInvitationListener>(); queueUsersListeners = new ArrayList<QueueUsersListener>(); // Create a filter to listen for packets we're interested in. OrFilter filter = new OrFilter(); filter.addFilter(new PacketTypeFilter( OfferRequestProvider.OfferRequestPacket.class)); filter.addFilter(new PacketTypeFilter( OfferRevokeProvider.OfferRevokePacket.class)); filter.addFilter(new PacketTypeFilter(Presence.class)); filter.addFilter(new PacketTypeFilter(Message.class)); packetListener = new PacketListener() { public void processPacket(Packet packet) { try { handlePacket(packet); } catch (Exception e) { e.printStackTrace(); } } }; connection.addPacketListener(packetListener, filter); // Create the agent associated to this session agent = new Agent(connection, workgroupJID); }