Package com.cubusmail.server.mail

Examples of com.cubusmail.server.mail.IMailbox


      IOException {

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

        ContentType contentType = new ContentType( "text/plain" );
        response.setContentType( contentType.getBaseType() );
        response.setHeader( "expires", "0" );
        String charset = null;
View Full Code Here


   * com.cubusmail.gwtui.client.services.IUserAccountService#retrieveUserAccount
   * ()
   */
  public UserAccount retrieveUserAccount() {

    IMailbox mailbox = SessionManager.get().getMailbox();

    return this.userAccountDao.getUserAccountByUsername( mailbox.getUserName() );
  }
View Full Code Here

  public void sessionDestroyed( HttpSessionEvent event ) {

    try {
      log.debug( "Session expired. Execute logout." );
      if ( SessionManager.get( event.getSession() ) != null ) {
        IMailbox mailbox = SessionManager.get( event.getSession() ).getMailbox();
        if ( mailbox != null && mailbox.isLoggedIn() ) {
          mailbox.logout();
        }
      }
    }
    catch (Throwable ex) {
      // nothing to do
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

   * 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, MessageListFields sortField,
      boolean ascending, MessageListFields[] searchFields, String[] searchValues ) 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 );
        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;
View Full Code Here

   * @see
   * com.cubusmail.gwtui.client.services.IMailboxService#retrieveMessage(int)
   */
  public GWTMessage retrieveMessage( String folderId, long messageId, boolean loadImages ) throws Exception {

    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();

      return result;
    }
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#getFormattedMessageCount
   * ()
   */
  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>";
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#markMessage(long[],
   * com.cubusmail.gwtui.domain.MessageListFields, boolean)
   */
  public void markMessage( long[] messageIds, int flag ) throws Exception {

    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 );
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#copyMoveMessages(
   * long[], java.lang.String, boolean)
   */
  public void copyMoveMessages( long[] messageIds, String targetFolderId, boolean toMove ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();

    if ( messageIds != null && messageIds.length > 0 ) {
      log.debug( "copy/move " + messageIds.length + " messages..." );

      try {
        mailbox.copyMessages( messageIds, targetFolderId );
        log.debug( "...successful" );

        if ( toMove ) {
          mailbox.deleteMessages( messageIds );
        }
      }
      catch (MessagingException e) {
        log.error( e.getMessage(), e );
        throw new GWTMessageException( e.getMessage() );
View Full Code Here

TOP

Related Classes of com.cubusmail.server.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.