Package net.suberic.pooka

Examples of net.suberic.pooka.MessageInfo


  /**
   * Attempts to check the signature on the given message.
   */
  public void checkSignature() {
  final boolean forSignature = true;
    MessageInfo info = getMessageInfo();
    if (info != null) {
      MessageCryptoInfo cInfo = info.getCryptoInfo();
      try {
        if (cInfo != null && cInfo.isSigned()) {
          CryptoStatusDisplay csd = null;

          String fromString = "";
View Full Code Here


  /**
   * Imports the keys on this message.
   */
  public void importKeys() {
    MessageInfo info = getMessageInfo();
    if (info != null) {
      MessageCryptoInfo cInfo = info.getCryptoInfo();
      if (cInfo != null) {
        try {
          java.security.Key[] newKeys = cInfo.extractKeys();
          if (newKeys != null && newKeys.length > 0) {
            // check to see if these match our current keys.
View Full Code Here

        getMessageUI().setBusy(true);
      FolderDisplayUI fw = getFolderDisplayUI();
      if (fw != null)
        fw.setBusy(true);;

      MessageInfo info = getMessageInfo();
      if (info != null) {
        info.runSpamAction();
      }

      if (fw != null)
        fw.setBusy(false);
      if (getMessageUI() != null)
View Full Code Here

  /**
   * Runs server filters on this Message.
   */
  public void runBackendFilters() {
    MessageInfo info = getMessageInfo();
    if (info != null)
      info.runBackendFilters();
  }
View Full Code Here

  /**
   * Attempts to decrypt the given message.
   */
  public void decryptMessage() {
    boolean forSiganture = false;
    MessageInfo info = getMessageInfo();
    if (info != null) {
      try {
        if (info.hasEncryption()) {

          MessageCryptoInfo cInfo = info.getCryptoInfo();

          if (cInfo != null && cInfo.isEncrypted()) {

            java.security.Key key = getDefaultProfile().getEncryptionKey(
                cInfo.getEncryptionType(), forSiganture);
View Full Code Here

    // display changing on the awt event thread.  seem simple enough?

    // assume that we're actually on the FolderThread for now.

    if (getMessageProxy() != null) {
      MessageInfo msgInfo = getMessageProxy().getMessageInfo();

      StringBuffer messageText = new StringBuffer();

      String content = null;

      String contentType = "text/plain";

      boolean displayHtml = false;

      int msgDisplayMode = getMessageProxy().getDisplayMode();

      // figure out html vs. text
      if (Pooka.getProperty("Pooka.displayHtml", "").equalsIgnoreCase("true")) {
        if (msgInfo.isHtml()) {
          if (msgDisplayMode > MessageProxy.TEXT_ONLY)
            displayHtml = true;

        } else if (msgInfo.containsHtml()) {
          if (msgDisplayMode >= MessageProxy.HTML_PREFERRED)
            displayHtml = true;

        } else {
          // if we don't have any html, just display as text.
        }
      }

      //Original was true, changed to false by Liao
      boolean includeHeaders = false;
      boolean showFullheaders = showFullHeaders();

      // Get the header Information
      String header;
      if(showFullheaders){
        header = getFullHeaderInfo(msgInfo);
      } else {
        String list = Pooka.getProperty("MessageWindow.Header.DefaultHeaders", "From:To:CC:Date:Subject");
        header = getHeaderInfo(msgInfo, list);
      }
      headerPane.setText(header);

      headerPane.repaint();

      // set the content
      if (msgDisplayMode == MessageProxy.RFC_822) {
        content = msgInfo.getRawText();
      } else {
        if (displayHtml) {
          contentType = "text/html";

          if (Pooka.getProperty("Pooka.displayTextAttachments", "").equalsIgnoreCase("true")) {
            content = msgInfo.getHtmlAndTextInlines(includeHeaders, showFullheaders);
          } else {
            content = msgInfo.getHtmlPart(includeHeaders, showFullheaders);
          }

        } else {
          if (Pooka.getProperty("Pooka.displayTextAttachments", "").equalsIgnoreCase("true")) {
            // Is there only an HTML part?  Regardless, we've determined that
            // we will still display it as text.
            if (getMessageProxy().getMessageInfo().isHtml())
              content = msgInfo.getHtmlAndTextInlines(includeHeaders, showFullheaders);
            else
              content = msgInfo.getTextAndTextInlines(includeHeaders, showFullheaders);
          }
          else {
            // Is there only an HTML part?  Regardless, we've determined that
            // we will still display it as text.
            if (getMessageProxy().getMessageInfo().isHtml())
              content = msgInfo.getHtmlPart(includeHeaders, showFullheaders);
            else
              content = msgInfo.getTextPart(includeHeaders, showFullheaders);
          }
        }
      }

      if (content != null)
View Full Code Here

      saveFlags(uid, uidValidity, f);
      final long fUid = uid;
      getFolderInfo().getFolderThread().addToQueue(new net.suberic.util.thread.ActionWrapper(new javax.swing.AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
            if (getFolderInfo() != null) {
              MessageInfo mInfo = getFolderInfo().getMessageInfoByUid(fUid);
              if (mInfo != null) {
                getFolderInfo().messageChanged(new MessageChangedEvent(SimpleFileCache.this, MessageChangedEvent.FLAGS_CHANGED, mInfo.getMessage()));
              }
            }
          }
        }, getFolderInfo().getFolderThread()), new java.awt.event.ActionEvent(SimpleFileCache.this, 1, "message-changed"));
View Full Code Here

  public MessageInfo[] search(javax.mail.search.SearchTerm term) throws
    javax.mail.MessagingException {
    Vector matches = new Vector();

    for (int i = 0; i < cachedMessages.size(); i++) {
      MessageInfo info = getFolderInfo().getMessageInfoByUid(((Long)cachedMessages.elementAt(i)).longValue());
      Message m = info.getMessage();
      if (term.match(m))
        matches.add(info);
    }

    MessageInfo[] returnValue = new MessageInfo[matches.size()];
View Full Code Here

    StringBuffer infoLines = new StringBuffer();
    try {
      FolderInfo folder = Pooka.getStoreManager().getFolderById(pFolderId);
      if (folder != null) {
        for (int i = 0; i < e.getMessages().length; i++) {
          MessageInfo current = folder.getMessageInfo(e.getMessages()[i]);
          newMessageList.add(current);
          if (i < 3)
            infoLines.append("From: " + current.getMessageProperty("From") + ", Subj: " + current.getMessageProperty("Subject") + "\r\n\r\n");
          else if (i == 3)
            infoLines.append("...");
        }
      }
    } catch (javax.mail.MessagingException me) {
View Full Code Here

        textBuffer.append("<ul>");
        Iterator<MessageInfo> messageIter = mNewMessageMap.get(folderId).iterator();
        int counter = 0;
        while (messageIter.hasNext()) {
          try {
            MessageInfo messageInfo = messageIter.next();
            String messageUri = "mailopen://" + folderId + "/" + counter++;
            textBuffer.append("<li><a href = \"" + messageUri + "\">");
            messageMap.put(messageUri, messageInfo);
            textBuffer.append("From: " + messageInfo.getMessageProperty("From") + ", Subj: " + messageInfo.getMessageProperty("Subject"));
            textBuffer.append("</a></li>");
          } catch (Exception e) {
            textBuffer.append("<li>Error:  " + e.getMessage() + "</li>");
          }
        }
        textBuffer.append("</ul>");
        textBuffer.append("</li>");
      }

      textBuffer.append("</ul>");
    } else {
      textBuffer.append("No new messages.");
    }
    textBuffer.append("</body></html>");

    final HashMap<String, MessageInfo> fMessageMap = messageMap;

    //JTextArea pookaMessage = new JTextArea(createStatusMessage());
    JTextPane pookaMessage = new JTextPane();
    pookaMessage.setContentType("text/html");
    pookaMessage.setText(textBuffer.toString());

    messageBox.add(pookaMessage);

    final JDialog dialog = new JDialog();
    pookaMessage.setEditable(false);
    //dialog.add(pookaMessage);
    dialog.add(messageBox);
    dialog.setUndecorated(true);
    dialog.pack();
    /*
    pookaMessage.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
          dialog.setVisible(false);
          dialog.dispose();
          messageDisplaying = false;
        }
      });
    */
    closeButton.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
          dialog.setVisible(false);
          dialog.dispose();
          messageDisplaying = false;
        }
      });

    pookaMessage.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
          if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            //System.err.println("hyperlinkEvent:  " + e);
            java.net.URL url = e.getURL();
            //System.err.println("url = " + url);
            //System.err.println("description = " + e.getDescription());
            if (e.getDescription().startsWith("close")) {
              dialog.setVisible(false);
              dialog.dispose();
              messageDisplaying = false;
            } else if (e.getDescription().startsWith("mailopen://")) {
              MessageInfo openMessage = fMessageMap.get(e.getDescription());
              try {
                MessageProxy proxy = openMessage.getMessageProxy();
                MessageUI mui = Pooka.getUIFactory().createMessageUI(proxy, new NewMessageFrame(new NewMessageProxy(new net.suberic.pooka.NewMessageInfo(new javax.mail.internet.MimeMessage(Pooka.getDefaultSession())))));
                mui.openMessageUI();
                // and if that works, remove it from the new message map.
                removeFromNewMessages(openMessage);
              } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of net.suberic.pooka.MessageInfo

Copyright © 2018 www.massapicom. 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.