1 package net.suberic.pooka.filter; 2 import net.suberic.pooka.gui.MessageProxy; 3 import net.suberic.pooka.FolderInfo; 4 import net.suberic.pooka.Pooka; 5 import java.util.List ; 6 import java.util.LinkedList ; 7 import javax.mail.*; 8 9 12 public class FlagFilterAction implements FilterAction { 13 14 private String folderName = null; 15 private Flags flagToSet; 16 private boolean flagValue; 17 18 public FlagFilterAction() { 19 } 20 21 31 public List performFilter(List filteredMessages) { 32 for (int i = 0; i < filteredMessages.size(); i++) { 33 try { 34 MessageProxy current = (MessageProxy) filteredMessages.get(i); 35 current.getMessageInfo().getRealMessage().setFlags(flagToSet, flagValue); 36 } catch (MessagingException me) { 37 } 38 39 } 40 41 return new LinkedList (); 42 } 43 44 51 52 public void initializeFilter(String sourceProperty) { 53 String flagName = Pooka.getProperty(sourceProperty + ".flag", ""); 54 flagToSet = Pooka.getSearchManager().getFlags(flagName); 55 String value = Pooka.getProperty(sourceProperty + ".value", "true"); 56 if (value.equalsIgnoreCase("true")) 57 flagValue = true; 58 else 59 flagValue = false; 60 } 61 62 } 63 | Popular Tags |