/** * Returns the full conversation transcript of a given session. * * @param sessionID the id of the session to get the full transcript. * @return the full conversation transcript of a given session. * @throws XMPPException if an error occurs while getting the information. * @throws SmackException * @throws InterruptedException */ public Transcript getTranscript(String sessionID) throws XMPPException, SmackException, InterruptedException { return transcriptManager.getTranscript(workgroupJID, sessionID); }
private void fireQueueUsersEvent(WorkgroupQueue queue, WorkgroupQueue.Status status, int averageWaitTime, Date oldestEntry, Set<QueueUser> users) { synchronized (queueUsersListeners) { for (QueueUsersListener listener : queueUsersListeners) { if (status != null) { listener.statusUpdated(queue, status); } if (averageWaitTime != -1) { listener.averageWaitTimeUpdated(queue, averageWaitTime); } if (oldestEntry != null) { listener.oldestEntryUpdated(queue, oldestEntry); } if (users != null) { listener.usersUpdated(queue, users); } } } }
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); } } }
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); } } }
Offers offers = new Offers(); Offer offer = new Offer(); offer.setPrice(price); offer.setDateOfOffer(date); offer.setDuration(duration); offer.setHotelOnly(hotelOnly); offers.add(offer);
/** * 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; }
/** * 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; }
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.attribute("id", Offer.this.getSessionID()); xml.setEmptyElement(); return xml; } }
/** * 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); }
/** * Returns the transcripts of a given user. The answer will contain the complete history of * conversations that a user had. * * @param userID the id of the user to get his conversations. * @return the transcripts of a given user. * @throws XMPPException if an error occurs while getting the information. * @throws SmackException * @throws InterruptedException */ public Transcripts getTranscripts(Jid userID) throws XMPPException, SmackException, InterruptedException { return transcriptManager.getTranscripts(workgroupJID, userID); }
public void notifyService(XMPPConnection con, Jid workgroup, String createdRoomName) throws NotConnectedException, InterruptedException { NotifyServicePacket packet = new NotifyServicePacket(workgroup, createdRoomName); con.sendStanza(packet); }
/** * Returns the Form to use for searching transcripts. It is unlikely that the server * will change the form (without a restart) so it is safe to keep the returned form * for future submissions. * * @return the Form to use for searching transcripts. * @throws XMPPException if an error occurs while sending the request to the server. * @throws SmackException * @throws InterruptedException */ public Form getTranscriptSearchForm() throws XMPPException, SmackException, InterruptedException { return transcriptSearchManager.getSearchForm(workgroupJID.asDomainBareJid()); }
/** * Submits the completed form and returns the result of the transcript search. The result * will include all the data returned from the server so be careful with the amount of * data that the search may return. * * @param completedForm the filled out search form. * @return the result of the transcript search. * @throws SmackException * @throws XMPPException * @throws InterruptedException */ public ReportedData searchTranscripts(Form completedForm) throws XMPPException, SmackException, InterruptedException { return transcriptSearchManager.submitSearch(workgroupJID.asDomainBareJid(), completedForm); }
/** * Returns the key to use in the presenceMap for a fully qualified xmpp ID. The roster * can contain any valid address format such us "domain/resource", "user@domain" or * "user@domain/resource". If the roster contains an entry associated with the fully qualified * xmpp ID then use the fully qualified xmpp ID as the key in presenceMap, otherwise use the * bare address. Note: When the key in presenceMap is a fully qualified xmpp ID, the * userPresences is useless since it will always contain one entry for the user. * * @param user the fully qualified xmpp ID, e.g. jdoe@example.com/Work. * @return the key to use in the presenceMap for the fully qualified xmpp ID. */ private Jid getPresenceMapKey(Jid user) { Jid key = user; if (!contains(user)) { key = user.asEntityBareJidIfPossible(); } return key; }
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.attribute("id", Offer.this.getSessionID()); xml.setEmptyElement(); return xml; } }
/** * 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); } } }