/[suikacvs]/messaging/manakai/lib/Message/Header/RFC822.pm
Suika

Contents of /messaging/manakai/lib/Message/Header/RFC822.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Sun Jul 7 00:46:07 2002 UTC (22 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.7: +7 -4 lines
2002-07-07  Wakaba <w@suika.fam.cx>

	* Entity.pm (check_md5): New method.
	* Entity.pm (fill_md5, fill_md5_name, recalc_md5): New options.

1 wakaba 1.1
2     =head1 NAME
3    
4     Message::Header::RFC822 --- Internet Messages -- Definition
5     for RFC822 Namespaces of Header Fields
6    
7     =cut
8    
9     package Message::Header::RFC822;
10     use strict;
11     use vars qw($VERSION);
12 wakaba 1.8 $VERSION=do{my @r=(q$Revision: 1.7 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
13 wakaba 1.1 require Message::Header::Default;
14    
15     our %OPTION = %Message::Header::Default::OPTION;
16     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822';
17 wakaba 1.7 $OPTION{namespace_phname} = 'x-rfc822';
18     $OPTION{namespace_phname_goodcase} = 'X-RFC822';
19 wakaba 1.1
20     $OPTION{case_sensible} = 0;
21    
22     $OPTION{goodcase} = {
23     fax => 'FAX',
24     'pics-label' => 'PICS-Label',
25     'list-url' => 'List-URL',
26     'list-id' => 'List-ID',
27     'message-id' => 'Message-ID',
28     'mime-version' => 'MIME-Version',
29     'nic' => 'NIC',
30     'nntp-posting-date' => 'NNTP-Posting-Date',
31     'nntp-posting-host' => 'NNTP-Posting-Host',
32     url => 'URL',
33     'x-dearfriend' => 'X-DearFriend',
34     'x-jsmail-priority' => 'X-JsMail-Priority',
35     'x-mime-autoconverted' => 'X-MIME-Autoconverted',
36     'x-mimeole' => 'X-MimeOLE',
37 wakaba 1.3 'x-ml-count' => 'X-ML-Count',
38     'x-ml-info' => 'X-ML-Info',
39     'x-ml-name' => 'X-ML-Name',
40 wakaba 1.1 'x-msmail-priority' => 'X-MSMail-Priority',
41     'x-nntp-posting-date' => 'X-NNTP-Posting-Date',
42     'x-nntp-posting-host' => 'X-NNTP-Posting-Host',
43     'x-uidl' => 'X-UIDL',
44     'x-uri' => 'X-URI',
45     'x-url' => 'X-URL',
46     };
47     $OPTION{to_be_goodcase} = \&_goodcase;
48    
49     $OPTION{value_type} = {
50     ':default' => ['Message::Field::Unstructured'],
51    
52     date => ['Message::Field::Date'],
53    
54     received => ['Message::Field::Received'],
55     'x-received' => ['Message::Field::Received'],
56    
57     archive => ['Message::Field::ValueParams'],
58     'auto-submitted' => ['Message::Field::ValueParams'],
59     'injector-info' => ['Message::Field::ValueParams'],
60     p3p => ['Message::Field::Params'],
61     'posted-and-mailed' => ['Message::Field::ValueParams'],
62     'x-face-type' => ['Message::Field::ValueParams'],
63     'x-mozilla-draft-info' => ['Message::Field::ValueParams'],
64    
65     ## A message id
66     'message-id' => ['Message::Field::MsgID'],
67    
68     ## Numeric value
69     lines => ['Message::Field::Numval'],
70     'max-forwards' => ['Message::Field::Numval'],
71     'mime-version' => ['Message::Field::Numval'],
72     'x-jsmail-priority' => ['Message::Field::Numval'],
73     'x-mail-count' => ['Message::Field::Numval'],
74     'x-ml-count' => ['Message::Field::Numval'],
75     'x-priority' => ['Message::Field::Numval'],
76    
77     path => ['Message::Field::Path'],
78     'user-agent' => ['Message::Field::UA'],
79 wakaba 1.3 'x-shimbun-agent' => ['Message::Field::UA'],
80 wakaba 1.1
81     subject => ['Message::Field::Subject'],
82     'x-nsubject' => ['Message::Field::Subject'],
83    
84 wakaba 1.4 'x-face' => ['Message::Field::XFace'],
85 wakaba 1.1 };
86     for (qw(cancel-lock disposition-notification-options encoding
87     importance pics-label precedence message-type
88 wakaba 1.4 priority x-list-id sensitivity x-msmail-priority xref))
89 wakaba 1.1 {$OPTION{value_type}->{$_} = ['Message::Field::Structured']}
90     for (qw(abuse-reports-to apparently-to approved approved-by bcc cc complaints-to
91     delivered-to disposition-notification-to envelope-to
92     errors-to from mail-copies-to mail-followup-to mail-reply-to
93     notice-requested-upon-delivery-to read-receipt-to register-mail-reply-requested-by
94     reply-to return-path
95     return-receipt-to return-receipt-requested-to sender to x-abuse-reports-to
96 wakaba 1.2 x-admin x-approved x-beenthere x-biglobe-sender x-confirm-reading-to
97 wakaba 1.1 x-complaints-to x-envelope-from x-envelope-sender
98     x-envelope-to x-ml-address x-ml-command x-ml-to x-nfrom x-nto
99     x-rcpt-to x-sender x-x-sender))
100     {$OPTION{value_type}->{$_} = ['Message::Field::Addresses']}
101     for (qw(client-date date date-received delivery-date expires
102     expire-date nntp-posting-date posted posted-date received-date
103 wakaba 1.5 reply-by resent-date x-originalarrivaltime x-original-date x-tcup-date))
104 wakaba 1.1 {$OPTION{value_type}->{$_} = ['Message::Field::Date']}
105     for (qw(article-updates in-reply-to
106     obsoletes references replaces see-also supersedes))
107     {$OPTION{value_type}->{$_} = ['Message::Field::MsgIDs']}
108     for (qw(encrypted followup-to keywords uri newsgroups posted-to))
109     {$OPTION{value_type}->{$_} = ['Message::Field::CSV']}
110     for (qw(x-brother x-boss x-classmate x-daughter x-dearfriend x-favoritesong
111     x-friend x-me
112     x-moe x-respect
113     x-sublimate x-son x-sister x-wife))
114     {$OPTION{value_type}->{$_} =[ 'Message::Field::CSV']} ## NOT M::F::XMOE!
115     for (qw(url x-home-page x-http_referer
116     x-info x-pgp-key x-ml-url x-uri x-url x-web))
117     {$OPTION{value_type}->{$_} = ['Message::Field::URI']}
118    
119     $OPTION{uri_mailto_safe} = {
120     ## 1 all (no check) 2 no trace & bcc & from
121     ## 3 no sender's info 4 (default) (currently not used)
122     ## 5 only a few
123     ':default' => 4,
124     'cc' => 5,
125     'bcc' => 1,
126     'body' => 1, ## Not entity body, but "body:" field.
127     'comments' => 5,
128     'date' => 1,
129     'from' => 1,
130     'keywords' => 5,
131     'list-id' => 1,
132     'mail-from' => 1,
133     'message-id' => 1,
134     'mime-version' => 1,
135     'received' => 1,
136     'return-path' => 1,
137     'sender' => 1,
138     'subject' => 5,
139     'summary' => 5,
140     'to' => 5,
141     'user-agent' => 3,
142     'x-face' => 2,
143     'x-mailer' => 3,
144     'x-nsubject' => 5,
145     'x-received' => 1,
146     'x400-received' => 1,
147     };
148    
149 wakaba 1.6 $OPTION{field}->{bcc} = {
150     empty_body => 1,
151     };
152     $OPTION{field}->{'incomplete-copy'} = { ## RFC 2156
153     empty_body => 1,
154     };
155    
156 wakaba 1.1 $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
157     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
158    
159     ## $self->_goodcase ($namespace_package_name, $field_name, \%option)
160     sub _goodcase ($$$\%) {
161     no strict 'refs';
162     my $self = shift;
163     my ($nspack, $name, $option) = @_;
164     return $name if $option->{format} =~ /uri-url-mailto/;
165     if ($option->{format} =~ /mail-rfc822/) {
166     if ($name eq 'cc' || $name eq 'bcc') {
167     return $name;
168     }
169     }
170     if (${$nspack.'::OPTION'}{goodcase}->{$name}) {
171     return ${$nspack.'::OPTION'}{goodcase}->{$name};
172     }
173     $name =~ s/(?:^|-)[a-z]/uc $&/ge;
174     $name;
175     }
176    
177     package Message::Header::RFC822::Resent;
178     our %OPTION = %Message::Header::RFC822::OPTION;
179     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:resent';
180 wakaba 1.7 $OPTION{namespace_phname} = 'x-rfc822-resent';
181     $OPTION{namespace_phname_goodcase} = 'X-RFC822-Resent';
182 wakaba 1.1 $OPTION{namespace_phname_regex} = 'resent';
183    
184     $OPTION{uri_mailto_safe} = {
185     ':default' => 1,
186     };
187    
188     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
189     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
190    
191     package Message::Header::RFC822::Original;
192     our %OPTION = %Message::Header::RFC822::OPTION;
193     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:original';
194 wakaba 1.7 $OPTION{namespace_phname} = 'x-rfc822-original';
195     $OPTION{namespace_phname_goodcase} = 'X-RFC822-Original';
196 wakaba 1.1
197 wakaba 1.6 $OPTION{value_type} = { %{ $OPTION{value_type} } };
198 wakaba 1.1 $OPTION{value_type}->{recipient} = ['Message::Header::Structured'];
199    
200     $OPTION{uri_mailto_safe} = {
201     ':default' => 1,
202     };
203    
204     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
205     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
206    
207     package Message::Header::RFC822::Content;
208     our %OPTION = %Message::Header::RFC822::OPTION;
209     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:content';
210     $OPTION{namespace_phname} = 'content';
211     $OPTION{namespace_phname_goodcase} = 'Content';
212     $OPTION{namespace_phname_regex} = 'content';
213    
214     $OPTION{goodcase} = {
215     'id' => 'ID',
216     'md5' => 'MD5',
217     'sgml-entity' => 'SGML-Entity',
218     };
219    
220     $OPTION{value_type} = {
221     ':default' => ['Message::Field::Unstructured'],
222     alias => ['Message::Field::URI'],
223     base => ['Message::Field::URI'],
224     disposition => ['Message::Field::ValueParams'],
225     duration => ['Message::Field::Numval'],
226     encoding => ['Message::Field::CSV'],
227     features => ['Message::Field::Structured'],
228     id => ['Message::Field::MsgID'],
229     language => ['Message::Field::CSV'],
230     length => ['Message::Field::Numval'],
231     location => ['Message::Field::URI'],
232 wakaba 1.8 md5 => ['Message::Field::ValueParams',{
233     -parameter_av_Mrule => 'M_parameter_avpair',
234     -value_unsafe_rule => 'NON_base64alphabet',
235     }],
236 wakaba 1.1 range => ['Message::Field::Structured'],
237     'script-type' => ['Message::Field::ContentType'],
238     'style-type' => ['Message::Field::ContentType'],
239     'transfer-encoding' => ['Message::Field::ValueParams'],
240     type => ['Message::Field::ContentType'],
241 wakaba 1.8 version => ['Message::Field::ValueParams'],
242 wakaba 1.3 'x-properties' => ['Message::Field::Params'],
243 wakaba 1.1 };
244    
245     $OPTION{uri_mailto_safe} = {
246     ':default' => 1,
247     };
248    
249     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
250     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
251    
252     package Message::Header::RFC822::List;
253     our %OPTION = %Message::Header::RFC822::OPTION;
254     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:list';
255 wakaba 1.7 $OPTION{namespace_phname} = 'x-rfc822-list';
256     $OPTION{namespace_phname_goodcase} = 'X-RFC822-List';
257 wakaba 1.1
258     $OPTION{goodcase} = {
259     'id' => 'ID',
260     };
261    
262     $OPTION{value_type} = {
263     ':default' => ['Message::Field::Unstructured'],
264    
265 wakaba 1.4 id => ['Message::Field::ListID'],
266 wakaba 1.1 software => ['Message::Field::UA'],
267    
268     archive => ['Message::Field::CSV'],
269     digest => ['Message::Field::CSV'],
270     help => ['Message::Field::CSV'],
271     owner => ['Message::Field::CSV'],
272     post => ['Message::Field::CSV'],
273     subscribe => ['Message::Field::CSV'],
274     unsubscribe => ['Message::Field::CSV'],
275     url => ['Message::Field::CSV'],
276     };
277    
278     $OPTION{uri_mailto_safe} = {
279     ':default' => 1,
280     };
281    
282     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
283     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
284    
285     =head1 LICENSE
286    
287     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
288    
289     This program is free software; you can redistribute it and/or modify
290     it under the terms of the GNU General Public License as published by
291     the Free Software Foundation; either version 2 of the License, or
292     (at your option) any later version.
293    
294     This program is distributed in the hope that it will be useful,
295     but WITHOUT ANY WARRANTY; without even the implied warranty of
296     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
297     GNU General Public License for more details.
298    
299     You should have received a copy of the GNU General Public License
300     along with this program; see the file COPYING. If not, write to
301     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
302     Boston, MA 02111-1307, USA.
303    
304     =head1 CHANGE
305    
306     See F<ChangeLog>.
307 wakaba 1.8 $Date: 2002/07/06 10:29:31 $
308 wakaba 1.1
309     =cut
310    
311     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24