Search in sources :

Example 1 with Transcripts

use of org.jivesoftware.smackx.workgroup.packet.Transcripts in project Smack by igniterealtime.

the class TranscriptManager method getTranscripts.

/**
     * 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.
     * @param workgroupJID the JID of the workgroup that will process the request.
     * @return the transcripts of a given user.
     * @throws XMPPErrorException 
     * @throws NoResponseException
     * @throws NotConnectedException 
     * @throws InterruptedException 
     */
public Transcripts getTranscripts(Jid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    Transcripts request = new Transcripts(userID);
    request.setTo(workgroupJID);
    Transcripts response = (Transcripts) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
    return response;
}
Also used : Transcripts(org.jivesoftware.smackx.workgroup.packet.Transcripts)

Example 2 with Transcripts

use of org.jivesoftware.smackx.workgroup.packet.Transcripts in project ecf by eclipse.

the class TranscriptManager method getTranscripts.

/**
 * 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.
 * @param workgroupJID the JID of the workgroup that will process the request.
 * @return the transcripts of a given user.
 * @throws XMPPException if an error occurs while getting the information.
 */
public Transcripts getTranscripts(String workgroupJID, String userID) throws XMPPException {
    Transcripts request = new Transcripts(userID);
    request.setTo(workgroupJID);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    // Send the request
    connection.sendPacket(request);
    Transcripts response = (Transcripts) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server on status set.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response;
}
Also used : PacketCollector(org.jivesoftware.smack.PacketCollector) XMPPException(org.jivesoftware.smack.XMPPException) PacketIDFilter(org.jivesoftware.smack.filter.PacketIDFilter) Transcripts(org.jivesoftware.smackx.workgroup.packet.Transcripts)

Example 3 with Transcripts

use of org.jivesoftware.smackx.workgroup.packet.Transcripts in project Smack by igniterealtime.

the class TranscriptManager method getTranscripts.

/**
 * 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.
 * @param workgroupJID the JID of the workgroup that will process the request.
 * @return the transcripts of a given user.
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public Transcripts getTranscripts(EntityBareJid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    Transcripts request = new Transcripts(userID);
    request.setTo(workgroupJID);
    Transcripts response = connection.sendIqRequestAndWaitForResponse(request);
    return response;
}
Also used : Transcripts(org.jivesoftware.smackx.workgroup.packet.Transcripts)

Example 4 with Transcripts

use of org.jivesoftware.smackx.workgroup.packet.Transcripts in project Spark by igniterealtime.

the class UserHistory method loadHistory.

public void loadHistory() {
    SwingWorker transcriptThread = new SwingWorker() {

        final List<TranscriptSummary> transcriptList = new ArrayList<>();

        public Object construct() {
            try {
                Transcripts transcripts = FastpathPlugin.getAgentSession().getTranscripts(userID);
                transcriptList.addAll(transcripts.getSummaries());
            } catch (XMPPException | SmackException | InterruptedException e) {
                Log.error("Error getting transcripts.", e);
            }
            transcriptList.sort(timeComparator);
            return transcriptList;
        }

        public void finished() {
            init(transcriptList);
        }
    };
    transcriptThread.start();
}
Also used : SmackException(org.jivesoftware.smack.SmackException) SwingWorker(org.jivesoftware.spark.util.SwingWorker) ArrayList(java.util.ArrayList) JList(javax.swing.JList) List(java.util.List) XMPPException(org.jivesoftware.smack.XMPPException) Transcripts(org.jivesoftware.smackx.workgroup.packet.Transcripts)

Aggregations

Transcripts (org.jivesoftware.smackx.workgroup.packet.Transcripts)4 XMPPException (org.jivesoftware.smack.XMPPException)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 JList (javax.swing.JList)1 PacketCollector (org.jivesoftware.smack.PacketCollector)1 SmackException (org.jivesoftware.smack.SmackException)1 PacketIDFilter (org.jivesoftware.smack.filter.PacketIDFilter)1 SwingWorker (org.jivesoftware.spark.util.SwingWorker)1