1 /* 2 * RNtrack - FTN message tracker/router 3 * 4 * scandir.hpp - ScanDir class 5 * 6 * Copyright (c) 2003-2005 Alex Soukhotine, 2:5030/1157 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 * $Id: scandir.hpp 131 2011-03-20 16:48:35Z dukelsky $ 14 */ 15 16 #ifndef _SCANDIR_HPP_ 17 #define _SCANDIR_HPP_ 18 19 #include "a_list.hpp" 20 #include "utils.hpp" 21 #include "fidoaddr.hpp" 22 #include "msg.hpp" 23 #include "msgbase.hpp" 24 #include "outbound.hpp" 25 #include "mytypes.hpp" 26 #include "parsetpl.hpp" 27 #include "tmstamp.hpp" 28 #include "mask.hpp" 29 #include "filebox.hpp" 30 31 typedef enum 32 { 33 ACT_ERROR, ACT_MOVE, ACT_COPY, ACT_DELETE, ACT_REWRITE, ACT_NEWMSG, 34 ACT_IGNORE, ACT_DISPLAY, ACT_ROUTE, ACT_FLAG, ACT_WRITEFILE, ACT_CALL, 35 ACT_DELETEATTACH, ACT_CHANGEPATH, ACT_MOVEATTACH, ACT_SPLIT, ACT_ADDFILE, 36 ACT_ADDNOTE, ACT_DELFILE, ACT_POLL, ACT_COPYATTACH, ACT_RECODE, ACT_SCRIPT, 37 ACT_ROUTEFBOX, ACT_TOLOWERPATH, ACT_TOUPPERPATH, ACT_COPYATTACHFBOX, 38 ACT_MOVEATTACHFBOX, ACT_ROUTEHUB, ACT_ADDKLUDGE 39 } tAct; 40 41 class Action 42 { 43 public: 44 IndBiList<tTimes> _Times; 45 FA _f; 46 tAct _Act; 47 char * _TplName; 48 PKTMode _Flav; 49 Template * _Tpl; 50 char * _OutDir; 51 MSGBASE * _Base; 52 Mask * _Mask; 53 int _Lines; 54 ScanDir * sd; 55 ScanDir * Before; 56 ScanDir * After; 57 Action(); 58 ~Action(); 59 void Print(void); 60 bool Do(MSGBASE & b, cMSG & m); 61 }; 62 63 class DoList 64 { 65 IndBiList<Mask> Masks; 66 IndBiList<Action> Actions; 67 public: 68 DoList(); 69 ~DoList(); 70 void AddAction(Action & Act); 71 void AddMask(Mask & Msk); 72 void Print(void); 73 int Do(MSGBASE & b, cMSG & m); 74 MaskType InMask(cMSG & m); 75 }; 76 77 class ScanDir 78 { 79 public: 80 IndBiList<DoList> _DoLists; 81 IndBiList<tTimes> _Times; 82 MSGBASE * _Base; 83 int _Renumber; 84 int _Unpack; 85 int _Fresh; 86 uint _MaxAge; 87 uint _MaxAttachSize; 88 uint _MaxMsgSize; 89 uint _MaxPktSize; 90 char * _LoopStr; 91 char * _FlagFile; 92 char * _FileInbound; 93 char * _ScriptBefore; 94 char * _ScriptAfter; 95 ScanDir(); 96 ~ScanDir(); SetBase(MSGBASE * B)97 void SetBase(MSGBASE * B) 98 { 99 _Base = B; 100 } Base(void)101 MSGBASE * Base(void) 102 { 103 return _Base; 104 } 105 void Print(void); 106 int Do(void); 107 int DoWithRoute(MSGBASE & b, cMSG & m); 108 bool Execute(MSGBASE & b, cMSG & m); 109 int Flagged(void); 110 MaxAge(void)111 inline uint MaxAge(void) 112 { 113 if(_MaxAge == 0) 114 { 115 return ::MaxAge; 116 } 117 else 118 { 119 return _MaxAge; 120 } 121 } MaxAttachSize(void)122 inline uint MaxAttachSize(void) 123 { 124 if(_MaxAttachSize == 0) 125 { 126 return ::MaxAttachSize; 127 } 128 else 129 { 130 return _MaxAttachSize; 131 } 132 } MaxMsgSize(void)133 inline uint MaxMsgSize(void) 134 { 135 if(_MaxMsgSize == 0) 136 { 137 return ::MaxMsgSize; 138 } 139 else 140 { 141 return _MaxMsgSize; 142 } 143 } MaxPktSize(void)144 inline uint MaxPktSize(void) 145 { 146 if(_MaxPktSize == 0) 147 { 148 return ::MaxPktSize; 149 } 150 else 151 { 152 return _MaxPktSize; 153 } 154 } LoopStr(void)155 inline char * LoopStr(void) 156 { 157 if(_LoopStr == NULL) 158 { 159 return ::LoopStr; 160 } 161 else 162 { 163 return _LoopStr; 164 } 165 } FileInbound(void)166 inline char * FileInbound(void) 167 { 168 if(_FileInbound == NULL) 169 { 170 return ::FileInbound; 171 } 172 else 173 { 174 return _FileInbound; 175 } 176 } 177 }; 178 179 extern IndBiList<ScanDir> ScanDirs; 180 181 int AddScanDir(void); 182 void PrintScanDirs(void); 183 void DoScanDirs(void); 184 int AddAction(void); 185 186 #endif 187 188