/[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.9 - (hide annotations) (download)
Mon Jul 8 11:47:20 2002 UTC (22 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.8: +5 -3 lines
2002-07-08  Wakaba <w@suika.fam.cx>

	* Message.pm: New module.

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.9 $VERSION=do{my @r=(q$Revision: 1.8 $=~/\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.9 $OPTION{value_type}->{recipient} = ['Message::Field::TypedText',{
199     -separator => ';',
200     }];
201 wakaba 1.1
202     $OPTION{uri_mailto_safe} = {
203     ':default' => 1,
204     };
205    
206     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
207     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
208    
209     package Message::Header::RFC822::Content;
210     our %OPTION = %Message::Header::RFC822::OPTION;
211     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:content';
212     $OPTION{namespace_phname} = 'content';
213     $OPTION{namespace_phname_goodcase} = 'Content';
214     $OPTION{namespace_phname_regex} = 'content';
215    
216     $OPTION{goodcase} = {
217     'id' => 'ID',
218     'md5' => 'MD5',
219     'sgml-entity' => 'SGML-Entity',
220     };
221    
222     $OPTION{value_type} = {
223     ':default' => ['Message::Field::Unstructured'],
224     alias => ['Message::Field::URI'],
225     base => ['Message::Field::URI'],
226     disposition => ['Message::Field::ValueParams'],
227     duration => ['Message::Field::Numval'],
228     encoding => ['Message::Field::CSV'],
229     features => ['Message::Field::Structured'],
230     id => ['Message::Field::MsgID'],
231     language => ['Message::Field::CSV'],
232     length => ['Message::Field::Numval'],
233     location => ['Message::Field::URI'],
234 wakaba 1.8 md5 => ['Message::Field::ValueParams',{
235     -parameter_av_Mrule => 'M_parameter_avpair',
236     -value_unsafe_rule => 'NON_base64alphabet',
237     }],
238 wakaba 1.1 range => ['Message::Field::Structured'],
239     'script-type' => ['Message::Field::ContentType'],
240     'style-type' => ['Message::Field::ContentType'],
241     'transfer-encoding' => ['Message::Field::ValueParams'],
242     type => ['Message::Field::ContentType'],
243 wakaba 1.8 version => ['Message::Field::ValueParams'],
244 wakaba 1.3 'x-properties' => ['Message::Field::Params'],
245 wakaba 1.1 };
246    
247     $OPTION{uri_mailto_safe} = {
248     ':default' => 1,
249     };
250    
251     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
252     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
253    
254     package Message::Header::RFC822::List;
255     our %OPTION = %Message::Header::RFC822::OPTION;
256     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:list';
257 wakaba 1.7 $OPTION{namespace_phname} = 'x-rfc822-list';
258     $OPTION{namespace_phname_goodcase} = 'X-RFC822-List';
259 wakaba 1.1
260     $OPTION{goodcase} = {
261     'id' => 'ID',
262     };
263    
264     $OPTION{value_type} = {
265     ':default' => ['Message::Field::Unstructured'],
266    
267 wakaba 1.4 id => ['Message::Field::ListID'],
268 wakaba 1.1 software => ['Message::Field::UA'],
269    
270     archive => ['Message::Field::CSV'],
271     digest => ['Message::Field::CSV'],
272     help => ['Message::Field::CSV'],
273     owner => ['Message::Field::CSV'],
274     post => ['Message::Field::CSV'],
275     subscribe => ['Message::Field::CSV'],
276     unsubscribe => ['Message::Field::CSV'],
277     url => ['Message::Field::CSV'],
278     };
279    
280     $OPTION{uri_mailto_safe} = {
281     ':default' => 1,
282     };
283    
284     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
285     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
286    
287     =head1 LICENSE
288    
289     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
290    
291     This program is free software; you can redistribute it and/or modify
292     it under the terms of the GNU General Public License as published by
293     the Free Software Foundation; either version 2 of the License, or
294     (at your option) any later version.
295    
296     This program is distributed in the hope that it will be useful,
297     but WITHOUT ANY WARRANTY; without even the implied warranty of
298     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
299     GNU General Public License for more details.
300    
301     You should have received a copy of the GNU General Public License
302     along with this program; see the file COPYING. If not, write to
303     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
304     Boston, MA 02111-1307, USA.
305    
306     =head1 CHANGE
307    
308     See F<ChangeLog>.
309 wakaba 1.9 $Date: 2002/07/07 00:46:07 $
310 wakaba 1.1
311     =cut
312    
313     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24