}
public boolean searchUnreadEmails(boolean current){
if(current){
try {
messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
} catch (MessagingException e) {
System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
e.printStackTrace();
return false;
}
return true;
}
try {
messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false));
} catch (MessagingException e) {
System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
e.printStackTrace();
return false;
}