home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume41 / mailagent / patch06 < prev    next >
Encoding:
Text File  |  1994-01-31  |  29.2 KB  |  981 lines

  1. Newsgroups: comp.sources.misc
  2. From: Raphael Manfredi <ram@acri.fr>
  3. Subject: v41i125:  mailagent - Flexible mail filtering and processing package, v3.0, Patch06
  4. Message-ID: <1994Feb1.065417.15086@sparky.sterling.com>
  5. X-Md4-Signature: 51bd12485543b3bdc520e524b44c158a
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Advanced Computer Research Institute, Lyon, France
  8. Date: Tue, 1 Feb 1994 06:54:17 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: Raphael Manfredi <ram@acri.fr>
  12. Posting-number: Volume 41, Issue 125
  13. Archive-name: mailagent/patch06
  14. Environment: UNIX, Perl
  15. Patch-To: mailagent: Volume 41, Issue 1-26
  16.  
  17. [The latest patch for mailagent version 3.0 is #6.]
  18.  
  19. System: mailagent version 3.0
  20. Patch #: 6
  21. Priority: LOW
  22. Subject: patch #5, continued
  23. Date: Wed Jan 26 10:46:48 MET 1994
  24. From: Raphael Manfredi <ram@acri.fr>
  25.  
  26. Description:
  27.     See patch #5.
  28.  
  29.  
  30. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your mailagent source
  31.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  32.     If you don't have the patch program, apply the following by hand,
  33.     or get patch (version 2.0, latest patchlevel).
  34.  
  35.     After patching:
  36.         Configure -ders
  37.         make depend
  38.         make
  39.         make install
  40.         make install.man
  41.  
  42.     If patch indicates that patchlevel is the wrong version, you may need
  43.     to apply one or more previous patches, or the patch may already
  44.     have been applied.  See the patchlevel.h file to find out what has or
  45.     has not been applied.  In any event, don't continue with the patch.
  46.  
  47.     If you are missing previous patches they can be obtained from me:
  48.  
  49.         Raphael Manfredi <ram@acri.fr>
  50.  
  51.     If you send a mail message of the following form it will greatly speed
  52.     processing:
  53.  
  54.         Subject: Command
  55.         @SH mailpatch PATH mailagent 3.0 LIST
  56.                ^ note the c
  57.  
  58.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  59.     or in bang notation from some well-known host, and LIST is the number
  60.     of one or more patches you need, separated by spaces, commas, and/or
  61.     hyphens.  Saying 35- says everything from 35 to the end.
  62.  
  63.     To get some more detailed instructions, send me the following mail:
  64.  
  65.         Subject: Command
  66.         @SH mailhelp PATH
  67.  
  68.  
  69. Index: patchlevel.h
  70. Prereq: 5
  71. 4c4
  72. < #define PATCHLEVEL 5
  73. ---
  74. > #define PATCHLEVEL 6
  75.  
  76. Index: agent/pl/actions.pl
  77. Prereq: 3.0
  78. *** agent/pl/actions.pl.old    Wed Jan 26 10:36:42 1994
  79. --- agent/pl/actions.pl    Wed Jan 26 10:36:42 1994
  80. ***************
  81. *** 1,4 ****
  82. ! ;# $Id: actions.pl,v 3.0 1993/11/29 13:48:33 ram Exp $
  83.   ;#
  84.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  85.   ;#  
  86. --- 1,4 ----
  87. ! ;# $Id: actions.pl,v 3.0.1.1 1994/01/26 09:30:03 ram Exp $
  88.   ;#
  89.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  90.   ;#  
  91. ***************
  92. *** 9,14 ****
  93. --- 9,17 ----
  94.   ;#  of the source tree for mailagent 3.0.
  95.   ;#
  96.   ;# $Log: actions.pl,v $
  97. + ;# Revision 3.0.1.1  1994/01/26  09:30:03  ram
  98. + ;# patch5: restored ability to use Cc: and Bcc: in message files
  99. + ;#
  100.   ;# Revision 3.0  1993/11/29  13:48:33  ram
  101.   ;# Baseline for mailagent 3.0 netwide release.
  102.   ;#
  103. ***************
  104. *** 394,404 ****
  105.           &add_log("ERROR cannot open message $msg") if $loglvl > 0;
  106.           return 1;
  107.       }
  108. -     unless (open(MAILER,"|$cf'sendmail $cf'mailopt $recipients")) {
  109. -         &add_log("ERROR cannot run $cf'sendmail to send message: $!")
  110. -             if $loglvl;
  111. -         return 1;
  112. -     }
  113.   
  114.       # Construction of value for the %T macro
  115.       local($macro_T);            # Default value of macro %T is overwritten
  116. --- 397,402 ----
  117. ***************
  118. *** 420,439 ****
  119.       # overwritten with the one found in the file.
  120.       if (&header_found($msg)) {    # Top of message is a header
  121.           local(@newhead);        # New header is constructed here
  122.           local($field);
  123.           while (<MSG>) {            # Read the header then
  124.               last if /^$/;        # End of header
  125.               chop;
  126.               push(@newhead, $_);
  127. !             if (/^([\w\-]+):/) {
  128.                   $field = $1;
  129.                   @head = grep(!/^$field:/, @head);    # Field is overwritten
  130.               }
  131.           }
  132.           foreach (@newhead) {
  133.               push(@head, $_);
  134.           }
  135.       }
  136.       push(@head, $FILTER);        # Avoid loops: replying to ourselves or whatever
  137.       foreach $line (@head) {
  138.           ¯os_subst(*line);    # In-place macro substitutions
  139. --- 418,478 ----
  140.       # overwritten with the one found in the file.
  141.       if (&header_found($msg)) {    # Top of message is a header
  142.           local(@newhead);        # New header is constructed here
  143. +         local($cc) = '';        # Carbon copy recipients
  144. +         local($collect) = 0;    # True when collecting recipients
  145.           local($field);
  146. +         local($_);
  147.           while (<MSG>) {            # Read the header then
  148.               last if /^$/;        # End of header
  149.               chop;
  150.               push(@newhead, $_);
  151. !             if (/^([\w\-]+):(.*)/) {
  152.                   $field = $1;
  153. +                 $_ = $2;
  154.                   @head = grep(!/^$field:/, @head);    # Field is overwritten
  155. +                 # The following used to be done directly by sendmail -t.
  156. +                 # However, mailagent does not make use of that option any
  157. +                 # longer since $cf'sendmail might not be sendmail and the
  158. +                 # mailer used might therefore not understand this -t option.
  159. +                 $collect = ($field =~ /^b?cc$/i);
  160. +                 $cc .= ¯os_subst(*_) if $collect;
  161. +             } else {
  162. +                 $cc .= ¯os_subst(*_) if $collect;    # Continuation lines
  163.               }
  164.           }
  165.           foreach (@newhead) {
  166.               push(@head, $_);
  167.           }
  168. +         # Now update the recipient line by parsing $cc and extracting the
  169. +         # e-mail addresses, discarding the comments. Note that this code
  170. +         # will fail if ',' is used in address comments.
  171. +         local(@addr) = split(/,/, $cc);
  172. +         foreach $addr (@addr) {
  173. +             $recipients .= ' ' . (&parse_address($addr))[0];
  174. +         }
  175.       }
  176. +     # Remove duplicate e-mail addresses in the recipient list. Again,
  177. +     # mailagent used to rely on sendmail to do this, but we can't assume
  178. +     # any user-defined mailer will do it.
  179. +     local(%seen);
  180. +     foreach $addr (split(' ', $recipients)) {
  181. +         $seen{$addr}++;
  182. +     }
  183. +     $recipients = join(' ', sort keys %seen);
  184. +     undef %seen;
  185. +     unless (open(MAILER,"|$cf'sendmail $cf'mailopt $recipients")) {
  186. +         &add_log("ERROR cannot run $cf'sendmail to send message: $!")
  187. +             if $loglvl;
  188. +         close MSG;
  189. +         return 1;
  190. +     }
  191.       push(@head, $FILTER);        # Avoid loops: replying to ourselves or whatever
  192.       foreach $line (@head) {
  193.           ¯os_subst(*line);    # In-place macro substitutions
  194.  
  195. Index: agent/pl/history.pl
  196. Prereq: 3.0
  197. *** agent/pl/history.pl.old    Wed Jan 26 10:36:45 1994
  198. --- agent/pl/history.pl    Wed Jan 26 10:36:45 1994
  199. ***************
  200. *** 1,4 ****
  201. ! ;# $Id: history.pl,v 3.0 1993/11/29 13:48:50 ram Exp $
  202.   ;#
  203.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  204.   ;#  
  205. --- 1,4 ----
  206. ! ;# $Id: history.pl,v 3.0.1.1 1994/01/26 09:32:54 ram Exp $
  207.   ;#
  208.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  209.   ;#  
  210. ***************
  211. *** 9,14 ****
  212. --- 9,17 ----
  213.   ;#  of the source tree for mailagent 3.0.
  214.   ;#
  215.   ;# $Log: history.pl,v $
  216. + ;# Revision 3.0.1.1  1994/01/26  09:32:54  ram
  217. + ;# patch5: history can now handle distinct tags on messages
  218. + ;#
  219.   ;# Revision 3.0  1993/11/29  13:48:50  ram
  220.   ;# Baseline for mailagent 3.0 netwide release.
  221.   ;#
  222. ***************
  223. *** 20,26 ****
  224.   # Record the message ID of the current message and return 0 if the
  225.   # message was recorded for the first time or if there is no valid message ID.
  226.   # Return 1 if the message was already recorded, and hence was already seen.
  227. ! sub history_record {
  228.       local($msg_id) = $Header{'Message-Id'};        # Message-ID header
  229.   
  230.       # If there is no message ID, use the concatenation of date + from fields.
  231. --- 23,32 ----
  232.   # Record the message ID of the current message and return 0 if the
  233.   # message was recorded for the first time or if there is no valid message ID.
  234.   # Return 1 if the message was already recorded, and hence was already seen.
  235. ! # If tags are provided (string list of words, separated by commas), then
  236. ! # information is only fetched/recorded for those tags.
  237. ! sub history_tag {
  238. !     local($tags) = @_;
  239.       local($msg_id) = $Header{'Message-Id'};        # Message-ID header
  240.   
  241.       # If there is no message ID, use the concatenation of date + from fields.
  242. ***************
  243. *** 48,60 ****
  244.           return 0;                    # Cannot record message if invalid ID
  245.       }
  246.   
  247. !     local($time, $line) = &dbr'info($host, 'HISTORY', $stamp);
  248. !     return 0 if $time == -1;                # An error occurred
  249. !     if ($time > 0) {                        # Message already recorded
  250. !         &add_log("history duplicate <$msg_id>") if $loglvl > 6;
  251. !         return 1;
  252.       }
  253. !     &dbr'update($host, 'HISTORY', 0, $stamp);    # Record message (appending)
  254. !     0;            # First time ever seen
  255.   }
  256.   
  257. --- 54,95 ----
  258.           return 0;                    # Cannot record message if invalid ID
  259.       }
  260.   
  261. !     # Compute a tag array. If no tag given, insert a null tag so that we
  262. !     # enter the loop below anyway.
  263. !     $tags =~ s/\s+//g;
  264. !     local(@tags) = split(/,+/, $tags);
  265. !     push(@tags, '') unless @tags;
  266. !     # Now loop for each tag given. We record the message ID stamp followed
  267. !     # by a tab, then the tag between <>. If no tag is given, we look for any
  268. !     # occurence.
  269. !     local($time, $line);            # Time stamp, line number of DBR entry
  270. !     local(@regexp);                    # DBR regular expression lookup
  271. !     local($seen) = 0;                # Assume new instance
  272. !     
  273. !     foreach $tag (@tags) {
  274. !         @regexp = ($stamp);
  275. !         push(@regexp, "<$tag>") if $tag ne '';
  276. !         ($time, $line) = &dbr'info($host, 'HISTORY', @regexp);
  277. !         if ($time == -1) {            # An error occurred
  278. !             &add_log("ERROR while dbr-looking for '@regexp'") if $loglvl > 1;
  279. !             next;
  280. !         }
  281. !         if ($time > 0) {            # Message already recorded
  282. !             local($tagmsg) = $tag eq '' ? '' : " ($tag)";
  283. !             &add_log("history duplicate <$msg_id>" . $tagmsg) if $loglvl > 6;
  284. !             $seen++;
  285. !         } else {                    # Record message (appending)
  286. !             &dbr'update($host, 'HISTORY', 0, @regexp);
  287. !         }
  288.       }
  289. !     return $seen;                    # Return seen status
  290. ! }
  291. ! # Obsolete -- will be removed in next release
  292. ! sub history_record {
  293. !     &history_tag();
  294.   }
  295.   
  296.  
  297. Index: agent/test/actions
  298. Prereq: 3.0.1.2
  299. *** agent/test/actions.old    Wed Jan 26 10:36:45 1994
  300. --- agent/test/actions    Wed Jan 26 10:36:46 1994
  301. ***************
  302. *** 2,8 ****
  303.   # Mailagent rules for action regression tests
  304.   #
  305.   
  306. ! # $Id: actions,v 3.0.1.2 1993/12/17 08:13:20 ram Exp $
  307.   #
  308.   #  Copyright (c) 1990-1993, Raphael Manfredi
  309.   #  
  310. --- 2,8 ----
  311.   # Mailagent rules for action regression tests
  312.   #
  313.   
  314. ! # $Id: actions,v 3.0.1.3 1994/01/26 09:35:08 ram Exp $
  315.   #
  316.   #  Copyright (c) 1990-1993, Raphael Manfredi
  317.   #  
  318. ***************
  319. *** 13,18 ****
  320. --- 13,22 ----
  321.   #  of the source tree for mailagent 3.0.
  322.   #
  323.   # $Log: actions,v $
  324. + # Revision 3.0.1.3  1994/01/26  09:35:08  ram
  325. + # patch5: added new tests for UNIQUE and RECORD tags
  326. + # patch5: ensure header-added recipients looked for in messages
  327. + #
  328.   # Revision 3.0.1.2  1993/12/17  08:13:20  ram
  329.   # patch4: one spurious single quote still remained after patch3
  330.   #
  331. ***************
  332. *** 111,117 ****
  333.   }
  334.   X-Tag: /keep/, To: ram        { SAVE no_resync };
  335.   
  336. ! X-Tag: /message/            { MESSAGE msg; DELETE };
  337.   
  338.   X-Tag: /macro/
  339.   {
  340. --- 115,122 ----
  341.   }
  342.   X-Tag: /keep/, To: ram        { SAVE no_resync };
  343.   
  344. ! X-Tag: /message 1/            { MESSAGE msg; DELETE };
  345. ! X-Tag: /message 2/            { MESSAGE msg.2; DELETE };
  346.   
  347.   X-Tag: /macro/
  348.   {
  349. ***************
  350. *** 130,135 ****
  351. --- 135,141 ----
  352.   
  353.   X-Tag: /notify 1/            { NOTIFY msg nobody; DELETE };
  354.   X-Tag: /notify 2/            { NOTIFY msg "list"; DELETE };
  355. + X-Tag: /notify 3/            { NOTIFY msg.2 some@random.ctry %u; DELETE };
  356.   
  357.   X-Tag: /once/
  358.   {
  359. ***************
  360. *** 172,177 ****
  361. --- 178,190 ----
  362.   X-Tag: /record #3/                { RECORD -a; SAVE %u.1 };
  363.   X-Tag: /record #4/                { RECORD -c; REJECT -f RECORD; SAVE %u.1 };
  364.   <RECORD> X-Tag: /record #4/        { SAVE %u.2 };
  365. + <RECORD_CATCH> X-Tag: /record/    { DELETE };
  366. + X-Tag: /record #5/                { RECORD (tag1,tag2); SAVE %u.1; REJECT };
  367. + X-Tag: /record #5/                { RECORD INITIAL (tag2); SAVE %u.2; REJECT };
  368. + X-Tag: /record #5/                { RECORD -r RECORD_CATCH; SAVE %u.3 };
  369. + X-Tag: /record #6/                { RECORD (tag); SAVE %u.1; REJECT };
  370. + X-Tag: /record #6/                { RECORD (other); SAVE %u.2; REJECT };
  371. + X-Tag: /record #6/                { RECORD -r RECORD_CATCH; SAVE %u.3 };
  372.   
  373.   X-Tag: /require/        { REJECT REQUIRE; };
  374.   <REQUIRE>                { REQUIRE non_existent; REJECT -f; SAVE never };
  375. ***************
  376. *** 272,277 ****
  377. --- 285,296 ----
  378.   X-Tag: /unique #3/                { UNIQUE -a; SAVE %u.1 };
  379.   X-Tag: /unique #4/                { UNIQUE -c; REJECT -f UNIQUE; SAVE %u.1 };
  380.   <UNIQUE> X-Tag: /unique #4/        { SAVE %u.2 };
  381. + X-Tag: /unique #5/            { UNIQUE -a (tag1,tag2); SAVE %u.1; REJECT };
  382. + X-Tag: /unique #5/            { UNIQUE (tag2); REJECT -f; SAVE %u.2; REJECT };
  383. + X-Tag: /unique #5/            { UNIQUE -a; SAVE %u.3 };
  384. + X-Tag: /unique #6/            { UNIQUE (tag); REJECT -f; SAVE %u.1; REJECT };
  385. + X-Tag: /unique #6/            { UNIQUE (other); REJECT -f; SAVE %u.2; REJECT };
  386. + X-Tag: /unique #6/            { UNIQUE -a; SAVE %u.3 };
  387.   
  388.   X-Tag: /write #1/    { WRITE mbox };
  389.   X-Tag: /write #2/    { WRITE path/another/third/mbox };
  390.  
  391. Index: agent/test/cmd/message.t
  392. Prereq: 3.0
  393. *** agent/test/cmd/message.t.old    Wed Jan 26 10:36:46 1994
  394. --- agent/test/cmd/message.t    Wed Jan 26 10:36:46 1994
  395. ***************
  396. *** 1,6 ****
  397.   # Test MESSAGE command
  398.   
  399. ! # $Id: message.t,v 3.0 1993/11/29 13:49:34 ram Exp $
  400.   #
  401.   #  Copyright (c) 1990-1993, Raphael Manfredi
  402.   #  
  403. --- 1,6 ----
  404.   # Test MESSAGE command
  405.   
  406. ! # $Id: message.t,v 3.0.1.1 1994/01/26 09:35:22 ram Exp $
  407.   #
  408.   #  Copyright (c) 1990-1993, Raphael Manfredi
  409.   #  
  410. ***************
  411. *** 11,16 ****
  412. --- 11,19 ----
  413.   #  of the source tree for mailagent 3.0.
  414.   #
  415.   # $Log: message.t,v $
  416. + # Revision 3.0.1.1  1994/01/26  09:35:22  ram
  417. + # patch5: ensure header-added recipients looked for in messages
  418. + #
  419.   # Revision 3.0  1993/11/29  13:49:34  ram
  420.   # Baseline for mailagent 3.0 netwide release.
  421.   #
  422. ***************
  423. *** 21,41 ****
  424.   open(MSG, '>msg') || print "1\n";
  425.   print MSG <<EOM;
  426.   Organization: Public Domain Software, Earth, Milkway.
  427.   
  428.   Sent by %n.
  429.   EOM
  430.   close MSG;
  431.   
  432. ! &add_header('X-Tag: message');
  433.   `$cmd`;
  434.   $? == 0 || print "2\n";
  435.   -f "$user" && print "3\n";        # Mail not saved
  436.   &get_log(4, 'send.mail');
  437. ! &check_log('^$', 5) == 1 || print "6\n";
  438.   &check_log('^Subject: Re: melting', 7) == 1 || print "8\n";
  439.   &check_log('^Recipients: compilers-request@iecc', 9) == 1 || print "10\n";
  440.   &check_log('^Sent by compilers-request.$', 11) == 1 || print "12\n";
  441.   
  442.   &clear_mta;
  443. ! unlink 'mail', 'msg';
  444.   print "0\n";
  445. --- 24,68 ----
  446.   open(MSG, '>msg') || print "1\n";
  447.   print MSG <<EOM;
  448.   Organization: Public Domain Software, Earth, Milkway.
  449. + Above line was not a header, since no space before this line.
  450.   
  451.   Sent by %n.
  452.   EOM
  453.   close MSG;
  454.   
  455. ! open(MSG, '>msg.2') || print "13\n";
  456. ! print MSG <<EOM;
  457. ! Cc: some@random.ctry, %u
  458. ! Organization: Public Domain Software, Earth, Milkway.
  459. ! Body of message.
  460. ! EOM
  461. ! close MSG;
  462. ! &add_header('X-Tag: message 1');
  463.   `$cmd`;
  464.   $? == 0 || print "2\n";
  465.   -f "$user" && print "3\n";        # Mail not saved
  466.   &get_log(4, 'send.mail');
  467. ! &check_log('^$', 5) == 2 || print "6\n";
  468.   &check_log('^Subject: Re: melting', 7) == 1 || print "8\n";
  469.   &check_log('^Recipients: compilers-request@iecc', 9) == 1 || print "10\n";
  470.   &check_log('^Sent by compilers-request.$', 11) == 1 || print "12\n";
  471. + unlink 'send.mail', $user;
  472.   
  473. + &replace_header('X-Tag: message 2');
  474. + `$cmd`;
  475. + $? == 0 || print "14\n";
  476. + -f "$user" && print "15\n";        # Mail not saved
  477. + &get_log(16, 'send.mail');
  478. + &check_log('^$', 17) == 1 || print "18\n";
  479. + &check_log('^Subject: Re: melting', 19) == 1 || print "20\n";
  480. + $recipients = join(' ', sort split(' ',
  481. +     "compilers-request@iecc.cambridge.ma.us some@random.ctry $user"));
  482. + &check_log("^Recipients: $recipients", 21) == 1 || print "22\n";
  483. + &check_log("^Cc: some@random.ctry, $user", 23) == 1 || print "24\n";
  484.   &clear_mta;
  485. ! unlink 'mail', 'msg', 'msg.2', $user;
  486. ! # Last is 24
  487.   print "0\n";
  488.  
  489. Index: agent/magent.SH
  490. Prereq: 3.0
  491. *** agent/magent.SH.old    Wed Jan 26 10:36:37 1994
  492. --- agent/magent.SH    Wed Jan 26 10:36:37 1994
  493. ***************
  494. *** 24,30 ****
  495.   # via the filter. Mine looks like this:
  496.   #   "|exec /users/ram/mail/filter >>/users/ram/.bak 2>&1"
  497.   
  498. ! # $Id: magent.SH,v 3.0 1993/11/29 13:48:22 ram Exp $
  499.   #
  500.   #  Copyright (c) 1990-1993, Raphael Manfredi
  501.   #  
  502. --- 24,30 ----
  503.   # via the filter. Mine looks like this:
  504.   #   "|exec /users/ram/mail/filter >>/users/ram/.bak 2>&1"
  505.   
  506. ! # $Id: magent.SH,v 3.0.1.1 1994/01/26 09:27:56 ram Exp $
  507.   #
  508.   #  Copyright (c) 1990-1993, Raphael Manfredi
  509.   #  
  510. ***************
  511. *** 35,40 ****
  512. --- 35,43 ----
  513.   #  of the source tree for mailagent 3.0.
  514.   #
  515.   # $Log: magent.SH,v $
  516. + # Revision 3.0.1.1  1994/01/26  09:27:56  ram
  517. + # patch5: new -F option to force procesing on filtered messages
  518. + #
  519.   # Revision 3.0  1993/11/29  13:48:22  ram
  520.   # Baseline for mailagent 3.0 netwide release.
  521.   #
  522. ***************
  523. *** 158,163 ****
  524. --- 161,169 ----
  525.       elsif ($_ eq '-t') {    # Track rule matches on stdout
  526.           ++$track_all;
  527.       }
  528. +     elsif ($_ eq '-F') {    # Force processing, even if already seen
  529. +         ++$force_seen;
  530. +     }
  531.       elsif ($_ eq '-L') {    # Specify new logging level
  532.           $log_level = int(shift);
  533.       }
  534. ***************
  535. *** 319,330 ****
  536.   # Print usage and exit
  537.   sub usage {
  538.       print STDERR <<EOF;
  539. ! Usage: $prog_name [-dhilqtV] [-s{umary}] [-f file] [-e rules] [-c config]
  540.          [-L level] [-r file] [-o def] [mailfile]
  541.     -c : specify alternate configuration file.
  542.     -d : dump filter rules (special).
  543.     -e : enter rules to be applied.
  544.     -f : get messages from UNIX-style mailbox file.
  545.     -h : print this help message and exits.
  546.     -i : interactive usage -- print log messages on stderr.
  547.     -l : list message queue (special).
  548. --- 325,337 ----
  549.   # Print usage and exit
  550.   sub usage {
  551.       print STDERR <<EOF;
  552. ! Usage: $prog_name [-dFhilqtV] [-s{umary}] [-f file] [-e rules] [-c config]
  553.          [-L level] [-r file] [-o def] [mailfile]
  554.     -c : specify alternate configuration file.
  555.     -d : dump filter rules (special).
  556.     -e : enter rules to be applied.
  557.     -f : get messages from UNIX-style mailbox file.
  558. +   -F : force processing on already filtered messages.
  559.     -h : print this help message and exits.
  560.     -i : interactive usage -- print log messages on stderr.
  561.     -l : list message queue (special).
  562.  
  563. Index: agent/test/cmd/notify.t
  564. Prereq: 3.0
  565. *** agent/test/cmd/notify.t.old    Wed Jan 26 10:36:47 1994
  566. --- agent/test/cmd/notify.t    Wed Jan 26 10:36:47 1994
  567. ***************
  568. *** 1,6 ****
  569.   # Test NOTIFY command
  570.   
  571. ! # $Id: notify.t,v 3.0 1993/11/29 13:49:36 ram Exp $
  572.   #
  573.   #  Copyright (c) 1990-1993, Raphael Manfredi
  574.   #  
  575. --- 1,6 ----
  576.   # Test NOTIFY command
  577.   
  578. ! # $Id: notify.t,v 3.0.1.1 1994/01/26 09:35:34 ram Exp $
  579.   #
  580.   #  Copyright (c) 1990-1993, Raphael Manfredi
  581.   #  
  582. ***************
  583. *** 11,16 ****
  584. --- 11,19 ----
  585.   #  of the source tree for mailagent 3.0.
  586.   #
  587.   # $Log: notify.t,v $
  588. + # Revision 3.0.1.1  1994/01/26  09:35:34  ram
  589. + # patch5: ensure header-added recipients looked for in messages
  590. + #
  591.   # Revision 3.0  1993/11/29  13:49:36  ram
  592.   # Baseline for mailagent 3.0 netwide release.
  593.   #
  594. ***************
  595. *** 26,31 ****
  596. --- 29,43 ----
  597.   EOM
  598.   close MSG;
  599.   
  600. + open(MSG, '>msg.2') || print "21\n";
  601. + print MSG <<EOM;
  602. + Cc: someone@random, %u
  603. + Organization: Public Domain Software, Earth, Milkway.
  604. + Message body.
  605. + EOM
  606. + close MSG;
  607.   &add_header('X-Tag: notify 1');
  608.   `$cmd`;
  609.   $? == 0 || print "2\n";
  610. ***************
  611. *** 53,59 ****
  612.   &get_log(16, 'send.mail');
  613.   &check_log('^To: first, second, third$', 17) == 1 || print "18\n";
  614.   &check_log('^Recipients: first second third$', 19) == 1 || print "20\n";
  615.   
  616.   &clear_mta;
  617. ! unlink 'mail', 'list', 'msg';
  618.   print "0\n";
  619. --- 65,85 ----
  620.   &get_log(16, 'send.mail');
  621.   &check_log('^To: first, second, third$', 17) == 1 || print "18\n";
  622.   &check_log('^Recipients: first second third$', 19) == 1 || print "20\n";
  623. + unlink 'send.mail', $user;
  624.   
  625. + &replace_header('X-Tag: notify 3');
  626. + `$cmd`;
  627. + $? == 0 || print "22\n";
  628. + -f "$user" && print "23\n";        # Mail not saved
  629. + &get_log(24, 'send.mail');
  630. + &check_log('^$', 25) == 1 || print "26\n";
  631. + &check_log('^Subject: Re: melting', 27) == 1 || print "28\n";
  632. + $recipients = join(' ', sort split(' ',
  633. +     "someone@random some@random.ctry $user"));
  634. + &check_log("^Recipients: $recipients", 29) == 1 || print "30\n";
  635. + &check_log("^Cc: someone@random, $user", 31) == 1 || print "32\n";
  636.   &clear_mta;
  637. ! unlink 'mail', 'list', 'msg', 'msg.2', $user;
  638. ! # Last is 32
  639.   print "0\n";
  640.  
  641. Index: agent/test/cmd/record.t
  642. Prereq: 3.0
  643. *** agent/test/cmd/record.t.old    Wed Jan 26 10:36:47 1994
  644. --- agent/test/cmd/record.t    Wed Jan 26 10:36:47 1994
  645. ***************
  646. *** 1,6 ****
  647.   # The RECORD command
  648.   
  649. ! # $Id: record.t,v 3.0 1993/11/29 13:49:42 ram Exp $
  650.   #
  651.   #  Copyright (c) 1990-1993, Raphael Manfredi
  652.   #  
  653. --- 1,6 ----
  654.   # The RECORD command
  655.   
  656. ! # $Id: record.t,v 3.0.1.1 1994/01/26 09:35:57 ram Exp $
  657.   #
  658.   #  Copyright (c) 1990-1993, Raphael Manfredi
  659.   #  
  660. ***************
  661. *** 11,16 ****
  662. --- 11,19 ----
  663.   #  of the source tree for mailagent 3.0.
  664.   #
  665.   # $Log: record.t,v $
  666. + # Revision 3.0.1.1  1994/01/26  09:35:57  ram
  667. + # patch5: added tests for tag support
  668. + #
  669.   # Revision 3.0  1993/11/29  13:49:42  ram
  670.   # Baseline for mailagent 3.0 netwide release.
  671.   #
  672. ***************
  673. *** 55,60 ****
  674. --- 58,88 ----
  675.   -f "$user.1" && print "16\n";    # We rejected
  676.   -f "$user.2" || print "17\n";    # Must be there (saved in mode RECORD)
  677.   -f "$user" && print "18\n";
  678. + unlink "$user.1", "$user.2", $user;
  679. + &replace_header('X-Tag: record #5');
  680. + `$cmd`;
  681. + $? == 0 || print "19\n";
  682. + -f "$user.1" || print "20\n";    # First time with both tags tag1 and tag2
  683. + -f "$user.2" && print "21\n";    # Can't be there (tag2 already recorded)
  684. + -f "$user.3" && print "22\n";    # Can't be there (already recorded previously)
  685. + -f "$user" && print "23\n";
  686. + &get_log(24, 'dbr/i/e');
  687. + &check_log('<tag2>$', 25) == 1 || print "26\n";
  688. + &check_log('<tag1>$', 27) == 1 || print "28\n";
  689. + &check_log('cambridge', 29) == 3 || print "30\n";
  690. + unlink "$user.1", "$user.2", "$user.3", $user;
  691. + &replace_header('X-Tag: record #6');
  692. + `rm -rf dbr` if -d 'dbr';
  693. + `$cmd`;
  694. + $? == 0 || print "31\n";
  695. + -f "$user.1" || print "32\n";    # First time with tag 'tag'
  696. + -f "$user.2" || print "33\n";    # Tag 'other' distinct from 'tag'
  697. + -f "$user.3" && print "34\n";    # Sorry, already recorded
  698. + -f "$user" && print "35\n";
  699. + &get_log(36, 'dbr/i/e');
  700. + &check_log('cambridge', 37) == 2 || print "38\n";
  701.   
  702.   `rm -rf dbr` if -d 'dbr';
  703.   unlink "$user", "$user.1", "$user.2", "$user.3", 'mail';
  704.  
  705. Index: agent/test/cmd/unique.t
  706. Prereq: 3.0
  707. *** agent/test/cmd/unique.t.old    Wed Jan 26 10:36:48 1994
  708. --- agent/test/cmd/unique.t    Wed Jan 26 10:36:48 1994
  709. ***************
  710. *** 1,6 ****
  711.   # The UNIQUE command
  712.   
  713. ! # $Id: unique.t,v 3.0 1993/11/29 13:49:53 ram Exp $
  714.   #
  715.   #  Copyright (c) 1990-1993, Raphael Manfredi
  716.   #  
  717. --- 1,6 ----
  718.   # The UNIQUE command
  719.   
  720. ! # $Id: unique.t,v 3.0.1.1 1994/01/26 09:36:02 ram Exp $
  721.   #
  722.   #  Copyright (c) 1990-1993, Raphael Manfredi
  723.   #  
  724. ***************
  725. *** 11,16 ****
  726. --- 11,19 ----
  727.   #  of the source tree for mailagent 3.0.
  728.   #
  729.   # $Log: unique.t,v $
  730. + # Revision 3.0.1.1  1994/01/26  09:36:02  ram
  731. + # patch5: added tests for tag support
  732. + #
  733.   # Revision 3.0  1993/11/29  13:49:53  ram
  734.   # Baseline for mailagent 3.0 netwide release.
  735.   #
  736. ***************
  737. *** 55,60 ****
  738. --- 58,88 ----
  739.   -f "$user.1" && print "16\n";    # We rejected
  740.   -f "$user.2" || print "17\n";    # Must be there (saved in mode UNIQUE)
  741.   -f "$user" && print "18\n";
  742. + unlink "$user.1", "$user.2", $user;
  743. + &replace_header('X-Tag: unique #5');
  744. + `$cmd`;
  745. + $? == 0 || print "19\n";
  746. + -f "$user.1" || print "20\n";    # First time with both tags tag1 and tag2
  747. + -f "$user.2" && print "21\n";    # Can't be there (tag2 already recorded)
  748. + -f "$user.3" && print "22\n";    # Can't be there (already recorded previously)
  749. + -f "$user" && print "23\n";
  750. + &get_log(24, 'dbr/i/e');
  751. + &check_log('<tag2>$', 25) == 1 || print "26\n";
  752. + &check_log('<tag1>$', 27) == 1 || print "28\n";
  753. + &check_log('cambridge', 29) == 3 || print "30\n";
  754. + unlink "$user.1", "$user.2", "$user.3", $user;
  755. + &replace_header('X-Tag: unique #6');
  756. + `rm -rf dbr` if -d 'dbr';
  757. + `$cmd`;
  758. + $? == 0 || print "31\n";
  759. + -f "$user.1" || print "32\n";    # First time with tag 'tag'
  760. + -f "$user.2" || print "33\n";    # Tag 'other' distinct from 'tag'
  761. + -f "$user.3" && print "34\n";    # Sorry, already recorded
  762. + -f "$user" && print "35\n";
  763. + &get_log(36, 'dbr/i/e');
  764. + &check_log('cambridge', 37) == 2 || print "38\n";
  765.   
  766.   `rm -rf dbr` if -d 'dbr';
  767.   unlink "$user", "$user.1", "$user.2", "$user.3", 'mail';
  768.  
  769. Index: agent/test/option/F.t
  770. *** agent/test/option/F.t.old    Wed Jan 26 10:36:49 1994
  771. --- agent/test/option/F.t    Wed Jan 26 10:36:49 1994
  772. ***************
  773. *** 0 ****
  774. --- 1,48 ----
  775. + # -F : force processing on seen mail
  776. + # $Id: F.t,v 3.0.1.1 1994/01/26 09:36:08 ram Exp $
  777. + #
  778. + #  Copyright (c) 1990-1993, Raphael Manfredi
  779. + #  
  780. + #  You may redistribute only under the terms of the Artistic License,
  781. + #  as specified in the README file that comes with the distribution.
  782. + #  You may reuse parts of this distribution only within the terms of
  783. + #  that same Artistic License; a copy of which may be found at the root
  784. + #  of the source tree for mailagent 3.0.
  785. + #
  786. + # $Log: F.t,v $
  787. + # Revision 3.0.1.1  1994/01/26  09:36:08  ram
  788. + # patch5: created
  789. + #
  790. + do '../pl/init.pl';
  791. + do '../pl/logfile.pl';
  792. + chdir '../out';
  793. + $user = $ENV{'USER'};    # Don't want to include ../pl/filter.pl
  794. + unlink 'folder', 'again', $user;
  795. + system "$mailagent -e '{SAVE ~/folder}' -f ../mail >/dev/null 2>&1";
  796. + $? == 0 || print "1\n";
  797. + -f $user && print "2\n";
  798. + ($old_size = -s 'folder') || print "3\n";
  799. + &get_log(4, 'folder');
  800. + &check_log('^X-Filter:', 5) == 1 || print "6\n";
  801. + system "$mailagent -e '{SAVE ~/folder}' -f ./folder >/dev/null 2>&1";
  802. + $? == 0 || print "7\n";
  803. + -f $user || print "8\n";
  804. + ($old_size == -s 'folder') || print "9\n";
  805. + ($old_size == -s $user) || print "10\n";
  806. + &get_log(11, $user);
  807. + &check_log('^X-Filter:', 12) == 1 || print "13\n";
  808. + # Now here comes the -F check, now that we know everything works fine
  809. + unlink $user;
  810. + system "$mailagent -F -e '{SAVE ~/again}' -f ./folder >/dev/null 2>&1";
  811. + $? == 0 || print "14\n";
  812. + -f $user && print "15\n";
  813. + -s 'again' || print "16\n";
  814. + &get_log(17, 'again');
  815. + &check_log('^X-Filter:', 18) == 1 || print "19\n";
  816. + print "0\n";
  817.  
  818. Index: agent/pl/analyze.pl
  819. Prereq: 3.0
  820. *** agent/pl/analyze.pl.old    Wed Jan 26 10:36:43 1994
  821. --- agent/pl/analyze.pl    Wed Jan 26 10:36:43 1994
  822. ***************
  823. *** 1,4 ****
  824. ! ;# $Id: analyze.pl,v 3.0 1993/11/29 13:48:35 ram Exp $
  825.   ;#
  826.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  827.   ;#  
  828. --- 1,4 ----
  829. ! ;# $Id: analyze.pl,v 3.0.1.1 1994/01/26 09:30:23 ram Exp $
  830.   ;#
  831.   ;#  Copyright (c) 1990-1993, Raphael Manfredi
  832.   ;#  
  833. ***************
  834. *** 9,14 ****
  835. --- 9,17 ----
  836.   ;#  of the source tree for mailagent 3.0.
  837.   ;#
  838.   ;# $Log: analyze.pl,v $
  839. + ;# Revision 3.0.1.1  1994/01/26  09:30:23  ram
  840. + ;# patch5: now understands new -F option to force processing
  841. + ;#
  842.   ;# Revision 3.0  1993/11/29  13:48:35  ram
  843.   ;# Baseline for mailagent 3.0 netwide release.
  844.   ;#
  845. ***************
  846. *** 84,92 ****
  847.               }
  848.           }
  849.           if ($done) {            # We already processed that message
  850. !             &add_log("NOTICE already filtered, entering seen mode")
  851. !                 if $loglvl > 5;
  852. !             $mode = '_SEEN_';    # This is a special mode
  853.               $ever_seen = 1;        # This will prevent vacation messages
  854.               &s_seen;            # Update statistics
  855.           }
  856. --- 87,100 ----
  857.               }
  858.           }
  859.           if ($done) {            # We already processed that message
  860. !             if ($force_seen) {    # They used the -F option
  861. !                 &add_log("NOTICE already filtered, processing anyway")
  862. !                     if $loglvl > 5;
  863. !             } else {
  864. !                 &add_log("NOTICE already filtered, entering seen mode")
  865. !                     if $loglvl > 5;
  866. !                 $mode = '_SEEN_';    # This is a special mode
  867. !             }
  868.               $ever_seen = 1;        # This will prevent vacation messages
  869.               &s_seen;            # Update statistics
  870.           }
  871.  
  872. Index: agent/filter/parser.c
  873. Prereq: 3.0
  874. *** agent/filter/parser.c.old    Wed Jan 26 10:36:36 1994
  875. --- agent/filter/parser.c    Wed Jan 26 10:36:36 1994
  876. ***************
  877. *** 11,17 ****
  878.   */
  879.   
  880.   /*
  881. !  * $Id: parser.c,v 3.0 1993/11/29 13:48:18 ram Exp $
  882.    *
  883.    *  Copyright (c) 1990-1993, Raphael Manfredi
  884.    *  
  885. --- 11,17 ----
  886.   */
  887.   
  888.   /*
  889. !  * $Id: parser.c,v 3.0.1.1 1994/01/26 09:27:37 ram Exp $
  890.    *
  891.    *  Copyright (c) 1990-1993, Raphael Manfredi
  892.    *  
  893. ***************
  894. *** 22,27 ****
  895. --- 22,30 ----
  896.    *  of the source tree for mailagent 3.0.
  897.    *
  898.    * $Log: parser.c,v $
  899. +  * Revision 3.0.1.1  1994/01/26  09:27:37  ram
  900. +  * patch5: typo fix in a comment
  901. +  *
  902.    * Revision 3.0  1993/11/29  13:48:18  ram
  903.    * Baseline for mailagent 3.0 netwide release.
  904.    *
  905. ***************
  906. *** 189,195 ****
  907.   private void check_perm(file)
  908.   char *file;
  909.   {
  910. !     /* Check basic permissions on the specified file. If cannot be world
  911.        * writable and must be owned by the user. If the file specified does not
  912.        * exist, no error is reported however.
  913.        */
  914. --- 192,198 ----
  915.   private void check_perm(file)
  916.   char *file;
  917.   {
  918. !     /* Check basic permissions on the specified file. It cannot be world
  919.        * writable and must be owned by the user. If the file specified does not
  920.        * exist, no error is reported however.
  921.        */
  922.  
  923. Index: MANIFEST
  924. *** MANIFEST.old    Wed Jan 26 10:36:50 1994
  925. --- MANIFEST    Wed Jan 26 10:36:50 1994
  926. ***************
  927. *** 228,233 ****
  928. --- 228,234 ----
  929.   agent/test/misc/newcmd.t       Filter command extension tests
  930.   agent/test/misc/usrmac.t       User-defined macros checks
  931.   agent/test/option/             Tests the options to the mailagent program
  932. + agent/test/option/F.t          Test -F option
  933.   agent/test/option/L.t          Test -L option
  934.   agent/test/option/V.t          Test -V option
  935.   agent/test/option/c.t          Test -c option
  936.  
  937. Index: Credits
  938. *** Credits.old    Wed Jan 26 10:36:34 1994
  939. --- Credits    Wed Jan 26 10:36:34 1994
  940. ***************
  941. *** 89,94 ****
  942. --- 89,95 ----
  943.       Jim McCoy <mccoy@ccwf.cc.utexas.edu>
  944.       John Plate <plate@infotek.dk>
  945.       Jost Krieger <x920031@rubb.rz.ruhr-uni-bochum.de>
  946. +     Harald Koch <chk@enfm.utcc.utoronto.ca>
  947.       Keith Pyle <keith@ibmoto.com>
  948.       Keith Rose <rose@ultryx.com>
  949.       Kent Landfield <kent@imd.sterling.com>
  950.  
  951. *** End of Patch 6 ***
  952.  
  953. exit 0 # Just in case...
  954.