Package com.cubusmail.server.mail

Examples of com.cubusmail.server.mail.IMailFolder


  public GWTMailFolder moveFolder( String sourceFolderId, String targetFolderId ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "moving folder... " + sourceFolderId );

    IMailFolder sourceFolder = mailbox.getMailFolderById( sourceFolderId );
    try {
      IMailFolder folder = mailbox.moveFolder( sourceFolderId, targetFolderId );
      log.debug( "...successful" );

      return ConvertUtil.convert( folder, true );
    }
    catch (MailFolderException e) {
View Full Code Here


    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "renaming folder... " + folderId );

    try {
      IMailFolder folder = mailbox.renameFolder( folderId, newName );
      log.debug( "...successful" );

      return ConvertUtil.convert( folder, true );
    }
    catch (MailFolderException e) {
View Full Code Here

      IMailbox mailbox = SessionManager.get().getMailbox();
      UserAccount account = SessionManager.get().getUserAccount();
      log.debug( "retrieving messages from " + folderId + " ..." );

      try {
        IMailFolder currentFolder = mailbox.getMailFolderById( folderId );
        if ( currentFolder == null ) {
          mailbox.reloadFolder();
          currentFolder = mailbox.getMailFolderById( folderId );
        }
        mailbox.setCurrentFolder( currentFolder );

        Message[] msgs = currentFolder.retrieveMessages( sortField, ascending, searchFields, searchValues );

        if ( msgs != null && msgs.length > 0 ) {
          int total_count = msgs.length;
          start = Math.min( total_count - 1, start == -1 ? 0 : start );
          pageSize = pageSize == -1 ? account.getPreferences().getPageCount() : pageSize;
          pageSize = Math.min( pageSize, total_count - start );

          Message[] pagedMessages = new Message[pageSize];
          int pagedIndex = 0;
          for (int msgIndex = start; msgIndex < start + pageSize; msgIndex++) {
            pagedMessages[pagedIndex++] = msgs[msgIndex];
          }
          FetchProfile completeProfile = MessageUtils.createFetchProfile( true, null );
          currentFolder.fetch( pagedMessages, completeProfile );

          Preferences preferences = SessionManager.get().getPreferences();

          GWTMessageRecord[] messageStringArray = ConvertUtil.convertMessagesToStringArray(
              getApplicationContext(), preferences, (IMAPFolder) currentFolder.getFolder(), pageSize,
              pagedMessages );

          return new GWTMessageList( messageStringArray, msgs.length );
        }
View Full Code Here

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "retrieving message for " + messageId + " ..." );

    try {
      IMailFolder selectedFolder = mailbox.getCurrentFolder();
      Message msg = selectedFolder.getMessageById( messageId );

      MessageHandler handler = getMessageHandler( mailbox.getJavaMailSession(), (MimeMessage) msg );
      handler.readBodyContent( loadImages, MessageTextMode.DISPLAY );
      GWTMessage result = handler.getGWTMessage();
View Full Code Here

   * ()
   */
  public String getFormattedMessageCount( String folderId ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    IMailFolder folder = mailbox.getMailFolderById( folderId );
    if ( folder != null ) {
      int unread = folder.getUnreadMessageCount();

      if ( unread > 0 ) {
        return "<b>" + folder.getName() + " (" + unread + ")</b>";
      }
      else {
        return folder.getName();
      }
    }
    else {
      return null;
    }
View Full Code Here

    IMailbox mailbox = SessionManager.get().getMailbox();
    if ( messageIds != null && messageIds.length > 0 ) {
      log.debug( "marking " + messageIds.length + " messages..." );

      try {
        IMailFolder currentFolder = mailbox.getCurrentFolder();
        for (int i = 0; i < messageIds.length; i++) {
          Message msg = currentFolder.getMessageById( messageIds[i] );
          switch (flag) {
          case GWTMessageFlags.READ:
            MessageUtils.setMessageFlag( msg, Flags.Flag.SEEN, true );
            break;
          case GWTMessageFlags.UNREAD:
View Full Code Here

      log.debug( "sending message..." );
      MessageHandler messageHandler = SessionManager.get().getCurrentComposeMessage();
      messageHandler.setGWTMessage( message );
      messageHandler.send();
      IMailbox mailbox = SessionManager.get().getMailbox();
      IMailFolder sentFolder = mailbox.getSentFolder();
      messageHandler.saveToFolder( sentFolder, false );
      log.debug( "...successful" );

      try {
        this.userAccountDao.saveRecipients( SessionManager.get().getUserAccount(), messageHandler
View Full Code Here

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "preparing reply message..." );

    try {
      IMailFolder currentFolder = mailbox.getCurrentFolder();
      Message msg = currentFolder.getMessageById( messageId );

      MessageHandler replyMessageHandler = getMessageHandler( mailbox.getJavaMailSession() );
      replyMessageHandler.createReplyMessage( msg, replyAll );

      SessionManager.get().setCurrentComposeMessage( replyMessageHandler );
View Full Code Here

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "open message for " + messageId + " ..." );

    try {
      IMailFolder selectedFolder = mailbox.getCurrentFolder();
      Message msg = selectedFolder.getMessageById( messageId );

      MessageHandler readHandler = getMessageHandler( mailbox.getJavaMailSession(), (MimeMessage) msg );
      readHandler.readBodyContent( true, MessageTextMode.DRAFT );
      prepareNewMessage();
View Full Code Here

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "preparing forward message..." );

    try {
      IMailFolder currentFolder = mailbox.getCurrentFolder();
      Message msg = currentFolder.getMessageById( messageId );

      MessageHandler forwardMessageHandler = getMessageHandler( mailbox.getJavaMailSession() );
      forwardMessageHandler.createForwardMessage( msg );

      SessionManager.get().setCurrentComposeMessage( forwardMessageHandler );
View Full Code Here

TOP

Related Classes of com.cubusmail.server.mail.IMailFolder

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.