Package com.cubusmail.mail

Examples of com.cubusmail.mail.IMailbox


  public void saveMessageAsDraft( GWTMessage message ) throws Exception {

    try {
      log.debug( "saving message to draft..." );
      MessageHandler messageHandler = SessionManager.get().getCurrentComposeMessage();
      IMailbox mailbox = SessionManager.get().getMailbox();
      IMailFolder draftFolder = mailbox.getDraftFolder();
      messageHandler.setGWTMessage( message );
      messageHandler.saveToFolder( draftFolder, true );

      // if there is the original message to delete
      if ( message.getId() > 0 ) {
View Full Code Here


      String messageId = request.getParameter( "messageId" );
      String attachmentIndex = request.getParameter( "attachmentIndex" );
      boolean isThumbnail = Boolean.valueOf( request.getParameter( "thumbnail" ) ).booleanValue();

      if ( messageId != null ) {
        IMailbox mailbox = SessionManager.get().getMailbox();
        Message msg = mailbox.getCurrentFolder().getMessageById( Long.parseLong( messageId ) );

        if ( isThumbnail ) {
          List<MimePart> attachmentList = MessageUtils.attachmentsFromPart( msg );
          int index = Integer.valueOf( attachmentIndex );
View Full Code Here

      ((PasswordCallback) callbacks[1]).clearPassword();

      // start authentication
      // IMailbox mailbox = IMailbox.Factory.getInstance(
      // IMailbox.TYPE_IMAP, username, new String( password ) );
      IMailbox mailbox = MailboxFactory.get().createMailbox( IMailbox.TYPE_IMAP );
      mailbox.init( username, new String( password ) );

      log.debug( "Start login..." );
      mailbox.login();
      log.debug( "Login successful" );

      this.mailboxPrincipal = new MailboxPrincipal( username, mailbox );
      this.succeeded = true;
    }
View Full Code Here

   */
  public GWTMailFolder[] retrieveFolderTree() throws Exception {

    long millis = System.currentTimeMillis();

    IMailbox mailbox = SessionManager.get().getMailbox();
    try {
      mailbox.reloadFolder();
    }
    catch (MessagingException e) {
      log.error( e.getMessage(), e );
      throw new GWTMessageException( e.getMessage() );
    }
    GWTMailFolder[] result = ConvertUtil.convert( mailbox.getMailFolderList() );

    log.debug( "Time for retrieveFolderTree(): " + (System.currentTimeMillis() - millis) + "ms" );

    return result;
  }
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#createFolder(java
   * .lang.String, java.lang.String)
   */
  public GWTMailFolder createFolder( String parentFolderId, String folderName ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "creating folder... " + folderName );

    IMailFolder newFolder;
    try {
      newFolder = mailbox.createFolder( parentFolderId, folderName );
      log.debug( "...successful" );

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

   * com.cubusmail.gwtui.client.services.IMailboxService#moveFolder(java.lang
   * .String, java.lang.String)
   */
  public void moveFolder( String sourceFolderId, String targetFolderId ) throws Exception {

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

    IMailFolder sourceFolder = mailbox.getMailFolderById( sourceFolderId );
    try {

      mailbox.moveFolder( sourceFolderId, targetFolderId );
      log.debug( "...successful" );
    }
    catch (MailFolderException e) {
      log.error( e.getMessage(), e );
      if ( e.hasErrorCode( IErrorCodes.EXCEPTION_FOLDER_ALREADY_EXIST ) ) {
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#renameFoler(java.
   * lang.String, java.lang.String)
   */
  public String renameFolder( String folderId, String newName ) throws Exception {

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

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

      return newName;
    }
    catch (MailFolderException e) {
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#deleteFolder(java
   * .lang.String)
   */
  public void deleteFolder( String folderId ) throws Exception {

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

    try {
      mailbox.deleteFolder( folderId );
      log.debug( "...successful" );
    }
    catch (MailFolderException e) {
      log.error( e.getMessage(), e );
      throw new GWTMailFolderException( null, e.getFolder().getName() );
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#emptyFolder(java.
   * lang.String)
   */
  public void emptyFolder( String folderId ) throws Exception {

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

    try {
      mailbox.emptyFolder( folderId );
      log.debug( "...successful" );
    }
    catch (MailFolderException e) {
      log.error( e.getMessage(), e );
      throw new GWTMailFolderException( null, e.getFolder().getName() );
View Full Code Here

   */
  public GWTMessageList retrieveMessages( String folderId, int start, int pageSize, String sortField, String dir,
      String[][] params ) throws Exception {

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

      try {
        IMailFolder currentFolder = mailbox.getMailFolderById( folderId );
        mailbox.setCurrentFolder( currentFolder );

        Message[] msgs = currentFolder.retrieveMessages( sortField );

        String quickSearchFields = MessageUtils.getParamValue( params, "fields" );
        String extendedSearchFields = MessageUtils.getParamValue( params,
View Full Code Here

TOP

Related Classes of com.cubusmail.mail.IMailbox

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.