/** * Rejects the offer. * @throws NotConnectedException * @throws InterruptedException */ public void reject() throws NotConnectedException, InterruptedException { RejectPacket rejectPacket = new RejectPacket(this.session.getWorkgroupJID()); connection.sendStanza(rejectPacket); // TODO: listen for a reply. rejected = true; }
/** * Sets the agent's current status with the workgroup. The presence mode affects * how offers are routed to the agent. The possible presence modes with their * meanings are as follows:<ul> * * <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats * (equivalent to Presence.Mode.CHAT). * <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed. * However, special case, or extreme urgency chats may still be offered to the agent. * <li>Presence.Mode.AWAY -- the agent is not available and should not * have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul> * * The max chats value is the maximum number of chats the agent is willing to have * routed to them at once. Some servers may be configured to only accept max chat * values in a certain range; for example, between two and five. In that case, the * maxChats value the agent sends may be adjusted by the server to a value within that * range. * * @param presenceMode the presence mode of the agent. * @param maxChats the maximum number of chats the agent is willing to accept. * @throws XMPPException if an error occurs setting the agent status. * @throws SmackException * @throws InterruptedException * @throws IllegalStateException if the agent is not online with the workgroup. */ public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException, SmackException, InterruptedException { setStatus(presenceMode, maxChats, null); }
/** * Get queue. * * @param queueName the name of the queue * @return an instance of WorkgroupQueue for the argument queue name, or null if none exists */ public WorkgroupQueue getQueue(String queueName) { Resourcepart queueNameResourcepart; try { queueNameResourcepart = Resourcepart.from(queueName); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } return getQueue(queueNameResourcepart); }
connection.sendPacket(reply); fireOfferRequestEvent((OfferRequestProvider.OfferRequestPacket)packet); queue.setOldestEntry(queueOverview.getOldestEntry()); fireQueueUsersEvent(queue, queueOverview.getStatus(), queueOverview.getAverageWaitTime(), queueOverview.getOldestEntry(), null); queue.setUsers(queueDetails.getUsers()); fireQueueUsersEvent(queue, null, -1, null, queueDetails.getUsers()); return; this.fireInvitationEvent(message.getFrom(), sessionID, message.getBody(), message.getFrom(), metaData); connection.sendPacket(reply); fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet);
queue.setOldestEntry(queueOverview.getOldestEntry()); fireQueueUsersEvent(queue, queueOverview.getStatus(), queueOverview.getAverageWaitTime(), queueOverview.getOldestEntry(), null); queue.setUsers(queueDetails.getUsers()); fireQueueUsersEvent(queue, null, -1, null, queueDetails.getUsers()); return; this.fireInvitationEvent(message.getFrom(), sessionID, message.getBody(), message.getFrom(), metaData);
connection.sendPacket(reply); fireOfferRequestEvent((OfferRequestProvider.OfferRequestPacket)packet); queue.setOldestEntry(queueOverview.getOldestEntry()); fireQueueUsersEvent(queue, queueOverview.getStatus(), queueOverview.getAverageWaitTime(), queueOverview.getOldestEntry(), null); queue.setUsers(queueDetails.getUsers()); fireQueueUsersEvent(queue, null, -1, null, queueDetails.getUsers()); return; this.fireInvitationEvent(message.getFrom(), sessionID, message.getBody(), message.getFrom(), metaData); connection.sendPacket(reply); fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet);
connection.sendPacket(reply); fireOfferRequestEvent((OfferRequestProvider.OfferRequestPacket)packet); queue.setOldestEntry(queueOverview.getOldestEntry()); fireQueueUsersEvent(queue, queueOverview.getStatus(), queueOverview.getAverageWaitTime(), queueOverview.getOldestEntry(), null); queue.setUsers(queueDetails.getUsers()); fireQueueUsersEvent(queue, null, -1, null, queueDetails.getUsers()); return; this.fireInvitationEvent(message.getFrom(), sessionID, message.getBody(), message.getFrom(), metaData); connection.sendPacket(reply); fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet);
/** * Accepts the offer. * @throws NotConnectedException * @throws InterruptedException */ public void accept() throws NotConnectedException, InterruptedException { Stanza acceptPacket = new AcceptPacket(this.session.getWorkgroupJID()); connection.sendStanza(acceptPacket); // TODO: listen for a reply. accepted = true; }
/** * Allows the removal of data from the agent's meta data, if the key represents existing data, * the revised meta data will be rebroadcast in an agent's presence broadcast. * * @param key the meta data key. * @throws XMPPException if an exception occurs. * @throws SmackException * @throws InterruptedException */ public void removeMetaData(String key) throws XMPPException, SmackException, InterruptedException { synchronized (this.metaData) { List<String> oldVal = metaData.remove(key); if (oldVal != null) { setStatus(presenceMode, maxChats); } } }
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) { Offer offer = new Offer(this.connection, this, requestPacket.getUserID(), requestPacket.getUserJID(), this.getWorkgroupJID(), new Date(new Date().getTime() + (requestPacket.getTimeout() * 1000)), requestPacket.getSessionID(), requestPacket.getMetaData(), requestPacket.getContent()); synchronized (offerListeners) { for (OfferListener listener : offerListeners) { listener.offerReceived(offer); } } }
/** * Allows the addition of a new key-value pair to the agent's meta data, if the value is * new data, the revised meta data will be rebroadcast in an agent's presence broadcast. * * @param key the meta data key * @param val the non-null meta data value * @throws XMPPException if an exception occurs. * @throws SmackException * @throws InterruptedException */ public void setMetaData(String key, String val) throws XMPPException, SmackException, InterruptedException { synchronized (this.metaData) { List<String> oldVals = metaData.get(key); if (oldVals == null || !oldVals.get(0).equals(val)) { oldVals.set(0, val); setStatus(presenceMode, maxChats); } } }
private void fireOfferRevokeEvent(OfferRevokeProvider.OfferRevokePacket orp) { RevokedOffer revokedOffer = new RevokedOffer(orp.getUserJID(), orp.getUserID(), this.getWorkgroupJID(), orp.getSessionID(), orp.getReason(), new Date()); synchronized (offerListeners) { for (OfferListener listener : offerListeners) { listener.offerRevoked(revokedOffer); } } }
/** * Sets the agent's current status with the workgroup. The presence mode affects * how offers are routed to the agent. The possible presence modes with their * meanings are as follows:<ul> * <p/> * <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats * (equivalent to Presence.Mode.CHAT). * <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed. * However, special case, or extreme urgency chats may still be offered to the agent. * <li>Presence.Mode.AWAY -- the agent is not available and should not * have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul> * <p/> * The max chats value is the maximum number of chats the agent is willing to have * routed to them at once. Some servers may be configured to only accept max chat * values in a certain range; for example, between two and five. In that case, the * maxChats value the agent sends may be adjusted by the server to a value within that * range. * * @param presenceMode the presence mode of the agent. * @param maxChats the maximum number of chats the agent is willing to accept. * @throws XMPPException if an error occurs setting the agent status. * @throws IllegalStateException if the agent is not online with the workgroup. */ public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException { setStatus(presenceMode, maxChats, null); }
presence.setTo(this.getWorkgroupJID());
/** * Sets the agent's current status with the workgroup. The presence mode affects * how offers are routed to the agent. The possible presence modes with their * meanings are as follows:<ul> * <p/> * <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats * (equivalent to Presence.Mode.CHAT). * <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed. * However, special case, or extreme urgency chats may still be offered to the agent. * <li>Presence.Mode.AWAY -- the agent is not available and should not * have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul> * <p/> * The max chats value is the maximum number of chats the agent is willing to have * routed to them at once. Some servers may be configured to only accept max chat * values in a certain range; for example, between two and five. In that case, the * maxChats value the agent sends may be adjusted by the server to a value within that * range. * * @param presenceMode the presence mode of the agent. * @param maxChats the maximum number of chats the agent is willing to accept. * @throws XMPPException if an error occurs setting the agent status. * @throws IllegalStateException if the agent is not online with the workgroup. */ public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException { setStatus(presenceMode, maxChats, null); }
presence.setTo(this.getWorkgroupJID());
/** * Sets the agent's current status with the workgroup. The presence mode affects * how offers are routed to the agent. The possible presence modes with their * meanings are as follows:<ul> * <p/> * <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats * (equivalent to Presence.Mode.CHAT). * <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed. * However, special case, or extreme urgency chats may still be offered to the agent. * <li>Presence.Mode.AWAY -- the agent is not available and should not * have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul> * <p/> * The max chats value is the maximum number of chats the agent is willing to have * routed to them at once. Some servers may be configured to only accept max chat * values in a certain range; for example, between two and five. In that case, the * maxChats value the agent sends may be adjusted by the server to a value within that * range. * * @param presenceMode the presence mode of the agent. * @param maxChats the maximum number of chats the agent is willing to accept. * @throws XMPPException if an error occurs setting the agent status. * @throws IllegalStateException if the agent is not online with the workgroup. */ public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException { setStatus(presenceMode, maxChats, null); }
/** * Accepts the offer. */ public void accept() { Packet acceptPacket = new AcceptPacket(this.session.getWorkgroupJID()); connection.sendPacket(acceptPacket); // TODO: listen for a reply. accepted = true; }
/** * Allows the removal of data from the agent's meta data, if the key represents existing data, * the revised meta data will be rebroadcast in an agent's presence broadcast. * * @param key the meta data key. * @throws XMPPException if an exception occurs. */ public void removeMetaData(String key) throws XMPPException { synchronized (this.metaData) { String oldVal = (String)metaData.remove(key); if (oldVal != null) { setStatus(presenceMode, maxChats); } } }
/** * Accepts the offer. */ public void accept() { Packet acceptPacket = new AcceptPacket(this.session.getWorkgroupJID()); connection.sendPacket(acceptPacket); // TODO: listen for a reply. accepted = true; }