1 /* 2 ** Filter.h 3 ** 4 ** Copyright (c) 2001-2006 Ludovic Marcotte 5 ** 6 ** Author: Ludovic Marcotte <ludovic@Sophos.ca> 7 ** 8 ** This program is free software; you can redistribute it and/or modify 9 ** it under the terms of the GNU General Public License as published by 10 ** the Free Software Foundation; either version 2 of the License, or 11 ** (at your option) any later version. 12 ** 13 ** This program is distributed in the hope that it will be useful, 14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 ** GNU General Public License for more details. 17 ** 18 ** You should have received a copy of the GNU General Public License 19 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #ifndef _GNUMail_H_Filter 23 #define _GNUMail_H_Filter 24 25 #import <AppKit/AppKit.h> 26 27 // criteria source 28 #define NONE 0 29 #define TO 1 30 #define CC 2 31 #define TO_OR_CC 3 32 #define SUBJECT 4 33 #define FROM 5 34 #define EXPERT 6 35 36 // External program operation 37 #define AFTER_CRITERIA 1 38 #define BEFORE_CRITERIA 2 39 40 // Criteria condition 41 #define AND 1 42 #define OR 2 43 44 // Criteria find operations 45 #define CONTAINS 1 46 #define IS_EQUAL 2 47 #define HAS_PREFIX 3 48 #define HAS_SUFFIX 4 49 #define MATCH_REGEXP 5 50 #define IS_IN_ADDRESS_BOOK 6 51 #define IS_IN_ADDRESS_BOOK_GROUP 7 52 53 // Actions 54 #define SET_COLOR 1 55 #define TRANSFER_TO_FOLDER 2 56 #define BOUNCE_OR_FORWARD_OR_REPLY 3 57 #define DELETE 4 58 #define PLAY_SOUND 5 59 60 // E-Mail operations 61 #define BOUNCE 1 62 #define FORWARD 2 63 #define REPLY 3 64 65 // Filter type 66 #define TYPE_INCOMING 1 67 #define TYPE_OUTGOING 2 68 #define TYPE_INCOMING_QUICK 3 /* For matchedFilterForMessage:type: only */ 69 70 71 @interface Filter: NSObject <NSCoding, NSCopying> 72 { 73 @private 74 BOOL _isActive; 75 NSString *_description; 76 77 int _type; 78 79 BOOL _useExternalProgram; 80 NSString *_externalProgramName; 81 int _externalProgramOperation; 82 83 NSMutableArray *_allCriterias; 84 85 int _action; 86 NSColor *_actionColor; 87 NSString *_actionFolderName; 88 int _actionEMailOperation; 89 NSString *_actionEMailString; 90 NSString *_actionMessageString; 91 92 NSString *_pathToSound; 93 } 94 95 // 96 // access/mutation methods 97 // 98 - (BOOL) isActive; 99 - (void) setIsActive: (BOOL) theBOOL; 100 101 - (NSString *) description; 102 - (void) setDescription: (NSString *) theDescription; 103 104 - (int) type; 105 - (void) setType: (int) theType; 106 107 - (BOOL) useExternalProgram; 108 - (void) setUseExternalProgram: (BOOL) theBOOL; 109 110 - (NSString *) externalProgramName; 111 - (void) setExternalProgramName: (NSString *) theExternalProgramName; 112 113 - (int) externalProgramOperation; 114 - (void) setExternalProgramOperation: (int) theExternalProgramOperation; 115 116 - (NSArray *) allCriterias; 117 - (void) setCriterias: (NSArray *) theCriterias; 118 119 - (int) action; 120 - (void) setAction: (int) theAction; 121 122 - (NSColor *) actionColor; 123 - (void) setActionColor: (NSColor *) theActionColor; 124 125 - (NSString *) actionFolderName; 126 - (void) setActionFolderName: (NSString *) theActionFolderName; 127 128 - (int) actionEMailOperation; 129 - (void) setActionEMailOperation: (int) theActionEMailOperation; 130 131 - (NSString *) actionEMailString; 132 - (void) setActionEMailString: (NSString *) theActionEMailString; 133 134 - (NSString *) actionMessageString; 135 - (void) setActionMessageString: (NSString *) theActionMessageString; 136 137 - (NSString *) pathToSound; 138 - (void) setPathToSound: (NSString *) thePath; 139 140 @end 141 142 143 // 144 // 145 // 146 @interface FilterCriteria : NSObject <NSCoding, NSCopying> 147 { 148 @private 149 NSArray *_criteriaHeaders; 150 NSString *_criteriaString; 151 152 int _criteriaFindOperation; 153 int _criteriaCondition; 154 int _criteriaSource; 155 } 156 157 // 158 // access / mutation methods 159 // 160 - (int) criteriaCondition; 161 - (void) setCriteriaCondition: (int) theCriteriaCondition; 162 163 - (int) criteriaSource; 164 - (void) setCriteriaSource: (int) theCriteriaSource; 165 166 - (NSArray *) criteriaHeaders; 167 - (void) setCriteriaHeaders: (NSArray *) theCriteriaHeaders; 168 169 - (int) criteriaFindOperation; 170 - (void) setCriteriaFindOperation: (int) theCriteriaFindOperation; 171 172 - (NSString *) criteriaString; 173 - (void) setCriteriaString: (NSString *) theCriteriaString; 174 175 @end 176 177 #endif // _GNUMail_H_Filter 178