home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / fltintch.zip / fltintch.txt next >
Text File  |  1997-10-01  |  11KB  |  220 lines

  1. 1 October 1997 - updated for new filter delim introduced in 1.34
  2.    fif format drastically overhauled for readability
  3. 9 April 1997 - updated for news flag  (ff13.14)
  4. 6 Jan 1997  - jt MR2ICE filter interchange
  5.  
  6. Summary:
  7.  
  8. ICEFX.CMD exports a set of mr2i filters into a readable interchange
  9. format.  It should be run from the base mr2i directory (for users with only
  10. a default account; for multiple account users, read on).
  11.  
  12. ICEFI.CMD converts an interchange file created by icefx into entries
  13. suitable for incorporating into your mr2i.flt file.
  14.  
  15. There are a number of considerations, please read further before trying the
  16. programs, especially icefi.cmd.
  17.  
  18. Discussion of how to document and exchange filters.
  19.  
  20. History:
  21.  
  22. To date, there has been no convenient way to share filter definitions for
  23. mr2i. What's generally done is to read the settings manually from the
  24. filter edit screen, and then enter them manually into a message.  Since the
  25. edit screen is based on the mr2i.flt file (which has one line for each
  26. filter), and Nick was kind enough to document the format of the file for
  27. this project, it was a SMOP [Small <some say Simple> Matter Of Programming]
  28. to parse each line of the file and output the results as a file that is
  29. both reasonably readable by humans and other programs. The program that
  30. does this is ICEFX.CMD.; here is its usage information:
  31.  
  32.   Usage is ICEFX outfile [infile]
  33.   If infile is not present, mr2i.flt is used as input.  The
  34.   extension .fif [Filter Interchange Format] is reccommended for
  35.   outfile.  This program reads <infile> and the folder index
  36.   file (either folder.ndx or mail\folder.ndx; converts each
  37.   filter entry to interchange format and writes to <outfile>.
  38.   The folder index file entries contain both the folder
  39.   directory and the name of the folder (as read from the
  40.   folder.ndx file); interchange files identify folders by name
  41.   (the raw filter file identifies them by directory name).  A
  42.   fair amount of checking is done to ensure that the filter
  43.   item is legal.
  44.  
  45. This program does the following:
  46.  
  47. 1.  Reads in the folder index (so that folder directory names as they
  48.     appear in the filter file will be replaced by folder NAMES.
  49.  
  50. 2.  Reads the filter file one line at a time.
  51.  
  52. 3.  Each line is checked for legal parameters (this process, unfortunately,
  53.     will need to be updated whenever new filter functions are added).
  54.  
  55. 4.  Each field (or, when applicable, subfield) of the filter 
  56.     (there are currently 13 fields) is output as one line (fields with
  57.     unused values are not output) laid out as in the example:
  58.  
  59. "Enabled"                                f1.1 1 +
  60. "Filter description"                     f1.2 * mr2i experts
  61. "Filter alias"                           f2 * mr2i.exp
  62. "Search modes::  Header "                f3 # 8
  63. "Search text"                            f4 * MR2ICE.EXPERTS@SECANT.COM
  64. "Folder for copy :: F016 "               f6 * mr2ice.exp
  65. "Filter type:: Both (In and Out) "       f13.1 1 B
  66. "Search type:: Simple "                  f13.2 1 S
  67. "Match type:: Match "                    f13.3 1 M
  68. "Copy to folder"                         f13.7 1 Y
  69. "Disposition:: Delete NOW "              f13.13 1 Y
  70.  
  71. There is one line for each field (or subfield) of the filter.
  72. Descriptive information starts in column 1 and is delimited by quotes.
  73. This information may include the :: delimiter which is followed by
  74. descriptive information explaining the encoding of the field.
  75. This is padded out to a fixed length for readability and followed by the
  76. field identifier, size, and value information as follows:
  77. The first field is the field identification (i.e f1.1 is subfield 1 of
  78. field 1; f2 is the second field, and so forth).
  79. The second field is the length or format:
  80.     1 = 1 character
  81.     # = numeric
  82.     * = arbitrary alphanumeric (may include blanks)
  83. This is followed by the actual value of the field in most cases; for search
  84. text or expressions, a multiline format is used for readability:
  85.  
  86. "Search expression"                      f4 *
  87.  {S}"RETURNED MAIL: HOST UNKNOWN" | {S}"WARNING: COULD NOT SEND MESSAGE" 
  88.  | {S}"RETURNED MAIL: SERVICE UNAVAILABLE" | {S}"RETURNED MAIL: USER UNKN
  89.  OWN" | {S}"RETURNED MAIL: CAN'T CREATE OUTPUT" | {S}"DELIVERY REPORT (FA
  90.  ILURE)" | {S}"RETURNED MAIL: WARNING: CANNOT SEND" | {S}"RETURNED MAIL: 
  91.  CANNOT SEND MESSAGE" | {S}"RETURNED MAIL: UNKNOWN MAILER ERROR" | {S}"SU
  92.  BJECT: RETURNED MAIL: LOCAL CONFIGURATIO" | {S} RETURNED MAIL: INSUFFICI
  93.  ENT PERMISSION | {S} RETURNED MAIL: REMOTE PROTOCOL ERROR | {S} RETURNED
  94.   MAIL: TOO MANY HOPS
  95.  
  96. Each filter is delimited by a line of the form:
  97. ---------- Filter 2  FIF-level 1.35nf ----------
  98. This file format has been designated as a FIF (Filter Interchange File);
  99. the suffix fif is suggested.
  100.  
  101. It is fairly easy to use this format as a guide to manually creating a
  102. replica of the filter on a different system, as well as input to a program
  103. to create a filter.  
  104.  
  105. There are a few concerns when moving filters from one system to another:
  106.  
  107. a.  Any paths specified (for rexx commands, etc.) may not be consistent 
  108.     between the source and target systems. 
  109.  
  110. b.  Folder names may not match between the two systems; a folder name
  111.     will have to be selected on the target system. 
  112.  
  113. c.  Where should the filter go in the sequence of filtering?
  114.  
  115. Subject to these concerns (the folder name issue is somewhat addressed), the
  116. companion program ICEFI.CMD will read a FIF produced by ICEFX.CMD
  117. and create filter file entries.  Its usage information follows:
  118.  
  119.   usage is:  ICEFI  infile [outfile] [+] [-]
  120.  
  121.   Run this program in the directory that contains your mr2i.flt
  122.   file (even if you explicitly specify a different outfile).
  123.   
  124.   If outfile is omitted, lines are appended to mr2i.flt.  If the +
  125.   switch is not present, filters are left disabled regardless of
  126.   setting of the enabled flag in the interchange file.  If the + is
  127.   present, the enabled state is copied from the input.  
  128.   If folders.ndx or mail\folders.ndx file is found, will try to
  129.   match folder NAME (not directory) in interchange file and use
  130.   corresponding folder directory on target system; if no match
  131.   found you will be asked to select a folder directory for this
  132.   case [and optionally, any subsequent cases where there is no
  133.   folder name match].
  134.   
  135.   Unless the - switch is present, the output will be in 1.34 and later
  136.   filterfile format.
  137.   If the - switch is present, output will be in old format.
  138.  
  139. The output can either be written to a designated file or appended to
  140. mr2i.flt.  Again, this program does a fair amount of checking for
  141. consistency of the filter and valid entries in the fields.  An option
  142. either preserves the enabled status of the input or creates all the
  143. entries as disabled.
  144.  
  145. In the process of working up these programs, it was observed that in some
  146. cases there are fields in the mr2i.flt file that contain irrelevant values
  147. (such as an arbitrary auto-reply template when autoreply has not been
  148. selected). I have chosen to eliminate these fields as well as not creating
  149. FIF entries for fields that take on their default values.  Because of this,
  150. exporting and then importing a set of filters will not create a new filter
  151. file that is bitwise identical to the original, but it should be
  152. FUNCTIONALLY identical (if not, this is a legitimate bug).
  153.  
  154. The import program also reads in the local folder index file.  For each
  155. filter specifying a folder, a check is made to see if there is a folder
  156. with a matching NAME (this check ignores case).  If so, that folder is
  157. used. If not, the folder list is displayed and the user is asked to select
  158. an EXISTING folder to be used for the filter. [This choice may be repeated
  159. for each subsequent case where there is no matching name, or saved for use
  160. in all subsequent cases with no matching folder name].
  161.  
  162. Thus, one of the 3 concerns is somewhat addressed. However, it is expected
  163. that if the imported filters are going to be merged with your existing
  164. filters, a certain amount of editing is going to be required, both for path
  165. names and to position the filters properly in your own sequence of
  166. application.  As a consequence, and because no ready solution came to mind,
  167. the path and sequence issues are left to be dealt with manually (normally
  168. using filter edit in mr2i) by the user.
  169.  
  170. The maximum length of a simple search text is 80 characters, 1024
  171. characters for freeform. This is checked by the import program.
  172.  
  173. One note; it is strongly recommended that you manipulate filters only when 
  174. mr2i is not running, and to first test a filter setup on existing
  175. (perhaps garbage) messages.  Also, before allowing a filter to delete
  176. messages entirely, I copy them to a "junkbox" folder until I am convinced
  177. that the filter is not grabbing more than it should.
  178.  
  179. USAGE notes:  Invoking either ICEFI or ICEFX with no arguments will
  180. cause usage and descriptive information to be displayed.
  181.  
  182. Normally the programs should be run in the base mr2ice directory (but see
  183. below for users with multiple accounts).
  184.  
  185. NOTES on new version ( FIF level 1.35nf ).
  186.  
  187. Nick changed the filter format with mr2ice version 1.34, since the old
  188. version used the "\" as a delimiter; this caused major problems if there
  189. was a \ in search criteria.  In the old format, a '\' in a path
  190. specification (for a REXX cmd file) was converted to '/' in the mr2i.flt
  191. file. The old FIF format followed this rule; paths were shown as
  192. c:/mr2ice/xxyz.cmd.  The new FIF format preserves the use of \ in path
  193. specifications.
  194.  
  195. Note that these programs can be used with either old or new format filter
  196. files, and that the fif file is 
  197.  
  198. The filter EXPORT program - icefx.cmd - will detect which delimiter is
  199. used in the mr2i.flt file, and convert the path separator accordingly.
  200.  
  201. The default action of the filter IMPORT program icefi.cmd is to
  202. generate the new filter format.  If the '-' switch is used, it will
  203. generate the old filter format; in this case, if the '\' character
  204. appears in any of the text fields (primarily search criteria), an error
  205. will be flagged.
  206.  
  207. NOTES on multiple accounts.
  208.  
  209. For users with more than one account, there is an mr2i.flt file in the base
  210. mr2ice directory (this is associated with the default account), 
  211. and one in the directory associated with each supplemental account
  212. (a subdirectory under the base mr2ice directory).  The folders.ndx
  213. file for the default account is in the mail subdirectory, but for additional
  214. accounts is in the account subdirectory.  The rule for using these programs
  215. in a multiple account mr2i environment is to run them in the directory
  216. associated with the account of interest; i.e. for the default account, use
  217. the base mr2ice directory, but for a supplemental account, use the
  218. subdirectory associated with that account.  In each case the programs will
  219. find the correct folders.ndx file.
  220.