00001 /* 00002 * XetPan: a libEtPan! based Mail User Agent 00003 * Copyright (C) 2002 Melvin Hadasht 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef PROCESSING_H 00021 #define PROCESSING_H 00022 00023 #include <chash.h> 00024 00025 #include "cntree.h" 00026 00028 typedef struct XePProcessing_s XePProcessing; 00029 struct XePProcessing_s 00030 { 00031 chash *rules; 00032 chash *conditions; 00033 chash *actions; 00034 }; 00035 00040 typedef struct XePProcessingCondition_s XePProcessingCondition; 00041 struct XePProcessingCondition_s 00042 { 00043 char *id; 00044 char *expression; 00045 int enabled; 00046 }; 00047 00052 typedef struct XePProcessingAction_s XePProcessingAction; 00053 struct XePProcessingAction_s 00054 { 00055 char *id; 00056 char *command; 00057 int enabled; 00058 }; 00059 00064 typedef struct XePProcessingRule_s XePProcessingRule; 00065 struct XePProcessingRule_s 00066 { 00067 char *id; 00068 XePProcessingCondition *condition; 00069 XePProcessingAction *action; 00070 char *condition_ref; 00074 char *action_ref; 00078 int enabled; 00079 }; 00080 00081 /*< Used to reference a rule (real folder) or a condition (virtual folder) */ 00082 typedef struct XePProcessingRef_s XePProcessingRef; 00083 struct XePProcessingRef_s 00084 { 00085 char *ref; 00086 int enabled; 00087 int periodicity; 00088 }; 00089 00090 00091 XePProcessing * 00092 a_Processing_new(void); 00093 00094 XePProcessingCondition * 00095 a_Processing_condition_new(void); 00096 00097 XePProcessingAction * 00098 a_Processing_action_new(void); 00099 00100 XePProcessingRule * 00101 a_Processing_rule_new(void); 00102 00103 XePProcessingRef * 00104 a_Processing_ref_new(void); 00105 00106 XePProcessingRef * 00107 a_Processing_ref_new_copy(XePProcessingRef *ref); 00108 00110 void 00111 a_Processing_free(XePProcessing *processing); 00112 00114 void 00115 a_Processing_condition_free(XePProcessingCondition *condition); 00116 00118 void 00119 a_Processing_action_free(XePProcessingAction *action); 00120 00122 void 00123 a_Processing_rule_free(XePProcessingRule *action); 00124 00125 void 00126 a_Processing_ref_free(XePProcessingRef *ref); 00127 00128 clist * 00129 a_Processing_ref_list_new(void); 00130 00131 void 00132 a_Processing_ref_list_free(clist *refs); 00133 00134 int 00135 a_Processing_ref_list_copy(clist *source, clist *target); 00136 00138 int 00139 a_Processing_condition_add(XePProcessing *processing, 00140 XePProcessingCondition *condition); 00141 00143 int 00144 a_Processing_action_add(XePProcessing *processing, 00145 XePProcessingAction *action); 00147 int 00148 a_Processing_rule_add(XePProcessing *processing, 00149 XePProcessingRule *rule); 00150 00152 int 00153 a_Processing_create(cntree *ntree, XePProcessing **processing, int op); 00154 00155 int 00156 a_Processing_update_rules_links(XePProcessing *processing); 00157 00158 XePProcessingRule * 00159 a_Processing_rule_get_from_ref(chash *rules, char *ref); 00160 00161 XePProcessingCondition * 00162 a_Processing_condition_get_from_ref(chash *conditions, char *ref); 00163 00164 #endif