Examples of ChatSession


Examples of org.eclipse.ecf.protocol.msn.ChatSession

    sendChatMessage(toID, body);
  }

  public void sendChatMessage(ID toID, String body) throws ECFException {
    try {
      ChatSession cs = (ChatSession) chatSessions.get(toID);
      if (cs == null) {
        cs = client.createChatSession(toID.getName());
        cs.addChatSessionListener(new ChatSessionListener(toID));
        chatSessions.put(toID, cs);
      }
      cs.sendMessage(body);
    } catch (IOException e) {
      throw new ECFException(e);
    }
  }
View Full Code Here

Examples of org.eclipse.ecf.protocol.msn.ChatSession

  public void sendTypingMessage(ID toID, boolean isTyping, String body)
      throws ECFException {
    try {
      if (isTyping) {
        ChatSession cs = (ChatSession) chatSessions.get(toID);
        if (cs == null) {
          cs = client.createChatSession(toID.getName());
          cs.addChatSessionListener(new ChatSessionListener(toID));
          chatSessions.put(toID, cs);
        }
        cs.sendTypingNotification();
      }
    } catch (IOException e) {
      throw new ECFException(e);
    }
  }
View Full Code Here

Examples of org.jivesoftware.openfire.fastpath.history.ChatSession

        if (!ModelUtil.hasLength(property)) {
            Log.debug("Mail settings are not configured, transcripts will not be sent.");
            return;
        }

        final ChatSession chatSession = ChatTranscriptManager.getChatSession(sessionID);
        if (chatSession == null || chatSession.getFirstSession() == null) {
            return;
        }

        final StringBuilder builder = new StringBuilder();

        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyy hh:mm a");

        // Get duration of conversation
        Date date = new Date(chatSession.getFirstSession().getStartTime());
        int duration = getChatDuration(date, chatSession);

        TreeMap<String, List<String>> map = new TreeMap<String, List<String>>(chatSession.getMetadata());

        String body = JiveGlobals.getProperty("chat.transcript.body");

        if (ModelUtil.hasLength(body)) {
            builder.append(body).append("\n\n");
        }

        builder.append("formname=chat transcript\n");
        extractAndDisplay(builder, "question", map);
        display(builder, "fullname", chatSession.getCustomerName());
        extractAndDisplay(builder, "email", map);
        extractAndDisplay(builder, "Location", map);
        extractAndDisplay(builder, "userID", map);
        extractAndDisplay(builder, "username", map);
        extractAndDisplay(builder, "workgroup", map);
        display(builder, "chatduration", String.valueOf(duration));
        display(builder, "chatdate", formatter.format(date));
        if (chatSession.getFirstSession() != null && chatSession.getFirstSession().getAgentJID() != null) {
            try {
                display(builder, "agent", new JID(chatSession.getFirstSession().getAgentJID()).toBareJID());
            }
            catch (Exception e) {
                Log.debug("Could not display agent in transcript.", e);
            }
        }
        for (Iterator<Map.Entry<String, List<String>>> iterator = map.entrySet().iterator(); iterator.hasNext();) {
            Map.Entry<String, List<String>> entry = iterator.next();
            display(builder, entry.getKey(), getListItem(entry.getValue()));
        }
        builder.append("ctranscript=\n");
        builder.append(ChatTranscriptManager.getTextTranscriptFromSessionID(sessionID));

        String subject = JiveGlobals.getProperty("chat.transcript.subject");
        String from = JiveGlobals.getProperty("chat.transcript.from");
        String to = JiveGlobals.getProperty("chat.transcript.to");

        if (!ModelUtil.hasLength(subject) || !ModelUtil.hasLength(from)) {
            Log.debug("Transcript settings (chat.transcript.subject, chat.transcript.from) are not configured, " +
                    "transcripts will not be sent.");
            return;
        }

        if (ModelUtil.hasLength(to)) {
            emailService.sendMessage("Chat Transcript", to, "Chat Transcript", from, subject, builder.toString(), null);
            Log.debug("Transcript sent to " + to);
        }

        // NOTE: Do not sent to the customer. They will receive a prompt for a seperate chat transcript
        // that does not contain agent information.

        // Send to Agents
        UserManager um = UserManager.getInstance();
        for (Iterator<AgentChatSession> iterator = chatSession.getAgents(); iterator.hasNext();) {
            AgentChatSession agentSession = iterator.next();
            try {
                User user = um.getUser(new JID(agentSession.getAgentJID()).getNode());
                emailService.sendMessage("Chat Transcript", user.getEmail(), "Chat Transcript", from, subject, builder.toString(), null);
                Log.debug("Transcript sent to agent " + agentSession.getAgentJID());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.