]> pere.pagekite.me Git - homepage.git/blob - linux/wreq/no-sig-no-mime-2.diff
Generated.
[homepage.git] / linux / wreq / no-sig-no-mime-2.diff
1 Index: req-mail
2 ===================================================================
3 RCS file: /cvsroot/its/sw/wreq/req-mail,v
4 retrieving revision 1.4
5 retrieving revision 1.7
6 diff -u -r1.4 -r1.7
7 --- req-mail 1999/05/15 10:41:24 1.4
8 +++ req-mail 1999/05/19 17:02:41 1.7
9 @@ -51,6 +51,7 @@
10 @body=();
11 $body=''; # as description field in req
12 $date='';
13 +$mimetype=''; # If this a mime message, place the type here
14 $warn=''; # error message. if set, no auto reply will be sent to sender
15 # carry along the group name if given as the 1st arg to the alias:
16 $group=defined($ARGV[0])?$ARGV[0]:'';
17 @@ -59,6 +60,10 @@
18 while(<STDIN>) {
19 chop;
20 last if(/^\s*$/);
21 + if (/^\s+/) {
22 + my $prevline = pop(@header);
23 + $_ = $prevline . $_;
24 + }
25 push(@header, $_);
26 }
27
28 @@ -69,7 +74,11 @@
29 }
30
31 $header=join "\n",@header;
32 -$body=join "\n",@body;
33 +
34 +if (grep(/^MIME-Version: /, @header)) {
35 + my ($typeline) = grep(/^Content-Type: /i, @header);
36 + ($mimetype) = $typeline =~ m/Content-Type:\s+([^;]+)/i;
37 +}
38
39 ###parse header for email:
40 foreach (@header){
41 @@ -79,6 +88,8 @@
42 ###########################################################
43 }elsif(/^Date:\s+(.*\S)/){ # Date: a b
44 $date=$1;
45 + }elsif(/^Subject:\s+(.*)$/){ # Subject: line
46 + $subject=$1;
47 }
48 ###########################################################
49 }
50 @@ -139,6 +150,44 @@
51 if($uid =~ /^(root|diag|sys|adm|lp|nobody|MAILER-DAEMON|postmaster|\
52 daemon|bin|uucp|powerdown)/i){
53 #$warn.=" Not send auto-reply to uid $uid.";
54 +}
55 +
56 +# Unpack MIME subjects
57 +if ( $subject =~ m%=\?([^\?]+)\?Q\?.+\?=% ) {
58 + $charset = $1;
59 + for $supcharset (@supcharsets) {
60 + if ($charset =~ /$supcharset/i) { # ignore case
61 + $subject =~ s/=\?[^\?]+\?Q\?(.+)\?=/$1/g;
62 + $subject =~ s/_/ /g;
63 + $subject =~ s/=([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
64 + }
65 + }
66 +
67 +}
68 +
69 +# XXX Should parse/unpack MIME mail here. We only handle text/plain for now.
70 +if ($mimetype && 'text/plain' ne $mimetype) {
71 + # send error back to user
72 + &sendMail("$error_from", "", "$email", "",
73 + "Error in sending your request",
74 + "Your request with subject\n\n$subject\n\n" .
75 + "was NOT included in bug list!\n\n".
76 + "We only handle MIME type text/plain or non-MIME for the moment\n" .
77 + "Please resend your request like that, or use the web form.\n\n" .
78 + "Thank you\n");
79 + exit 0;
80 +}
81 +
82 +# Skip signature
83 +if ('' eq $mimetype || 'text/plain' eq $mimetype) {
84 + $bodylines = 0;
85 + foreach (@body) {
86 + last if (/^-- $/ && $dropmailsig);
87 + $bodylines++;
88 + }
89 + $body=join "\n",@body[0..$bodylines-1];
90 +} else {
91 + $body=join "\n",@body;
92 }
93
94 ###send the request to the web server
95 Index: req-config
96 ===================================================================
97 RCS file: /cvsroot/its/sw/wreq/req-config,v
98 retrieving revision 1.5
99 retrieving revision 1.6
100 diff -u -r1.5 -r1.6
101 --- req-config 1999/05/15 11:21:23 1.5
102 +++ req-config 1999/05/19 17:02:41 1.6
103 @@ -14,6 +14,14 @@
104 #### If $sendmail is '', relay mails thru this host
105 $mailhost='mailhost';
106
107 +#### Set this to '1' to remove signatures (everything from '\n-- \n)
108 +#### in incoming mail and set to '' if you want to keep the signature
109 +$dropmailsig = '1';
110 +
111 +#### Supported charsets. Unescape these charsets when MIME encoded in
112 +#### mail subject
113 +@supcharsets = ("iso-8859-1", "iso8859-1");
114 +
115 #### The From address for errors in processing email requests
116 #### Note: to prevent mail looping, this address doesn't actually exist.
117 $error_from="Support Online Error <req-error\@student.uit.no>";