001 /* 002 * Copyright 2010 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package com.hs.mail.imap.message.response; 017 018 import java.util.ArrayList; 019 import java.util.List; 020 021 import javax.mail.Flags; 022 023 /** 024 * 025 * @author Won Chul Doh 026 * @since Aug 1, 2010 027 * 028 */ 029 public class UnsolicitedResponse implements ImapResponse { 030 031 private boolean sizeChanged = false; 032 private int messageCount = 0; 033 private int recentMessageCount = 0; 034 private List<Integer> expungedMsns = null; 035 private List<StoreResponse> flagsResponses = null; 036 037 public UnsolicitedResponse(boolean sizeChanged) { 038 super(); 039 this.sizeChanged = sizeChanged; 040 this.expungedMsns = new ArrayList<Integer>(); 041 this.flagsResponses = new ArrayList<StoreResponse>(); 042 } 043 044 public boolean isSizeChanged() { 045 return sizeChanged; 046 } 047 048 /** 049 * Gets the number of messages that this mailbox contains. 050 * 051 * @return number of messages contained 052 */ 053 public int getMessageCount() { 054 return messageCount; 055 } 056 057 public void setMessageCount(int count) { 058 this.messageCount = count; 059 } 060 061 /** 062 * Gets the number of recent messages. 063 * 064 * @return number of recent messages 065 */ 066 public int getRecentMessageCount() { 067 return recentMessageCount; 068 } 069 070 public void setRecentMessageCount(int count) { 071 this.recentMessageCount = count; 072 } 073 074 public List<Integer> getExpungedMsns() { 075 return expungedMsns; 076 } 077 078 public List<StoreResponse> getFlagsResponses() { 079 return flagsResponses; 080 } 081 082 public void addExpungedMsn(int msgnum) { 083 expungedMsns.add(msgnum); 084 } 085 086 public void addFlagsResponse(int msgnum, Flags flags) { 087 flagsResponses.add(new StoreResponse((long) msgnum, flags)); 088 } 089 090 }